Commit d38d2b1e authored by Philippe BORDRON's avatar Philippe BORDRON
Browse files

Add rules for split report

parent 808993ce
......@@ -12,10 +12,10 @@ rule buildReport:
input:
unpack(getAllFilesForReport)
output:
report = MAINDIR+"/{project}/report.html",
report = MAINDIR+"/{project}/report-{multipart}.html",
shell:
"""
python {wfbasedir}/SCRIPTS/make_html.py -c {config[conf]} -t {input.index} -p {wildcards.project} -o {output.report}
python {wfbasedir}/SCRIPTS/make_html.py -c {config[conf]} -t {input.index} -p {wildcards.project} -o {output.report} -m {wildcards.multipart}
"""
rule copyTemplateFolder:
......
......@@ -50,6 +50,7 @@ argParser.add_argument("-c", "--configfile", required=True, help="Jsonfile's pat
argParser.add_argument("-t", "--templateFile", required=True, help="HTML Template's path", dest="templateFile")
argParser.add_argument("-p", "--projectName", required=True, help="Name of the project used to select samples in config file", dest="projectName")
argParser.add_argument("-o", "--output", required=True, help="Path of the output file", dest="output")
argParser.add_argument("-m", "--multipart", required=True, default="main", help="Part of the multipart report", dest="multipart")
def getGenomeForProject(project):
for s in config["samples"]:
......@@ -186,7 +187,7 @@ corrFile = os.path.join(sys.path[0],"DE","corresIDorg.txt")
# Selection of versus conditions
conditionVS = list()
if(project in config["comparisons"]):
conditionVS.extend(config["comparisons"][project]["comps"])
conditionVS.extend([c for c in config["comparisons"][project]["comps"] if c.get("multipart", "main") == args.multipart])
templateVars["conditionVS"] = conditionVS
templateVars["deseqres"] = dict()
......
......@@ -15,6 +15,7 @@ SECONDARY_ANALYSIS_PROJECTS = {c for c in config["comparisons"] if config["compa
NO_COMPARISONS_PROJECTS = {c for c in config["comparisons"] if not config["comparisons"][c]["performComps"]}
DATE = str(datetime.date.today())
TIME = str(datetime.datetime.now().strftime("%H:%M:%S"))
DEFAULT_REPORT_PART="main"
# final file outputs suffixes for primary analysis
finalSuffixes = ["log.dat","refseq.total.dat","refseq.umi.dat","spike.total.dat","spike.umi.dat","unknown_list","well_summary.dat"]
......@@ -77,11 +78,12 @@ def getAllFilesForReport(wildcards):
files["deseqTables"] = list()
files["annotation"] = list()
for comp in config["comparisons"][wildcards.project]["comps"]:
files["deseqTables"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"DEseqResFiltered.tsv"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseGo.txt"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseKegg.txt"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringFunctionalEnrichment.tsv"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringDB-genes.txt"))
if comp.get("multipart", DEFAULT_REPORT_PART) == wildcards.multipart:
files["deseqTables"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"DEseqResFiltered.tsv"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseGo.txt"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseKegg.txt"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringFunctionalEnrichment.tsv"))
files["annotation"].append(os.path.join(MAINDIR,wildcards.project,config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringDB-genes.txt"))
files["index"] = os.path.join(wfbasedir,"TEMPLATE","index_SA.html")
return files
......@@ -97,7 +99,17 @@ def getTargetFiles():
for s in config["samples"]:
if(s["project"]==p):
targets.append(os.path.join(MAINDIR,p,config["align_folder"],s["name"]+".bai"))
targets.append(os.path.join(MAINDIR,p,"report.html"))
multiparts = set()
for c in config["comparisons"]:
if (p in config["comparisons"]) and config["comparisons"][p]["performComps"]:
for comps in config["comparisons"][p]["comps"]:
multiparts.add(comps.get("multipart", DEFAULT_REPORT_PART))
if multiparts:
targets.extend([os.path.join(MAINDIR,p,"report-{}.html".format(mp)) for mp in multiparts])
else:
targets.append(os.path.join(MAINDIR,p,"report-{}.html".format(DEFAULT_REPORT_PART)))
targets.append(os.path.join(MAINDIR,p,"INPUT_FILES","samplesheet_used.tsv"))
# Targets for projects with secondary analysis
......
......@@ -10,6 +10,7 @@ wfbasedir = workflow.basedir
MAINDIR = config["maindir"]
DATE = str(datetime.date.today())
TIME = str(datetime.datetime.now().strftime("%H:%M:%S"))
DEFAULT_REPORT_PART="main"
# final file outputs suffixes for primary analysis
finalSuffixes = ["log.dat","refseq.total.dat","refseq.umi.dat","spike.total.dat","spike.umi.dat","well_summary.dat"]
......@@ -53,10 +54,11 @@ def getAllFilesForReport(wildcards):
files["deseqTables"] = list()
files["annotation"] = list()
for comp in config["comparisons"][config["analysis_name"]]["comps"]:
files["deseqTables"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"DEseqResFiltered.tsv"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseGo.txt"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseKegg.txt"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringFunctionalEnrichment.tsv"))
if comp.get("multipart", DEFAULT_REPORT_PART) == wildcards.multipart:
files["deseqTables"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"DEseqResFiltered.tsv"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseGo.txt"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"gseKegg.txt"))
files["annotation"].append(os.path.join(MAINDIR,config["analysis_name"],config["de_folder"],comp["condition1"]+"__vs__"+comp["condition2"],"stringFunctionalEnrichment.tsv"))
files["index"] = os.path.join(wfbasedir,"TEMPLATE","index_SA.html")
return files
......@@ -69,9 +71,16 @@ def getTargetFiles():
targets.append(MAINDIR+"/"+config["analysis_name"]+"/"+config["multiqc_folder"]+"/multiqc_report.html")
targets.extend(expand(os.path.join(MAINDIR,config["analysis_name"],config["expression_folder"],config["analysis_name"]+".{exp}.well_summary.pdf"),exp=["unq","all"]))
targets.append(MAINDIR+"/config_used_in_analysis.json")
multiparts = set()
if(config["analysis_name"] in config["comparisons"]):
targets.append(MAINDIR+"/"+config["analysis_name"]+"/"+config["de_folder"]+"/exprDatUPM.tsv")
targets.append(MAINDIR+"/"+config["analysis_name"]+"/report.html")
for comps in config["comparisons"][config["analysis_name"]]["comps"]:
multiparts.add(comps.get("multipart", DEFAULT_REPORT_PART))
if multiparts:
targets.extend([os.path.join(MAINDIR,config["analysis_name"],"report-{}.html".format(mp)) for mp in multiparts])
else:
targets.append(os.path.join(MAINDIR,config["analysis_name"],"report-{}.html".format(DEFAULT_REPORT_PART)))
return targets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment