diff --git a/Snakefile b/Snakefile index daa0e348ea8417b0773aab4b909c315446ed3695..99543ca9a3dcaa45e0ecbec30d1caf68617c7057 100755 --- a/Snakefile +++ b/Snakefile @@ -222,10 +222,16 @@ if config["star_mapping"]["do"]: star_mapping_pass1_input = adapters_output star_mapping_pass1_done = star_index_output_done star_mapping_pass1_index = star_index_output_dir - star_mapping_pass1_logs = "02-Mapping/{REF}/STAR/logs/{SAMPLE}_{REF}_init.out" - 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_bam = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_Aligned.sortedByCoord.out.bam" + if config["star_mapping"]["pass2"] == "none": + star_mapping_pass1_logs = "02-Mapping/{REF}/STAR/logs/{SAMPLE}_{REF}.out" + star_mapping_pass1_output_prefix = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_" + star_mapping_pass1_junctions = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_SJ.out.tab" + star_mapping_pass1_bam = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_Aligned.sortedByCoord.out.bam" + else : + star_mapping_pass1_logs = "02-Mapping/{REF}/STAR/logs/{SAMPLE}_{REF}_init.out" + 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_bam = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_Aligned.sortedByCoord.out.bam" star_mapping_pass1_read_groups = "" final_output.extend(expand(star_mapping_pass1_junctions, SAMPLE=samples, REF=ref)) include: os.path.join(RULES, "star_mapping_pass1.rules") @@ -236,7 +242,12 @@ if config["star_mapping"]["do"]: star_mapping_pass2_index = star_index_output_dir star_mapping_pass2_logs = "02-Mapping/{REF}/STAR/logs/{SAMPLE}_{REF}.out" star_mapping_pass2_output_prefix = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_" - star_mapping_pass2_junctions = expand("02-Mapping/{{REF}}/STAR/{SAMPLE}_{{REF}}_init_SJ.out.tab", SAMPLE=samples) + if config["star_mapping"]["pass2"] == "by-sample": + star_mapping_pass2_junctions = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_init_SJ.out.tab" + elif config["star_mapping"]["pass2"] == "all-samples": + star_mapping_pass2_junctions = expand("02-Mapping/{{REF}}/STAR/{SAMPLE}_{{REF}}_init_SJ.out.tab", SAMPLE=samples) + else: + raise ValueError("Please provides a valid option to pass3 of STAR: must be by-sample, all-samples or none") star_mapping_pass2_bam = star_mapping_pass1_bam star_mapping_pass2_read_groups = "ID:{SAMPLE}" star_mapping_pass2_sort = "02-Mapping/{REF}/STAR/{SAMPLE}_{REF}_Aligned.sortedByCoord.out.bam" diff --git a/config/config.yaml b/config/config.yaml index a3db8b99d7cd18895fbde9b419900ea44062283b..06d7a3339d29c9546f90106bc06a7ecd2c9c7476 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -135,16 +135,18 @@ bowtie2_mapping: # # :Parameters: # -# - do: if unchecked, this rule is ignored -# - options: any options recognised by bowtie2 tool +# - options: any options recognised by bowtie2 tool. For small genome, STAR may +# abort with segmentation fault. Setting sjdb Over hang to 250 skips this issue +# - pass2: Splice junctions used during pass2 of STAR. Could be "by-sample", "all-samples", +# "none". If "none", no second pass will be done. # - threads: number of threads to be used #=============================================================================== star_mapping: do: yes - # for small genome, STAR may abort with segmentation fault. Setting sjdb Over hang to 250 skips this issue - options: "--outSAMunmapped None " + options: "--outFilterMismatchNoverLmax 0.05 --outSAMunmapped Within " + pass2: "all-samples" threads: 4