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

gestion of gz

parent d44ab73e
Branches
Tags
No related merge requests found
...@@ -212,8 +212,8 @@ if config["star_mapping"]["do"]: ...@@ -212,8 +212,8 @@ if config["star_mapping"]["do"]:
star_index_fasta = unpack(mapping_index) star_index_fasta = unpack(mapping_index)
star_mapping_splice_file = unpack(annot_index) star_mapping_splice_file = unpack(annot_index)
star_index_log = "02-Mapping/STAR/logs/STAR_{REF}_indexing.log" star_index_log = "02-Mapping/STAR/logs/STAR_{REF}_indexing.log"
star_index_output_done = config["genome"]["genome_directory"]+"{REF}/STAR/SAindex" star_index_output_done = config["genome"]["genome_directory"]+"/{REF}/STAR/SAindex"
star_index_output_dir = config["genome"]["genome_directory"]+"{REF}/STAR/" star_index_output_dir = config["genome"]["genome_directory"]+"/{REF}/STAR/"
include: os.path.join(RULES, "star_index.rules") include: os.path.join(RULES, "star_index.rules")
...@@ -223,7 +223,7 @@ if config["star_mapping"]["do"]: ...@@ -223,7 +223,7 @@ if config["star_mapping"]["do"]:
star_mapping_pass1_done = star_index_output_done star_mapping_pass1_done = star_index_output_done
star_mapping_pass1_index = star_index_output_dir star_mapping_pass1_index = star_index_output_dir
star_mapping_pass1_logs = "02-Mapping/STAR/logs/{SAMPLE}_{REF}_init.out" star_mapping_pass1_logs = "02-Mapping/STAR/logs/{SAMPLE}_{REF}_init.out"
star_mapping_pass1_output_prefix = "02-Mapping/STAR/{REF}/{SAMPLE}_{REF}_init_" star_mapping_pass1_output_prefix = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_"
star_mapping_pass1_junctions = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_SJ.out.tab" star_mapping_pass1_junctions = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_SJ.out.tab"
star_mapping_pass1_bam = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_Aligned.sortedByCoord.out.bam" star_mapping_pass1_bam = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_Aligned.sortedByCoord.out.bam"
star_mapping_pass1_read_groups = "" star_mapping_pass1_read_groups = ""
...@@ -291,8 +291,8 @@ if config["feature_counts"]["do"]: ...@@ -291,8 +291,8 @@ if config["feature_counts"]["do"]:
#---------------------------------- #----------------------------------
flagstat_input = counting_index flagstat_input = counting_index
flagstat_logs = "02-Mapping/Flagstats/{REF}/{MAP}/logs/{SAMPLE}_{REF}.out" flagstat_logs = "02-Mapping/{REF}/{MAP}/logs/{SAMPLE}_{REF}.out"
flagstat_output = "02-Mapping/Flagstats/{REF}/{MAP}/{SAMPLE}_{REF}_stats.out" flagstat_output = "02-Mapping/{REF}/{MAP}/{SAMPLE}_{REF}_stats.out"
final_output.extend(expand(flagstat_output, SAMPLE=samples, REF=ref, MAP=mapper)) final_output.extend(expand(flagstat_output, SAMPLE=samples, REF=ref, MAP=mapper))
include: os.path.join(RULES, "flagstat.rules") include: os.path.join(RULES, "flagstat.rules")
......
...@@ -44,8 +44,8 @@ rule sortmerna: ...@@ -44,8 +44,8 @@ rule sortmerna:
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}} index=${{fasta%.fa}}
if [[ ! -s ${{index}}.stats ]] if [[ ! -s ${{index}}.stats ]]
then then
...@@ -53,7 +53,7 @@ rule sortmerna: ...@@ -53,7 +53,7 @@ rule sortmerna:
fi fi
sortmerna --ref $${{fasta}},${{index}} -a {threads} --reads {input.fastq} --aligned outfile_rRNA --fastx --sam --num_alignments 1 --other outfile_noRNA --log -v > {log.out} 2> {log.err} sortmerna --ref ${{fasta}},${{index}} -a {threads} --reads {input.fastq} --aligned outfile_rRNA --fastx --sam --num_alignments 1 --other outfile_noRNA --log -v > {log.out} 2> {log.err}
pigz -fc outfile_rRNA > {output.rRNA} pigz -fc outfile_rRNA > {output.rRNA}
......
...@@ -45,6 +45,8 @@ rule star_mapping_pass1: ...@@ -45,6 +45,8 @@ rule star_mapping_pass1:
star_mapping_pass1_logs star_mapping_pass1_logs
shell: shell:
""" """
if [[ {input.fastq} == "*.gz" ]]
then
STAR --genomeDir {params.index} \ STAR --genomeDir {params.index} \
--readFilesIn {input.fastq} \ --readFilesIn {input.fastq} \
--runThreadN {threads} \ --runThreadN {threads} \
...@@ -54,6 +56,16 @@ rule star_mapping_pass1: ...@@ -54,6 +56,16 @@ rule star_mapping_pass1:
--seedSearchStartLmax 20 \ --seedSearchStartLmax 20 \
--outFileNamePrefix {params.prefix} \ --outFileNamePrefix {params.prefix} \
{params.kwargs} 2> {log} {params.kwargs} 2> {log}
else
STAR --genomeDir {params.index} \
--readFilesIn {input.fastq} \
--runThreadN {threads} \
--genomeLoad NoSharedMemory \
--outSAMtype BAM SortedByCoordinate \
--seedSearchStartLmax 20 \
--outFileNamePrefix {params.prefix} \
{params.kwargs} 2> {log}
fi
samtools index {params.prefix}Aligned.sortedByCoord.out.bam 2>> {log} samtools index {params.prefix}Aligned.sortedByCoord.out.bam 2>> {log}
......
...@@ -46,6 +46,8 @@ rule star_mapping_pass2: ...@@ -46,6 +46,8 @@ rule star_mapping_pass2:
star_mapping_pass2_logs star_mapping_pass2_logs
shell: shell:
""" """
if [[ {input.fastq} == "*.gz" ]]
then
STAR --genomeDir {params.index} \ STAR --genomeDir {params.index} \
--readFilesIn {input.fastq} \ --readFilesIn {input.fastq} \
--runThreadN {threads} \ --runThreadN {threads} \
...@@ -57,6 +59,18 @@ rule star_mapping_pass2: ...@@ -57,6 +59,18 @@ rule star_mapping_pass2:
--outSAMattrRGline {params.RG} \ --outSAMattrRGline {params.RG} \
--sjdbFileChrStartEnd {input.sjdb} \ --sjdbFileChrStartEnd {input.sjdb} \
{params.kwargs} 2> {log} {params.kwargs} 2> {log}
else
STAR --genomeDir {params.index} \
--readFilesIn {input.fastq} \
--runThreadN {threads} \
--genomeLoad NoSharedMemory \
--outSAMtype BAM SortedByCoordinate \
--seedSearchStartLmax 20 \
--outFileNamePrefix {params.prefix} \
--outSAMattrRGline {params.RG} \
--sjdbFileChrStartEnd {input.sjdb} \
{params.kwargs} 2> {log}
fi
samtools index {params.prefix}Aligned.sortedByCoord.out.bam 2>> {log} samtools index {params.prefix}Aligned.sortedByCoord.out.bam 2>> {log}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment