Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating docs to match the code. #277

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ nav:
- Building and loading: build_and_load.md
- Imputation:
- k-mer Imputation (Original): imputation.md
- RopeBWT3 Imputation (BETA): ropebwt3_imputation.md
- RopeBWT3 Imputation (BETA): imputation_ropebwt.md
- Resequencing: resequencing.md
- Exporting data: export_data.md
- Reference:
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/net/maizegenetics/phgv2/cli/Phg.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.github.ajalt.clikt.output.MordantHelpFormatter
import com.github.ajalt.clikt.parameters.options.versionOption
import net.maizegenetics.phgv2.pathing.*
import net.maizegenetics.phgv2.pathing.ropebwt.MapReads
import net.maizegenetics.phgv2.pathing.ropebwt.RopebwtIndex
import net.maizegenetics.phgv2.pathing.ropebwt.RopeBwtIndex
import net.maizegenetics.phgv2.utils.phgVersion
import net.maizegenetics.phgv2.utils.setupDebugLogging

Expand All @@ -33,7 +33,7 @@ fun main(args: Array<String>) = Phg()
SetupEnvironment(), Initdb(), CreateRanges(), PrepareAssemblies(), AgcCompress(), AlignAssemblies(), PrepareSlurmAlignFile(),
CreateAnchorwaveDotplot(), CreateRefVcf(), CreateMafVcf(), Gvcf2Hvcf(), Hvcf2Gvcf(), LoadVcf(), ExportVcf(),
BuildKmerIndex(), MapKmers(), FindPaths(), HapidSampleTable(), SampleHapidByRange(),
RopebwtIndex(), MapReads(), // Imputation
RopeBwtIndex(), MapReads(), // Imputation
CreateFastaFromHvcf(), ListSamples(), MergeHvcfs(), MergeGVCFs(), CalcVcfMetrics(), StartServer, ExtractEdgeReads(), //Utilities
QcReadMapping(), PathsToGff(), // Utilities continued
CompositeToHaplotypeCoords(), // resequencing pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ class MapReads : CliktCommand(help="BETA: Map reads to a pangenome using ropeBWT
currentLine = bedFileReader.readLine()
}

processMemsForRead(tempMems, readMapping, maxNumHits, hapIdToRefRangeMap)
if(tempMems.isNotEmpty()) {
processMemsForRead(tempMems, readMapping, maxNumHits, hapIdToRefRangeMap)
}
return readMapping
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ sealed class RopeBWTIndexInput {
*
* With the output files we can then run ropebwt3 mem and get read mappings.
*/
class RopebwtIndex : CliktCommand(help="BETA: Create a ropeBWT3 index") {
class RopeBwtIndex : CliktCommand(help="BETA: Create a ropeBWT3 index") {

private val myLogger = LogManager.getLogger(RopebwtIndex::class.java)
private val myLogger = LogManager.getLogger(RopeBwtIndex::class.java)

// Pre-compile the Regex pattern - used when creating the output fasta file names
val HVCF_PATTERN = Regex("""(\.hvcf|\.h\.vcf|\.hvcf\.gz|\.h\.vcf\.gz)$""")
Expand All @@ -61,7 +61,7 @@ class RopebwtIndex : CliktCommand(help="BETA: Create a ropeBWT3 index") {
val indexFilePrefix by option(help = "Prefix of the ropebwt3 index file. This will be added to the output directory and ropeBWT3 will make a number of output files.")
.required()

val numThreads by option(help = "Number of threads to use for the index creation.")
val threads by option(help = "Number of threads to use for the index creation.")
.int()
.default(3)

Expand All @@ -86,7 +86,7 @@ class RopebwtIndex : CliktCommand(help="BETA: Create a ropeBWT3 index") {

myLogger.info("Creating ropeBWT3 index for $pangenomeFastaFile")

createInitialIndex(pangenomeFastaFile, "${outputDir}/${indexFilePrefix}", numThreads, deleteFmrIndex, condaEnvPrefix)
createInitialIndex(pangenomeFastaFile, "${outputDir}/${indexFilePrefix}", threads, deleteFmrIndex, condaEnvPrefix)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
import biokotlin.seqIO.NucSeqIO
import biokotlin.util.bufferedReader
import com.github.ajalt.clikt.testing.test
import net.maizegenetics.phgv2.cli.AgcCompress
import net.maizegenetics.phgv2.cli.CreateFastaFromHvcf
import net.maizegenetics.phgv2.cli.TestExtension
import net.maizegenetics.phgv2.utils.setupDebugLogging
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import java.io.BufferedWriter
import java.io.File
import java.io.FileWriter
import kotlin.test.Ignore
import kotlin.test.assertEquals
import kotlin.test.fail

class RopebwtIndexTest {
class RopeBwtIndexTest {


companion object {
Expand Down Expand Up @@ -64,7 +58,7 @@

@Test
fun testCliktParams() {
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()


//pangenome-file
Expand All @@ -72,7 +66,7 @@
//Leave off the input files
val noInputs = ropebwtIndex.test("--db-path ${TestExtension.tempDir} --output-dir ${TestExtension.tempDir}ropebwtTest/ --index-file-prefix testIndex --num-threads 3 --delete-fmr-index")
assertEquals(1, noInputs.statusCode)
assertEquals("Usage: ropebwt-index [<options>]\n\n" +

Check failure on line 69 in src/test/kotlin/net/maizegenetics/phgv2/pathing/ropebwt/RopeBwtIndexTest.kt

View workflow job for this annotation

GitHub Actions / PHGv2 Test Report

RopeBwtIndexTest.testCliktParams()

org.opentest4j.AssertionFailedError: expected: <Usage: ropebwt-index [<options>] Error: must provide one of --pangenome-file, --hvcf-dir > but was: <Usage: rope-bwt-index [<options>] Error: no such option --num-threads. Did you mean --threads? >
Raw output
org.opentest4j.AssertionFailedError: expected: <Usage: ropebwt-index [<options>]

Error: must provide one of --pangenome-file, --hvcf-dir
> but was: <Usage: rope-bwt-index [<options>]

Error: no such option --num-threads. Did you mean --threads?
>
	at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
	at app//org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
	at app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1152)
	at app//kotlin.test.junit5.JUnit5Asserter.assertEquals(JUnitSupport.kt:32)
	at app//kotlin.test.AssertionsKt__AssertionsKt.assertEquals(Assertions.kt:63)
	at app//kotlin.test.AssertionsKt.assertEquals(Unknown Source)
	at app//kotlin.test.AssertionsKt__AssertionsKt.assertEquals$default(Assertions.kt:62)
	at app//kotlin.test.AssertionsKt.assertEquals$default(Unknown Source)
	at app//net.maizegenetics.phgv2.pathing.ropebwt.RopeBwtIndexTest.testCliktParams(RopeBwtIndexTest.kt:69)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at app//org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
	at app//org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
	at app//org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
	at app//org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at app//org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at app//org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:214)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
	at app//org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:119)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:94)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:89)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
"Error: must provide one of --pangenome-file, --hvcf-dir\n", noInputs.stderr)

val tooManyInputs = ropebwtIndex.test("--pangenome-file data/test/smallseq/pangenome.fa --hvcf-dir data/test/smallseq/hvcf/ --db-path ${TestExtension.tempDir} --output-dir ${TestExtension.tempDir}ropebwtTest/ --index-file-prefix testIndex --num-threads 3 --delete-fmr-index")
Expand All @@ -97,7 +91,7 @@
//runBuildStep(inputFasta:String, indexFilePrefix:String, numThreads: Int, condaEnvPrefix:String)
@Test
fun testRunBuildStep() {
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()
val numThreads = 3
ropebwtIndex.runBuildStep(inputFasta, indexFilePrefix, numThreads, "")

Expand All @@ -109,7 +103,7 @@
//deleteFMRIndex(indexFilePrefix: String)
@Test
fun testConvertAndDeleteBWTIndex() {
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()
val numThreads = 3

ropebwtIndex.runBuildStep(inputFasta, indexFilePrefix, numThreads, "")
Expand All @@ -126,7 +120,7 @@
//buildSuffixArray(indexFilePrefix: String, numThreads: Int, condaEnvPrefix: String)
@Test
fun testBuildSuffixArray() {
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()
val numThreads = 3

ropebwtIndex.runBuildStep(inputFasta, indexFilePrefix, numThreads, "")
Expand All @@ -139,7 +133,7 @@
//buildChrLengthFile(inputFasta: String, indexFilePrefix: String)
@Test
fun testBuildChrLengthFile() {
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()
ropebwtIndex.buildChrLengthFile(inputFasta, indexFilePrefix)

//verify that the output file exists
Expand Down Expand Up @@ -167,7 +161,7 @@
@Test
fun createInitialIndex() {
resetDirs()
val ropebwtIndex = RopebwtIndex()
val ropebwtIndex = RopeBwtIndex()
val numThreads = 3
ropebwtIndex.createInitialIndex(inputFasta, indexFilePrefix, numThreads, true,"")

Expand Down
Loading