@@ -12,45 +12,58 @@ SAMPLES = expand(config["samples"])
1212outdir = os .path .join (config ["processing_dir" ],str (config ["experiment" ]))
1313fragmentsize = config ["fragment_size" ]
1414
15+ # needs to be improved somehow. Maybe even by removing the global import and replacing every single fucntion with a local import line
16+ #local functions - path to helper fucntions needs to be added to the sys path, otherwise import won't find the file
17+ rootpath = os .path .join ("workflow/scripts" )
18+ sys .path .append (rootpath )
19+ cwd = os .getcwd ()
20+
1521import VIS_helper_functions as vhf #custom functions to make snakemake pipeline leaner
1622
17- #inmport rules
23+ #inmport default rules
1824include : config ["detection" ]
19- include : config ["functional_genomics" ]
2025include : config ["quality_control" ]
2126
27+ #conditional rule all based on defined rules
28+ conditional_output = list ()
2229
23- #analysis-specific rules
24- #include: config["downstream"]
30+ if "functional_genomics" in config :
31+ import VIS_functional_genomics_helper_functions as vhf_fg
32+ include : config ["functional_genomics" ]
33+ conditional_output .append (expand (f"{ outdir } /final/functional_genomics/Functional_distances_to_Insertions_{{sample}}.bed" , sample = SAMPLES ))
34+ conditional_output .append (expand (f"{ outdir } /final/functional_genomics/Functional_distances_to_Insertions_{{sample}}.bed" , sample = SAMPLES ))
35+ conditional_output .append (expand (f"{ outdir } /intermediate/localization/annotation/Annotation_{{annotation}}_Insertions_{{sample}}.bed" ,
36+ annotation = [k .replace ("annotate_" , "" ) for k in config if k .startswith ("annotate_" )],
37+ sample = SAMPLES ))
2538
26- #development
27- #include: config["epigenetics"]
28- #include: config["variants"]
29- #include: config["development"]
39+ if "plot_functional_genomics" in config :
40+ import VIS_plot_functional_genomics_helper_functions as vhf_pfg
41+ include : config ["plot_functional_genomics" ]
42+ conditional_output .append (expand (f"{ outdir } /final/functional_genomics/Plot_Distance_to_Genes_{ fragmentsize } _{{sample}}.png" , sample = SAMPLES ))
43+ conditional_output .append (expand (f"{ outdir } /final/functional_genomics/Insertion_Scoring_{{sample}}.svg" , sample = SAMPLES ))
3044
45+ if "base_modifications" in config :
46+ include : config ["base_modifications" ]
47+ conditional_output .append (expand (f"{ outdir } /final/base_modifications/Isolated_Reads_{{sample}}.tsv" , sample = SAMPLES ))
48+ conditional_output .append (expand (f"{ outdir } /final/base_modifications/Calls_Isolated_Reads_{{sample}}.tsv" , sample = SAMPLES ))
3149
32- #target rule
3350rule all :
34- input :
51+ input :
3552 #detection
3653 expand (f"{ outdir } /final/localization/ExactInsertions_{{sample}}.bed" , sample = SAMPLES ),
3754 f"{ outdir } /final/localization/Heatmap_Insertion_Chr.png" ,
3855 f"{ outdir } /final/localization/Insertion_length.png" ,
39-
40- #functional genomics
41- expand (f"{ outdir } /final/functional_genomics/Functional_distances_to_Insertions_{{sample}}.bed" , sample = SAMPLES ),
42- expand (f"{ outdir } /final/functional_genomics/Plot_Distance_to_Genes_{ fragmentsize } _{{sample}}.png" , sample = SAMPLES ),
43- expand (f"{ outdir } /intermediate/localization/annotation/Annotation_gene_Insertions_{{sample}}.bed" , sample = SAMPLES ),
44- expand (f"{ outdir } /final/functional_genomics/Insertion_Scoring_{{sample}}.svg" , sample = SAMPLES ),
4556 #quality control
4657 expand (f"{ outdir } /final/qc/mapq/{{sample}}_mapq_heatmap_image.png" , sample = SAMPLES ),
4758 expand (f"{ outdir } /final/qc/Fragmentation/Insertions/insertions_{ fragmentsize } _{{sample}}" , sample = SAMPLES ),
4859 expand (f"{ outdir } /final/qc/Fragmentation/Longest_Interval/{{sample}}/" , sample = SAMPLES ),
4960 f"{ outdir } /final/qc/multiqc_report.html" ,
5061 # process
5162 f"{ outdir } /config_settings.yml" ,
52-
53- # downstream
63+ # other output
64+ conditional_output
65+ # downstream
5466 #expand(f"{outdir}/intermediate/blastn/Filtered_Annotated_{fragmentsize}_InsertionMatches_{{sample}}.gff", sample=SAMPLES),
5567 #expand(f"{outdir}/final/functional_genomics/localization/{fragmentsize}_{{sample}}", sample=SAMPLES),
56-
68+ # for msa
69+ #expand(f"{outdir}/intermediate/fasta/Inserted_sequence_{{sample}}.fa", sample=SAMPLES)
0 commit comments