Skip to content
Snippets Groups Projects
Commit 00207f57 authored by Rachel  LEGENDRE's avatar Rachel LEGENDRE
Browse files

adapt sortmerna rule to new version

parent e93fedb1
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,8 @@ rule sortmerna: ...@@ -30,6 +30,8 @@ rule sortmerna:
output: output:
rRNA = temp(sortmerna_outfile_rRNA), rRNA = temp(sortmerna_outfile_rRNA),
no_rRNA = temp(sortmerna_outfile_no_rRNA) no_rRNA = temp(sortmerna_outfile_no_rRNA)
params:
tmpdir = config['tmpdir']
singularity: singularity:
"rnaflow.img" "rnaflow.img"
shadow: "shallow" shadow: "shallow"
...@@ -38,25 +40,28 @@ rule sortmerna: ...@@ -38,25 +40,28 @@ rule sortmerna:
out = sortmerna_logs_out out = sortmerna_logs_out
threads: 6 threads: 6
envmodules: envmodules:
"sortmerna/2.1b" "sortmerna/4.3.4"
shell: shell:
""" """
set +o pipefail set +o pipefail
#tmp="{input.fastq}" tmp="{input.fastq}"
#infiles=($tmp) infiles=($tmp)
fasta="{input.fasta}" fasta="{input.fasta}"
index=${{fasta%.fa}} idxdir=$(dirname ${{fasta}})"/sortmerna/"
if [[ ! -s ${{index}}.stats ]]
then
indexdb_rna --ref ${{fasta}},${{index}}
fi
if [[ ${{#infiles[@]}} -eq 2 ]];
then
sortmerna --ref ${{fasta}} --idx-dir ${{idxdir}} --workdir {params.tmpdir} -threads {threads} --reads ${{infiles[0]}} --reads ${{infiles[1]}} --aligned {output.rRNA} --fastx --out2 --paired_out --other {output.no_rRNA} -v > {log.out} 2> {log.err}
mv {output.no_rRNA}.fastq {output.no_rRNA}
mv {output.rRNA}.fastq {output.rRNA}
sortmerna --ref ${{fasta}},${{index}} -a {threads} --reads {input.fastq} --aligned {output.rRNA} --fastx --other {output.no_rRNA} --log -v > {log.out} 2> {log.err} else
sortmerna --ref ${{fasta}} --idx-dir ${{idxdir}} --workdir {params.tmpdir} -threads {threads} --reads ${{infiles[0]}} --aligned {output.rRNA} --fastx --other {output.no_rRNA} -v > {log.out} 2> {log.err}
mv {output.no_rRNA}.fastq {output.no_rRNA}
mv {output.rRNA}.fastq {output.rRNA}
fi
mv {output.no_rRNA}.fastq {output.no_rRNA}
mv {output.rRNA}.fastq {output.rRNA}
""" """
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment