From 76803af5eccce1c9579a94390139cac07d797902 Mon Sep 17 00:00:00 2001
From: Floreal Cabanettes <floreal.cabanettes@inra.fr>
Date: Fri, 1 Jun 2018 17:35:05 +0200
Subject: [PATCH] Start working on popsim snakefile

---
 snakecnv/popsim.snk | 84 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/snakecnv/popsim.snk b/snakecnv/popsim.snk
index e69de29..1784fb2 100644
--- a/snakecnv/popsim.snk
+++ b/snakecnv/popsim.snk
@@ -0,0 +1,84 @@
+import sys
+import os
+
+ROOTPATH = os.path.dirname(os.path.dirname(workflow.snakefile))
+sys.path.insert(0, os.path.join(ROOTPATH, "lib"))
+os.environ["PYTHONPATH"] = os.path.join(ROOTPATH, "lib")
+os.environ["PATH"] = ":".join([os.path.join(ROOTPATH, "bin"), os.environ["PATH"]])
+
+WDIR = config['wdir']
+workdir: WDIR
+
+NB_INDS = config["nb_inds"]
+REFERENCE = config["reference"]
+REFBUNDLE = config["refbundle"] if "refbundle" in config else None
+NSTRETCHES = config["nstretches"] if "nstretches" in config else None
+SV_LIST = config["sv_list"] if "sv_list" in config else None
+COVERAGE = config["coverage"]
+FORCE_POLYMORPHISME = config["force_polymorphism"]
+HAPLOID = config["haploid"]
+PROBA_DEL = config["proba_del"]
+PROBA_INV = config["proba_inv"]
+READ_LEN = config["read_len"]
+INSERT_LEN_MEAN = config["insert_len_mean"]
+INSERT_LEN_SD = config["insert_len_sd"]
+MIN_DELETIONS = config["min_deletions"]
+MIN_INVERSIONS = config["min_inversions"]
+MAX_TRY = config["max_try"]
+GENOTYPES = config["genotypes"] if "genotypes" in config else None
+
+
+# Functions here
+
+def buildpop_inputs():
+    inputs = {
+        "reference": REFERENCE
+    }
+    params = {
+        "nstretches": False,
+        "genotypes": False,
+        "sv_list": False
+    }
+    if NSTRETCHES is not None:
+        inputs["nstretches"] = NSTRETCHES
+        params["nstretches"] = True
+    if GENOTYPES is not None:
+        inputs["genotypes"] = GENOTYPES
+        params["genotypes"] = True
+    if SV_LIST is not None:
+        inputs["sv_list"] = SV_LIST
+        params["sv_list"] = True
+
+    return inputs, params
+
+def buildpop_outputs():
+    outputs = []
+    for n in range(1, NB_INDS+1):
+        outputs += ["INDIV_%d_1.fg.gz" % n, "INDIV_%d_2.fq.gz" % n]
+    return outputs
+
+bp_inputs, bp_params = buildpop_inputs()
+bp_outputs = buildpop_outputs()
+
+bp_out_inds = [("INDIV_%d_1.fg.gz" % n, "INDIV_%d_2.fq.gz" % n) for n in range(0,5)]
+
+
+include: "threads.snk"
+
+localrules: all
+
+rule all:
+    input:
+        # Set final outputs here
+
+rule buildpop:
+    input:
+        bp_inputs
+    output:
+        bp_outputs
+    params:
+        bp_params,
+        nb_inds = NB_INDS
+        out_dir="pop"
+    shell:
+        "build_pop.py -"
\ No newline at end of file
-- 
GitLab