Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
report_html_tempfile = os.path.join(SCRIPT_PATH, "html", "scATAC_template.html")
report_html_temp = open(report_html_tempfile, "r").read()
# readdistrplot_link = '''"Plot/%s_scATAC_read_distr.png"'''%outpre
# fragplot_link = '''"Plot/%s_scATAC_fragment_size.png"'''%outpre
# mapplot_link = '''"Plot/%s_scATAC_mapping_summary.png"'''%outpre
# fripplot_link = '''"Plot/%s_scATAC_cell_filtering.png"'''%outpre
# peakcluster_link = '''"Plot/%s_cluster.png"'''%outpre
# rpannotate_link = '''"Plot/%s_annotated.png"'''%outpre
# bulkqc_file = "Result/QC/%s_bam_stat.txt"%outpre
cluster_regulator_file = "Result/Analysis/%s.PredictedTFTop10.txt"%outpre
fragplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_fragment_size.png"%outpre)[0]
# mapplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_mapping_summary.png"%outpre)[0]
fripplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_cell_filtering.png"%outpre)[0]
peakcluster_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_cluster.png"%outpre)[0]
rpannotate_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
readdistrplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_read_distr.png"%outpre)[0]
# line_id = 0
# total,mapped,duplicate,mito,uniq,promoters = 0,0,0,0,0,0
# for line in open(bulkqc_file).readlines():
# line = line.strip().split(' ')
# line_id += 1
# if line_id == 1:
# total = int(line[0])
# if line_id == 5:
# mapped = int(line[0])
# if line_id == 4:
items_str_list = [" " + i + "" for i in items]
items_str = " \n" + "\n".join(items_str_list) + "\n "
td_list.append(items_str)
td_str = "\n".join(td_list)
#"totalreads":stat_list[0],"dupreads":stat_list[1],"mapreads":stat_list[2],"maptags":stat_list[3],"exontags":stat_list[4],"introntags":stat_list[5],
report_html_instance = report_html_temp % {"outprefix":outpre, "fastqdir":fastqdir, "species":species,"platform":platform, "readdistr":readdistrplot_link,"readqual":readqualplot_link, "nvc":nvcplot_link, "gc":gcplot_link, "genecov":genecovplot_link, "countgene":countgeneplot_link, "genecluster":genecluster_link, "geneannotate":geneannotate_link, "regtable":td_str}
elif platform == "10x-genomics":
report_html_tempfile = os.path.join(SCRIPT_PATH, "html", "scRNA_10x_noqc_template.html")
report_html_temp = open(report_html_tempfile, "r").read()
cluster_regulator_file = "Result/Analysis/%s.PredictedTFTop10.txt"%outpre
readdistrplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_read_distr.png"%outpre)[0]
countgeneplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_cell_filtering.png"%outpre)[0]
genecluster_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_cluster.png"%outpre)[0]
geneannotate_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
td_list = []
for line in open(cluster_regulator_file,"r").readlines():
if not line.startswith("Cluster"):
items = line.strip().split("\t")
items_str_list = [" " + i + "" for i in items]
items_str = " \n" + "\n".join(items_str_list) + "\n "
td_list.append(items_str)
td_str = "\n".join(td_list)
#"totalreads":stat_list[0],"dupreads":stat_list[1],"mapreads":stat_list[2],"maptags":stat_list[3],"exontags":stat_list[4],"introntags":stat_list[5],
report_html_instance = report_html_temp % {"outprefix":outpre, "fastqdir":fastqdir, "species":species,"platform":platform, "readdistr":readdistrplot_link, "countgene":countgeneplot_link, "genecluster":genecluster_link, "geneannotate":geneannotate_link, "regtable":td_str}
SCRIPT_PATH = os.path.dirname(__file__)
outpre = sys.argv[1]
fastqdir = sys.argv[2]
species = sys.argv[3]
platform = sys.argv[4]
rseqc = sys.argv[5]
if rseqc == "True":
report_html_tempfile = os.path.join(SCRIPT_PATH, "html", "scRNA_template.html")
report_html_temp = open(report_html_tempfile, "r").read()
cluster_regulator_file = "Result/Analysis/%s.PredictedTFTop10.txt"%outpre
readdistrplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_read_distr.png"%outpre)[0]
readqualplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_read_quality.png"%outpre)[0]
nvcplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_NVC.png"%outpre)[0]
gcplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_GCcontent.png"%outpre)[0]
genecovplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_genebody_cov.png"%outpre)[0]
countgeneplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scRNA_cell_filtering.png"%outpre)[0]
genecluster_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_cluster.png"%outpre)[0]
geneannotate_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
td_list = []
for line in open(cluster_regulator_file,"r").readlines():
if not line.startswith("Cluster"):
items = line.strip().split("\t")
items_str_list = [" " + i + "" for i in items]
items_str = " \n" + "\n".join(items_str_list) + "\n "
td_list.append(items_str)
td_str = "\n".join(td_list)
# readdistrplot_link = '''"Plot/%s_scATAC_read_distr.png"'''%outpre
# fragplot_link = '''"Plot/%s_scATAC_fragment_size.png"'''%outpre
# mapplot_link = '''"Plot/%s_scATAC_mapping_summary.png"'''%outpre
# fripplot_link = '''"Plot/%s_scATAC_cell_filtering.png"'''%outpre
# peakcluster_link = '''"Plot/%s_cluster.png"'''%outpre
# rpannotate_link = '''"Plot/%s_annotated.png"'''%outpre
# bulkqc_file = "Result/QC/%s_bam_stat.txt"%outpre
cluster_regulator_file = "Result/Analysis/%s.PredictedTFTop10.txt"%outpre
fragplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_fragment_size.png"%outpre)[0]
# mapplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_mapping_summary.png"%outpre)[0]
fripplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_cell_filtering.png"%outpre)[0]
peakcluster_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_cluster.png"%outpre)[0]
rpannotate_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
readdistrplot_link = snakemake.report.data_uri_from_file("Result/QC/%s_scATAC_read_distr.png"%outpre)[0]
# line_id = 0
# total,mapped,duplicate,mito,uniq,promoters = 0,0,0,0,0,0
# for line in open(bulkqc_file).readlines():
# line = line.strip().split(' ')
# line_id += 1
# if line_id == 1:
# total = int(line[0])
# if line_id == 5:
# mapped = int(line[0])
# if line_id == 4:
# duplicate = int(line[0])
# if line_id == 14:
# mito = int(line[0])
# if line_id == 15:
import snakemake.report
SCRIPT_PATH = os.path.dirname(__file__)
outpre = sys.argv[1]
rnaobj = sys.argv[2]
atacobj = sys.argv[3]
report_html_tempfile = os.path.join(SCRIPT_PATH, "html", "Integration_template.html")
report_html_temp = open(report_html_tempfile, "r").read()
# allsourceplot_link = '''"Plot/''' + outpre + '''_source.png"'''
# rnaplot_link = '''"Plot/''' + outpre + '''_RNAonly.png"'''
# atacplot_link = '''"Plot/''' + outpre + '''_ATAConly.png"'''
# annoplot_link = '''"Plot/''' + outpre + '''_annotated.png"'''
allsourceplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_source.png"%outpre)[0]
rnaplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_RNAonly.png"%outpre)[0]
atacplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_ATAConly.png"%outpre)[0]
annoplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
report_html_instance = report_html_temp % {"outprefix":outpre, "scrnaobject":rnaobj, "scatacaobject":atacobj, "allsource":allsourceplot_link, "rnacluster":rnaplot_link, "ataccluster":atacplot_link, "allannotate":annoplot_link}
report_html_instancefile = "Result/" + outpre + "_integrate_report.html"
outf = open(report_html_instancefile,"w")
outf.write(report_html_instance)
outf.close()
SCRIPT_PATH = os.path.dirname(__file__)
outpre = sys.argv[1]
rnaobj = sys.argv[2]
atacobj = sys.argv[3]
report_html_tempfile = os.path.join(SCRIPT_PATH, "html", "Integration_template.html")
report_html_temp = open(report_html_tempfile, "r").read()
# allsourceplot_link = '''"Plot/''' + outpre + '''_source.png"'''
# rnaplot_link = '''"Plot/''' + outpre + '''_RNAonly.png"'''
# atacplot_link = '''"Plot/''' + outpre + '''_ATAConly.png"'''
# annoplot_link = '''"Plot/''' + outpre + '''_annotated.png"'''
allsourceplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_source.png"%outpre)[0]
rnaplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_RNAonly.png"%outpre)[0]
atacplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_ATAConly.png"%outpre)[0]
annoplot_link = snakemake.report.data_uri_from_file("Result/Analysis/%s_annotated.png"%outpre)[0]
report_html_instance = report_html_temp % {"outprefix":outpre, "scrnaobject":rnaobj, "scatacaobject":atacobj, "allsource":allsourceplot_link, "rnacluster":rnaplot_link, "ataccluster":atacplot_link, "allannotate":annoplot_link}
report_html_instancefile = "Result/" + outpre + "_integrate_report.html"
outf = open(report_html_instancefile,"w")
outf.write(report_html_instance)
outf.close()