Skip to content

Commit

Permalink
changing bad for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
fmalmeida committed Jun 2, 2022
1 parent 6d9caad commit 5955ac5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
14 changes: 4 additions & 10 deletions modules/local/salmon_alevin.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,14 @@ process SALMON_ALEVIN {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

// simple loop to separate forward from reverse pairs
def forward_pairs = []
def reverse_pairs = []
for (n in 1..reads.toList().size()) {
current_index = n - 1
if ( n % 2 == 0 ) { reverse_pairs.add(reads[current_index]) }
else { forward_pairs.add(reads[current_index]) }
}
// separate forward from reverse pairs
def (forward, reverse) = reads.collate(2).transpose()
"""
salmon alevin \\
-l ISR \\
-p $task.cpus \\
-1 ${forward_pairs.join( " " )} \\
-2 ${reverse_pairs.join( " " )} \\
-1 ${forward.join( " " )} \\
-2 ${reverse.join( " " )} \\
--${protocol} \\
-i $index \\
--tgMap $txp2gene \\
Expand Down
12 changes: 3 additions & 9 deletions modules/local/star_align.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ process STAR_ALIGN {
def mv_unsorted_bam = (args.contains('--outSAMtype BAM Unsorted SortedByCoordinate')) ? "mv ${prefix}.Aligned.out.bam ${prefix}.Aligned.unsort.out.bam" : ''
// def read_pair = params.protocol.contains("chromium") ? "${reads[1]} ${reads[0]}" : "${reads[0]} ${reads[1]}" -- commented out to be removed is it is not being used

// simple loop to separate forward from reverse pairs
def forward_pairs = []
def reverse_pairs = []
for (n in 1..reads.toList().size()) {
current_index = n - 1
if ( n % 2 == 0 ) { reverse_pairs.add(reads[current_index]) }
else { forward_pairs.add(reads[current_index]) }
}
// separate forward from reverse pairs
def (forward, reverse) = reads.collate(2).transpose()
"""
STAR \\
--genomeDir $index \\
--readFilesIn ${reverse_pairs.join( "," )} ${forward_pairs.join( "," )} \\
--readFilesIn ${reverse.join( "," )} ${forward.join( "," )} \\
--runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\
--soloCBwhitelist <(gzip -cdf $whitelist) \\
Expand Down

0 comments on commit 5955ac5

Please sign in to comment.