Skip to content

Commit

Permalink
Add function to check for multi-fasta
Browse files Browse the repository at this point in the history
  • Loading branch information
drpatelh committed Jan 18, 2021
1 parent 5c8a91b commit eca37f8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/Checks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,26 @@ class Checks {
}
}
return val
}
}

// Print warning if genome fasta has more than one sequence
static void is_multifasta(fasta, log) {
def count = 0
def line = null
fasta.withReader { reader ->
while (line = reader.readLine()) {
if (line.contains('>')) {
count++
if (count > 1) {
log.warn "=============================================================================\n" +
" This pipeline does not officially support multi-fasta genome files!\n\n" +
" The parameters and processes are tailored for viral genome analysis.\n" +
" Please amend the '--fasta' parameter.\n" +
"==================================================================================="
break
}
}
}
}
}
}

0 comments on commit eca37f8

Please sign in to comment.