From 6fcd8adc16dd0badad9a1c0ba66581f9fc9602bb Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Wed, 3 Oct 2018 12:56:54 +0200
Subject: [PATCH] DESeq2 and bigwig files for unique mappers.

---
 RNA_Seq_Cecere/RNA-seq.snakefile | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/RNA_Seq_Cecere/RNA-seq.snakefile b/RNA_Seq_Cecere/RNA-seq.snakefile
index 4830d61..9001c89 100644
--- a/RNA_Seq_Cecere/RNA-seq.snakefile
+++ b/RNA_Seq_Cecere/RNA-seq.snakefile
@@ -371,7 +371,9 @@ if contrasts_dict["ip"]:
         expand(
             OPJ(output_dir, aligner, f"mapped_{genome}", "{counter}", "fold_boxplots_{mapped_type}",
                 "{contrast_type}_{orientation}_{biotype}_{fold_type}_{id_list}_boxplots.pdf"),
-            counter=COUNTERS, mapped_type=[f"on_{genome}"], contrast_type=["ip"],
+            #counter=COUNTERS, mapped_type=[f"on_{genome}", f"unique_on_{genome}"],
+            counter=COUNTERS, mapped_type=[f"on_{genome}"],
+            contrast_type=["ip"],
             orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
             fold_type=["mean_log2_RPM_fold"], id_list=ID_LISTS),]
 else:
@@ -382,7 +384,8 @@ if contrasts_dict["de"]:
         expand(
             OPJ(output_dir, aligner, f"mapped_{genome}", "{counter}", "fold_boxplots_{mapped_type}",
                 "{contrast_type}_{orientation}_{biotype}_{fold_type}_{id_list}_boxplots.pdf"),
-            counter=COUNTERS, mapped_type=[f"on_{genome}"], contrast_type=["de"],
+            counter=COUNTERS, mapped_type=[f"on_{genome}", f"unique_on_{genome}"],
+            contrast_type=["de"],
             orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
             fold_type=["log2FoldChange"], id_list=ID_LISTS),]
 else:
@@ -392,16 +395,19 @@ de_files = [
     expand(
         OPJ(output_dir, aligner, f"mapped_{genome}", "{counter}",
             "deseq2_{mapped_type}", "{contrast}", "{orientation}_{biotype}", "{contrast}_counts_and_res.txt"),
-        counter=COUNTERS, mapped_type=[f"on_{genome}"], contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES),
+        counter=COUNTERS, mapped_type=[f"on_{genome}", f"unique_on_{genome}"],
+        contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES),
     expand(
         OPJ(output_dir, aligner, f"mapped_{genome}", "{counter}",
             "deseq2_{mapped_type}", "{contrast}", "{orientation}_{biotype}", "{contrast}_{fold_type}_distribution.pdf"),
-        counter=COUNTERS, mapped_type=[f"on_{genome}"], contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
+        counter=COUNTERS, mapped_type=[f"on_{genome}", f"unique_on_{genome}"],
+        contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
         fold_type=["log2FoldChange"]),
     expand(
         OPJ(output_dir, aligner, f"mapped_{genome}", "{counter}",
             "deseq2_{mapped_type}", "{contrast}", "{orientation}_{biotype}", "{contrast}_MA_with_{id_list}.pdf"),
-        counter=COUNTERS, mapped_type=[f"on_{genome}"], contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
+        counter=COUNTERS, mapped_type=[f"on_{genome}", f"unique_on_{genome}"],
+        contrast=DE_CONTRASTS, orientation=ORIENTATIONS, biotype=DE_BIOTYPES,
         id_list=ID_LISTS + ["lfc_statuses"]),
     de_fold_boxplots]
 
@@ -420,11 +426,13 @@ bigwig_files = [
         OPJ(output_dir, aligner, f"mapped_{genome}", "{lib}_{rep}",
             "{lib}_{rep}_{orientation}_{mapped_type}_by_{norm_type}.bw"),
         lib=LIBS, rep=REPS, orientation=ORIENTATIONS,
+        #mapped_type=[f"on_{genome}", f"unique_on_{genome}"], norm_type=NORM_TYPES),
         mapped_type=[f"on_{genome}"], norm_type=NORM_TYPES),
     expand(
         OPJ(output_dir, aligner, f"mapped_{genome}", "{lib}_mean",
             "{lib}_mean_{orientation}_{mapped_type}_by_{norm_type}.bw"),
         lib=LIBS, orientation=ORIENTATIONS,
+        #mapped_type=[f"on_{genome}", f"unique_on_{genome}"], norm_type=NORM_TYPES),]
         mapped_type=[f"on_{genome}"], norm_type=NORM_TYPES),]
 
 if spikein_microliter_equivalent:
@@ -610,6 +618,8 @@ def source_sam(wildcards):
         ##
     elif mapped_type == f"polyU_on_{genome}":
         return rules.remap_on_genome.output.sam
+    elif mapped_type == f"unique_on_{genome}":
+        raise NotImplementedError(f"{mapped_type} only handled from count level on.")
     else:
         raise NotImplementedError(f"{mapped_type} not handled (yet?)")
 
-- 
GitLab