-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
caa8540
commit d675d96
Showing
1 changed file
with
39 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,51 @@ | ||
process samtools { | ||
publishDir "${params.output}/${name}/phage_positive_contigs", mode: 'copy', pattern: "${name}_positive_contigs.fa" | ||
label 'samtools' | ||
publishDir "${params.output}/${name}/phage_positive_contigs", mode: 'copy', pattern: "${name}_positive_contigs.fa" | ||
label 'samtools' | ||
input: | ||
tuple val(name), file(file), file(list) | ||
tuple val(name), file(file), file(list) | ||
output: | ||
tuple val(name), file("${name}_positive_contigs.fa") | ||
tuple val(name), file("${name}_positive_contigs.fa") | ||
script: | ||
""" | ||
cat ${list} | sort | uniq > tmp_allctgs.txt | ||
cat ${file} > all.fasta | ||
xargs samtools faidx all.fasta < tmp_allctgs.txt > ${name}_positive_contigs.fa | ||
""" | ||
""" | ||
cat ${list} | sort | uniq > tmp_allctgs.txt | ||
cat ${file} > all.fasta | ||
# get samtools but ignore "samtool fails" | ||
while read fastaheader; do | ||
if grep -qw ">\$fastaheader" all.fasta; then | ||
samtools faidx all.fasta \$fastaheader >> ${name}_positive_contigs.fa | ||
else | ||
echo "\$fastaheader not found" >> error_code_samtools.txt | ||
fi | ||
done < tmp_allctgs.txt | ||
# old command | ||
# xargs samtools faidx all.fasta < tmp_allctgs.txt > ${name}_positive_contigs.fa | ||
""" | ||
} | ||
|
||
process samtools_fastq { | ||
publishDir "${params.output}/${name}/phage_positive_contigs", mode: 'copy', pattern: "${name}_positive_contigs.fa" | ||
label 'samtools' | ||
publishDir "${params.output}/${name}/phage_positive_contigs", mode: 'copy', pattern: "${name}_positive_contigs.fa" | ||
label 'samtools' | ||
input: | ||
tuple val(name), file(file), file(list) | ||
tuple val(name), file(file), file(list) | ||
output: | ||
tuple val(name), file("${name}_positive_contigs.fa") | ||
tuple val(name), file("${name}_positive_contigs.fa") | ||
script: | ||
""" | ||
cat ${list} | sort | uniq > tmp_allctgs.txt | ||
cat ${file} > all.fasta | ||
xargs samtools faidx all.fasta < tmp_allctgs.txt > ${name}_positive_contigs.fa | ||
""" | ||
cat ${list} | sort | uniq > tmp_allctgs.txt | ||
cat ${file} > all.fasta | ||
# get samtools but ignore "samtool fails" | ||
while read fastaheader; do | ||
if grep -qw ">\$fastaheader" all.fasta; then | ||
samtools faidx all.fasta \$fastaheader >> ${name}_positive_contigs.fa | ||
else | ||
echo "\$fastaheader not found" >> error_code_samtools.txt | ||
fi | ||
done < tmp_allctgs.txt | ||
# old command | ||
# xargs samtools faidx all.fasta < tmp_allctgs.txt > ${name}_positive_contigs.fa | ||
""" | ||
} |