Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "net.maizegenetics"
version = "0.2.4"
version = "0.2.5"

repositories {
mavenCentral()
Expand All @@ -19,7 +19,6 @@ dependencies {
implementation("com.google.guava:guava:33.1.0-jre")
implementation("com.github.samtools:htsjdk:4.0.1")


testImplementation(kotlin("test"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ class ConvertCoordinates : CliktCommand(name = "convert-coordinates") {
}

// Run convert_coords.py
// Set PYTHONPATH so Python can find the 'python' package for imports
val pythonPath = mlimputeDir.resolve("src").toString()
logger.info("Running convert_coords.py")
val exitCode = ProcessRunner.runCommand(
"env", "PYTHONPATH=$pythonPath",
"pixi", "run",
"python", pythonScript.toString(),
"--assembly-list", assemblyList.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ class GenerateRecombinedSequences : CliktCommand(name = "generate-recombined-seq
}

// Run write_fastas.py
// Set PYTHONPATH so Python can find the 'python' package for imports
val pythonPath = mlimputeDir.resolve("src").toString()
logger.info("Running write_fastas.py")
val exitCode = ProcessRunner.runCommand(
"env", "PYTHONPATH=$pythonPath",
"pixi", "run",
"python", pythonScript.toString(),
"--assembly-list", assemblyList.toString(),
Expand Down
28 changes: 11 additions & 17 deletions src/main/kotlin/net/maizegenetics/commands/Orchestrate.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.maizegenetics.commands

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.parse
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
Expand Down Expand Up @@ -167,24 +168,14 @@ class Orchestrate : CliktCommand(name = "orchestrate") {
logger.info("AUTO-SETUP: Running setup-environment")
logger.info("=".repeat(80))

val args = buildList {
add("setup-environment")
add("--work-dir=${workDir}")
}

val exitCode = ProcessRunner.runCommand(
"./gradlew", "run", "--args=${args.joinToString(" ")}",
workingDir = File("."),
logger = logger
)

if (exitCode != 0) {
logger.error("setup-environment failed with exit code $exitCode")
return false
return try {
SetupEnvironment().parse(listOf("--work-dir=$workDir"))
logger.info("setup-environment completed successfully")
true
} catch (e: Exception) {
logger.error("setup-environment failed: ${e.message}", e)
false
}

logger.info("setup-environment completed successfully")
return true
}

private fun parseYamlConfig(configPath: Path): PipelineConfig {
Expand Down Expand Up @@ -217,6 +208,7 @@ class Orchestrate : CliktCommand(name = "orchestrate") {
}

// Parse maf_to_gvcf
@Suppress("UNCHECKED_CAST")
val mafToGvcfMap = configMap["maf_to_gvcf"] as? Map<String, Any>
val mafToGvcf = mafToGvcfMap?.let {
MafToGvcfConfig(
Expand All @@ -227,6 +219,7 @@ class Orchestrate : CliktCommand(name = "orchestrate") {
}

// Parse downsample_gvcf
@Suppress("UNCHECKED_CAST")
val downsampleGvcfMap = configMap["downsample_gvcf"] as? Map<String, Any>
val downsampleGvcf = downsampleGvcfMap?.let {
DownsampleGvcfConfig(
Expand All @@ -241,6 +234,7 @@ class Orchestrate : CliktCommand(name = "orchestrate") {
}

// Parse convert_to_fasta
@Suppress("UNCHECKED_CAST")
val convertToFastaMap = configMap["convert_to_fasta"] as? Map<String, Any>
val convertToFasta = convertToFastaMap?.let {
ConvertToFastaConfig(
Expand Down
13 changes: 9 additions & 4 deletions src/main/kotlin/net/maizegenetics/commands/PickCrossovers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ class PickCrossovers : CliktCommand(name = "pick-crossovers") {
FileUtils.createOutputDirectory(outputDir, logger)

// Run pick_crossovers.py
// Set PYTHONPATH so Python can find the 'python' package for imports
// Use absolute paths since the working directory is set to outputDir
// Use sh -c to set PYTHONPATH inside pixi's environment
val pythonPath = mlimputeDir.resolve("src").toAbsolutePath().toString()
val scriptPath = pythonScript.toAbsolutePath().toString()
val refFastaPath = refFasta.toAbsolutePath().toString()
val assemblyListPath = assemblyList.toAbsolutePath().toString()
val shellCommand = "PYTHONPATH='$pythonPath' python '$scriptPath' --ref-fasta '$refFastaPath' --assembly-list '$assemblyListPath'"
logger.info("Running pick_crossovers.py")
val exitCode = ProcessRunner.runCommand(
"pixi", "run",
"python", pythonScript.toString(),
"--ref-fasta", refFasta.toString(),
"--assembly-list", assemblyList.toString(),
"pixi", "run", "sh", "-c", shellCommand,
workingDir = outputDir.toFile(),
logger = logger
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class SetupEnvironment : CliktCommand(name = "setup-environment") {
.toFile()

if (mlImputeGradlew.exists()) {
if (mlImputeGradlew.setExecutable(true)) {
// setExecutable(true, false) makes it executable for all users (like chmod +x)
if (mlImputeGradlew.setExecutable(true, false)) {
logger.info("Made MLImpute gradlew executable: ${mlImputeGradlew.path}")
} else {
logger.warn("Failed to set executable permissions on gradlew: ${mlImputeGradlew.path}")
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ seqkit = "*"
crossmap = "*"
parallel = "*"
pysam = "*"
samtools = "*"

# Linux-only dependencies (AnchorWave not available on macOS)
[target.linux-64.dependencies]
Expand Down