Commit 4fd620b2 authored by Midoux Cedric's avatar Midoux Cedric
Browse files

conda activate

parent d48141a8
......@@ -6,14 +6,14 @@ rule select_small:
params:
min_len = config["CONTIGS_LEN"]
shell:
"conda activate seqkit-0.10.1 "
" ; "
"conda activate seqkit-0.11.0 "
"&& "
"seqkit "
"seq "
"--max-len {params.min_len} "
"--out-file {output.contigs} "
"{input} "
" ; "
"&& "
"conda deactivate"
rule kaiju_small:
......@@ -24,12 +24,17 @@ rule kaiju_small:
threads:
8
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} "
"-o {output} "
"-z {threads}"
"-z {threads} "
"&& "
"conda deactivate"
rule select_unmapped:
input:
......@@ -38,16 +43,24 @@ rule select_unmapped:
bam = temp("work/addon/unmapped-{sample}-{reads}.bam"),
fastq = "work/addon/unmapped-{sample}-{reads}.fastq"
shell:
"conda activate samtools-1.9 "
"&& "
"samtools "
"view "
"-f 4 "
"-o {output.bam} "
"{input} "
" ; "
"&& "
"conda deactivate "
"&& "
"conda activate bedtools-2.29.0 "
"&& "
"bedtools "
"bamtofastq "
"-i {output.bam} "
"-fq {output.fastq} "
"&& "
"conda deactivate "
rule kaiju_unmapped:
input:
......@@ -57,12 +70,17 @@ rule kaiju_unmapped:
threads:
8
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"-i {input} "
"-o {output} "
"-z {threads}"
"-z {threads} "
"&& "
"conda deactivate"
rule kronaNames_addon:
input:
......@@ -70,9 +88,13 @@ rule kronaNames_addon:
output:
"work/addon/{sample}.{addon}.taxNames.tsv"
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju-addTaxonNames "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-n /db/outils/kaiju/nr/names.dmp "
"-i {input} "
"-o {output} "
"-r superkingdom,phylum,order,class,family,genus,species"
"-r superkingdom,phylum,order,class,family,genus,species "
"&& "
"conda deactivate"
......@@ -11,14 +11,18 @@ rule FragGeneScan:
params:
output = lambda wildcards, output: os.path.splittext(str(output))[0]
shell:
"conda activate fraggenescan-1.31 "
"&& "
"run_FragGeneScan.pl "
"-genome={input} "
"-out={params.output} "
"-complete=0 " #negative values with complete=1
"-train=complete "
"-thread={threads} "
" ; "
"&& "
"sed --in-place 's/*/N/' {output.faa} "
"&& "
"conda deactivate "
rule prodigal:
input:
......@@ -28,6 +32,8 @@ rule prodigal:
ffn = "work/prodigal/{sample}/{sample}_prodigal.ffn",
gff = "work/prodigal/{sample}/{sample}_prodigal.gff"
shell:
# "conda activate prodigal "
# "&& "
"prodigal "
"-f gff "
"-i {input} "
......@@ -36,8 +42,10 @@ rule prodigal:
"-o {output.gff} "
"-g 11 "
"-p meta "
" ; "
"&& "
"sed --in-place 's/*$//' {output.faa} "
# "&& "
# "conda deactivate "
def faa_input(wildcards):
if wildcards.sample == "catalogue":
......@@ -78,6 +86,8 @@ rule diamond:
threads:
20
shell:
"conda activate diamond-0.9.26 "
"&& "
"diamond "
"blastp "
"--db {input.db} "
......@@ -92,7 +102,8 @@ rule diamond:
"--un {output.unaligned} "
"--verbose "
"--tmpdir /projet/tmp/ "
"&& "
"conda deactivate "
rule diamondView:
input:
......@@ -102,12 +113,16 @@ rule diamondView:
params:
keywords = "qseqid qlen sseqid sallseqid slen qstart qend sstart send qseq full_qseq sseq full_sseq evalue bitscore score length pident nident mismatch positive gapopen gaps ppos qframe btop stitle salltitles qcovhsp qtitle qqual" #staxids
shell:
"conda activate diamond-0.9.26 "
"&& "
"diamond "
"view "
"--daa {input.daa} "
"--outfmt 6 {params.keywords} "
"--out {output.tsv} "
"--header "
"&& "
"conda deactivate "
rule prokka:
input:
......@@ -130,6 +145,8 @@ rule prokka:
threads:
8
shell:
"conda activate prokka-1.14.5 "
"&& "
"prokka "
"--outdir {params.output} "
"--force "
......@@ -139,6 +156,8 @@ rule prokka:
"--cpus {threads} "
"--compliant "
"{input} "
"&& "
"conda deactivate "
rule interproscan:
input:
......@@ -148,6 +167,8 @@ rule interproscan:
threads:
8
shell:
# "conda activate interproscan "
"&& "
"interproscan.sh "
"--cpu {threads} "
"--formats {wildcards.format} "
......@@ -158,3 +179,5 @@ rule interproscan:
"--outfile {output} "
"--pathways "
"--seqtype p "
# "&& "
# "conda deactivate "
......@@ -17,6 +17,8 @@ rule khmer:
K = 32,
C = 100
shell:
"conda activate khmer-3.0.0a3 "
"&& "
"normalize-by-median.py "
"--ksize {params.K} "
"--max-memory-usage {params.mem_tot} "
......@@ -25,7 +27,9 @@ rule khmer:
"--report {output.log} "
"--output {output.R1R2} "
"--gzip "
"{input.R1R2}"
"{input.R1R2} "
"&& "
"conda deactivate "
def assembly_input(wildcards):
if wildcards.reads == "coassembly":
......@@ -44,7 +48,6 @@ def assembly_input(wildcards):
else:
return {"R1": ["DATA/trim/{wildcards.reads}_R1.fastq.gz".format(wildcards=wildcards)], "R2": ["DATA/trim/{wildcards.reads}_R2.fastq.gz".format(wildcards=wildcards)]}
rule megahit:
input:
unpack(assembly_input)
......@@ -59,6 +62,8 @@ rule megahit:
input = lambda wildcards, input: "-1 %s -2 %s"%(",".join(input.R1), ",".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%",".join(input.R1R2),
output = lambda wildcards, output: os.path.dirname(str(output.contigs))
shell:
"conda activate megahit-1.2.8 "
"&& "
"megahit "
"{params.input} "
"--continue "
......@@ -69,7 +74,9 @@ rule megahit:
"--out-dir {params.output} "
"--out-prefix {wildcards.reads} "
"--min-contig-len {params.min_len} "
"--verbose"
"--verbose "
"&& "
"conda deactivate "
rule metaspades:
input:
......@@ -86,6 +93,8 @@ rule metaspades:
input = lambda wildcards, input: "-1 %s -2 %s"%(" -1 ".join(input.R1), " -2 ".join(input.R2)) if set(['R1', 'R2']).issubset(input.keys()) else "--12 %s"%" --12 ".join(input.R1R2),
output = lambda wildcards, output: os.path.dirname(str(output.contigs))
shell:
"conda activate spades-3.14.0 "
"&& "
"spades.py "
"--threads {threads} "
"--memory {params.mem_tot} "
......@@ -93,18 +102,20 @@ rule metaspades:
"--meta "
"{params.input} "
"-o {params.output} "
" ; "
" touch {output.done} "
" ; "
"conda activate seqkit-0.10.1 "
" ; "
"&& "
"conda deactivate "
"&& "
"touch {output.done} "
"&& "
"conda activate seqkit-0.11.0 "
"&& "
"seqkit "
"seq "
"--min-len {params.min_len} "
"--out-file {output.contigs} "
"{output.all_contigs} "
" ; "
"conda deactivate"
"&& "
"conda deactivate "
def contigs_input(wildcards):
if wildcards.sample == "catalogue":
......@@ -137,12 +148,16 @@ rule quast:
params:
output = lambda wildcards, output: os.path.dirname(str(output))
shell:
"conda activate quast-5.0.2 "
"&& "
"quast "
"--mgm "
"--output-dir {params.output} "
"-L "
"--threads {threads} "
"{input} "
"&& "
"conda deactivate "
rule coassembly_quast:
input:
......@@ -154,9 +169,12 @@ rule coassembly_quast:
params:
output = lambda wildcards, output: os.path.dirname(str(output))
shell:
"conda activate quast-5.0.2 "
"quast "
"--mgm "
"--output-dir {params.output} "
"-L "
"--threads {threads} "
"{input} "
"&& "
"conda deactivate "
......@@ -6,8 +6,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal
threads:
2
shell:
"source activate seqkit-0.10.1 "
" ; "
"conda activate seqkit-0.11.0 "
"&& "
"seqkit "
"grep "
"--use-regexp "
......@@ -16,8 +16,8 @@ rule partial_genes: #fonctionne uniquement avec prodigal
"--threads {threads} "
"--out-file {output} "
"{input} "
" ; "
"conda deactivate"
"&& "
"conda deactivate "
rule pool:
input:
......@@ -27,8 +27,8 @@ rule pool:
shell:
"cat "
"{input} "
" > "
"{output}"
"> "
"{output} "
rule pool_incomplet:
input:
......@@ -38,8 +38,8 @@ rule pool_incomplet:
shell:
"cat "
"{input} "
" > "
"{output}"
"> "
"{output} "
rule cd_hit:
input:
......@@ -50,6 +50,8 @@ rule cd_hit:
threads:
8
shell:
"conda activate cd-hit-4.8.1 "
"&& "
"cd-hit-est "
"-i {input} "
"-o {output.ffn} "
......@@ -59,6 +61,8 @@ rule cd_hit:
"-d 0 "
"-M 0 "
"-T {threads} "
"&& "
"conda deactivate "
rule cd_hit_2D:
input:
......@@ -70,6 +74,8 @@ rule cd_hit_2D:
threads:
8
shell:
"conda activate cd-hit-4.8.1 "
"&& "
"cd-hit-est-2d "
"-i {input.complete} "
"-i2 {input.incomplete} "
......@@ -80,6 +86,8 @@ rule cd_hit_2D:
"-d 0 "
"-M 0 "
"-T {threads} "
"&& "
"conda deactivate "
rule faa_catalogue:
input:
......@@ -92,11 +100,11 @@ rule faa_catalogue:
2
shell:
"grep '>' {input.ffn} > {output.list} "
" ; "
"&& "
"sed --in-place 's/>//' {output.list} "
" ; "
"source activate seqkit-0.10.1 "
" ; "
"&& "
"conda activate seqkit-0.11.0 "
"&& "
"seqkit "
"grep "
"--by-name "
......@@ -104,8 +112,8 @@ rule faa_catalogue:
"--threads {threads} "
"--out-file {output.faa} "
"{input.faa} "
" ; "
"conda deactivate"
"&& "
"conda deactivate "
checkpoint metabat:
input:
......@@ -120,7 +128,7 @@ checkpoint metabat:
8
shell:
"conda activate metabat2-2.12.1 "
" ; "
"&& "
"metabat2 "
"--inFile {input} "
"--outFile {params.output} "
......@@ -129,7 +137,7 @@ checkpoint metabat:
"--numThreads {threads} "
"--unbinned "
"--verbose "
" ; "
"&& "
"conda deactivate "
rule metabat_kaiju:
......@@ -148,7 +156,7 @@ rule metabat_kaiju:
"--word-regexp "
"--file - "
"{input.kaiju} "
" > "
"> "
"{output} "
def aggregate_metabat(wildcards):
......@@ -175,12 +183,12 @@ rule checkm:
output = lambda wildcards, output: os.path.dirname(str(output))
shell:
"conda activate checkm-genome-1.0.18 "
" ; "
"&& "
"checkm "
"lineage_wf "
"-t {threads} "
"-x fa "
"{params.input} "
"{params.output} "
" ; "
"conda deactivate"
"&& "
"conda deactivate "
......@@ -6,10 +6,15 @@ rule index :
params:
index = "work/index/{sample}"
shell:
"conda activate bowtie2-2.4.1 "
"&& "
"bowtie2-build "
"--large-index "
"{input} "
"{params.index}"
"{params.index} "
"&& "
"conda deactivate "
rule mapping:
input:
......@@ -25,26 +30,33 @@ rule mapping:
threads:
8
shell:
"conda activate bowtie2-2.4.1 "
"&& "
"bowtie2 "
"--threads {threads} "
"-x {params.index} "
"-1 {input.R1} "
"-2 {input.R2} "
"-S {output.sam} "
" ; "
"&& "
"conda deactivate "
"&& "
"conda activate samtools-1.9 "
"&& "
"samtools view "
"--threads {threads} "
"-b "
"-o {output.bam} "
"{output.sam} "
" ; "
"&& "
"samtools sort "
"--threads {threads} "
"{output.bam} "
"-o {output.bam} "
" ; "
"&& "
"samtools index "
"{output.bam}"
"{output.bam} "
"conda deactivate "
rule count_contig:
input:
......@@ -53,10 +65,14 @@ rule count_contig:
output:
"report/count-contigs-{sample}-{reads}.tsv"
shell:
"conda activate samtools-1.9 "
"&& "
"samtools idxstats "
"{input.bam} "
" > "
"> "
"{output}"
"&& "
"conda deactivate "
rule count_gene:
input:
......@@ -66,6 +82,8 @@ rule count_gene:
output:
"report/count-genes-{sample}-{reads}.tsv"
shell:
"conda activate htseq-0.12.4 "
"&& "
"htseq-count "
"--format bam "
"--stranded no "
......@@ -78,5 +96,7 @@ rule count_gene:
#"--samout {output} "
"{input.bam} "
"{input.gff} "
" > "
"> "
"{output} "
"&& "
"conda deactivate "
......@@ -16,12 +16,16 @@ rule kaiju:
params:
input = lambda wildcards, input: "-i %s -j %s"%(input.R1, input.R2) if wildcards.focus == "reads" else "-i %s"%input
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-f /db/outils/kaiju/nr/kaiju_db_nr_euk.fmi "
"{params.input} "
"-o {output} "
"-z {threads}"
"-z {threads} "
"&& "
"conda deactivate "
rule krona:
input:
......@@ -29,12 +33,16 @@ rule krona:
output:
temp("work/kaiju/{sample}.krona")
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju2krona "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-n /db/outils/kaiju/nr/names.dmp "
"-i {input} "
"-o {output} "
"-u"
"-u "
"&& "
"conda deactivate "
rule kronaHTML:
input:
......@@ -42,9 +50,13 @@ rule kronaHTML:
output:
"report/{sample}-krona.html"
shell:
"conda activate kaiju-1.7.3 "
"&& "
"ktImportText "
"-o {output} "
"{input}"
"{input} "
"&& "
"conda deactivate "
rule kronaNames:
input:
......@@ -52,9 +64,13 @@ rule kronaNames:
output:
"report/{sample}-taxNames.tsv"
shell:
"conda activate kaiju-1.7.3 "
"&& "
"kaiju-addTaxonNames "
"-t /db/outils/kaiju/nr/nodes.dmp "
"-n /db/outils/kaiju/nr/names.dmp "
"-i {input} "
"-o {output} "
"-r superkingdom,phylum,order,class,family,genus,species"
"-r superkingdom,phylum,order,class,family,genus,species "
"&& "
"conda deactivate "
......@@ -10,6 +10,8 @@ rule fastp:
threads:
4
shell:
"conda activate fastp-0.20.0 "
"&& "
"fastp "
"--in1 {input.R1} "
"--in2 {input.R2} "
......@@ -21,6 +23,8 @@ rule fastp:
"--json {output.json} "
"--report_title \"fastp {wildcards.reads} report\" "
"--thread {threads} "
"&& "
"conda deactivate "
rule interleave:
input:
......@@ -29,11 +33,15 @@ rule interleave:
output:
R1R2 = "DATA/trim/{reads}_R1R2.fastq.gz"
shell:
"conda activate khmer-3.0.0a3 "
"&& "
"interleave-reads.py "
"--output {output.R1R2} "
"--gzip "
"{input.R1} "
"{input.R2} "
"&& "
"conda deactivate "
rule sortmerna:
input:
......@@ -53,7 +61,9 @@ rule sortmerna:
"-p {threads} "
"--keep "
"{input.R1R2} "
" ; "
"&& "
"conda activate sortmerna-4.2.0 "
"&& "
"sortmerna "
"--ref /usr/local/genome/src/sortmerna-2.0/rRNA_databases/rfam-5s-database-id98.fasta,/projet/mig/work/orue/SORTMERNA_index/index/rfam-5s:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/rfam-5.8s-database-id98.fasta,/projet/mig/work/orue/SORTMERNA_index/index/rfam-5.8s:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-arc-16s-id95.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-arc-16s-id95:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-arc-23s-id98.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-arc-23s-id98:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-bac-16s-id90.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-bac-16s-id90:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-bac-23s-id98.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-bac-23s-id98:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-euk-18s-id95.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-euk-18s-id95:/usr/local/genome/src/sortmerna-2.0/rRNA_databases/silva-euk-28s-id98.fasta,/projet/mig/work/orue/SORTMERNA_index/index/silva-euk-28s-id98 "
"--reads {output.R1R2} "
......@@ -64,7 +74,9 @@ rule sortmerna:
"--paired_in " #both paired-end reads go in --aligned
"-a {threads} "
"-v "
" ; "
"&& "
"conda deactivate "
"&& "
"pigz "
"-p {threads} "
"{params.R1R2_rRNA}.fastq "
......
......@@ -7,10 +7,14 @@ rule fastqc:
params:
output = "work/fastqc/"
shell:
"conda activate fastqc-0.11.8 "
"&& "
"fastqc "
"{input} "
"--noextract "
"--outdir {params.output} "
"&& "
"conda deactivate "
rule multiqc:
input:
......@@ -21,8 +25,12 @@ rule multiqc:
params:
output = "report/"
shell:
"conda activate multiqc-1.8 "
"&& "
"multiqc "
"--force "
"--no-data-dir "
"--outdir {params.output} "
"{input} "
"&& "
"conda deactivate "