Skip to content

Commit

Permalink
Bugfix in missing log path processed
Browse files Browse the repository at this point in the history
  • Loading branch information
olegs committed Feb 2, 2024
1 parent 2a85249 commit fe581a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 8 additions & 5 deletions src/main/kotlin/org/jetbrains/bio/span/SpanCLAAnalyze.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jetbrains.bio.span

import joptsimple.OptionSet
import org.jetbrains.bio.experiment.Configuration
import org.jetbrains.bio.experiment.configurePaths
import org.jetbrains.bio.genome.Genome
import org.jetbrains.bio.genome.GenomeQuery
Expand Down Expand Up @@ -107,18 +108,20 @@ object SpanCLAAnalyze {
require(0 < fdr && fdr <= 1) { "Illegal fdr: $fdr, expected range: (0, 1)" }

val workingDir = options.valueOf("workdir") as Path
val logId =
peaksPath?.stemGz ?: modelPath?.stem ?: reduceIds(listOf(modelId, fdr.toString(), gap.toString()))
val logPath = options.valueOf("log") as Path?
?: (org.jetbrains.bio.experiment.Configuration.logsPath / "$logId.log")
val id = peaksPath?.stemGz ?: modelPath?.stem ?:
reduceIds(listOf(modelId, fdr.toString(), gap.toString()))
var logPath = options.valueOf("log") as Path?
val chromSizesPath = options.valueOf("chrom.sizes") as Path?

// Configure working directories
LOG.info("WORKING DIR: $workingDir")
if (!SpanCLA.ignoreConfigurePaths) {
configurePaths(workingDir, genomesPath = chromSizesPath?.parent, logsPath = logPath.parent)
configurePaths(workingDir, genomesPath = chromSizesPath?.parent, logsPath = logPath?.parent)
}
// Configure logging to file
if (logPath == null) {
logPath = Configuration.logsPath / "$id.log"
}
Logs.addLoggingToFile(logPath)
LOG.info("LOG: $logPath")

Expand Down
11 changes: 7 additions & 4 deletions src/main/kotlin/org/jetbrains/bio/span/SpanCLACompare.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jetbrains.bio.span

import joptsimple.OptionSet
import org.jetbrains.bio.experiment.Configuration
import org.jetbrains.bio.experiment.configurePaths
import org.jetbrains.bio.genome.Genome
import org.jetbrains.bio.genome.GenomeQuery
Expand All @@ -14,6 +15,7 @@ import org.jetbrains.bio.span.peaks.Peak
import org.jetbrains.bio.util.*
import org.slf4j.event.Level
import java.nio.file.Path
import kotlin.math.log

object SpanCLACompare {

Expand Down Expand Up @@ -95,20 +97,21 @@ object SpanCLACompare {

val workingDir = options.valueOf("workdir") as Path
val id = peaksPath?.stemGz ?: reduceIds(listOf(modelId, fdr.toString(), gap.toString()))
val logPath = options.valueOf("log") as Path? ?:
(org.jetbrains.bio.experiment.Configuration.logsPath / "$id.log")
var logPath = options.valueOf("log") as Path?
val chromSizesPath = options.valueOf("chrom.sizes") as Path?

// Configure working directories
LOG.info("WORKING DIR: $workingDir")
if (!SpanCLA.ignoreConfigurePaths) {
configurePaths(workingDir, genomesPath = chromSizesPath?.parent, logsPath = logPath.parent)
configurePaths(workingDir, genomesPath = chromSizesPath?.parent, logsPath = logPath?.parent)
}
// Configure logging to file
if (logPath == null) {
logPath = Configuration.logsPath / "$id.log"
}
Logs.addLoggingToFile(logPath)
LOG.info("LOG: $logPath")


// Call now to preserve correct params logging
val lazyDifferentialPeakCallingResults = differentialPeakCallingResults(options)

Expand Down

0 comments on commit fe581a3

Please sign in to comment.