Skip to content

Commit

Permalink
Improve readTsv function
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed Sep 20, 2024
1 parent 3c97317 commit e8b8a20
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions modules/functions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,15 @@ def printLog() {
* - printLog: a boolean to specify whether to print a summary of the TSV file (default: true)
*/
def readTsv(tsvFile, boolean printLog = true) {
def (samples, ids, lines) = [[], [], []]
def (samples, ids, lines, skipped) = [[], [], [], []]
tsvFile.eachLine { line ->
def (sampleId, runId, fileName, format, readId) = line.split()
if (line.startsWith("#"))
return
def (sampleId, runId, fileName, format, view) = line.split()
if ( view == "TranscriptomeAlignments" ) {
skipped << [view, sampleId]
return
}
samples << sampleId
ids << "${sampleId}${runId}"
lines << line
Expand All @@ -156,6 +162,14 @@ def readTsv(tsvFile, boolean printLog = true) {
log.info "Number of sequencing runs : ${nIds}"
log.info "Merging : ${ doMerge ? 'by sample' : 'none' }"
log.info ""

skipped.each {
def (view, sampleId) = it
log.warn "Skipping input ${view} for '${sampleId}'"
if(it == skipped.last()) {
log.info ""
}
}
}
[ doMerge, lines ]
}
Expand Down

0 comments on commit e8b8a20

Please sign in to comment.