Commit 781db167 authored by Beatrice Tan's avatar Beatrice Tan

Updated visualizations.

parent 838ad220
......@@ -40,7 +40,7 @@ rule all:
"""Define desired output from pipeline."""
input:
"Samplesize/Report.txt",
"Reports/Tools.txt"
#"Reports/Tools.txt"
#"Reports/Segments.txt",
#"GO/comparison.txt"
......
......@@ -2,6 +2,9 @@
workdir: /home/bftan/CNA_results #directory to write output
gisticdir: /home/bftan/Tools/GISTIC2 #directory to install GISTIC2
#workdir: /home/beatrice/CNA_analysis
#gisticdir: /home/beatrice/CNA_analysis/run_gistic2
#Input details to download from firehose
cancer_type: SKCM
date_data: "2016_07_15"
......
......@@ -18,7 +18,8 @@ snakemake -p \
--configfile /home/bftan/PrioritizationCNAs/config.yaml \
--snakefile /home/bftan/PrioritizationCNAs/Snakefile \
--latency-wait 90 \
--jobs 4 \
--jobs 100 \
--max-jobs-per-second 10 \
--restart-times 3 \
--use-conda
#--conda-prefix ...
......@@ -7,7 +7,7 @@ from collections import OrderedDict
def parse(results_file, known_file, census_file, used_tool):
"""Make list with the parsed results from GISTIC or RUBIC.
Format: [(chrom, start, end, cnv_type, qval, [gene_lis], [known_gene_list], [census_gene_list])]"""
Format: [chrom, start, end, cnv_type, qval, [known_gene_list], [census_gene_list], [gene_list]]"""
known_genes = gene_file_IDs(known_file, np.inf)
census_genes = gene_file_IDs(census_file, np.inf)
if used_tool == 'GISTIC':
......@@ -39,7 +39,7 @@ def parse_gistic_results(results_file, known_genes, census_genes):
regions.append(cnv_data)
return regions
def parse_rubic_results(results_gains, results_losses, census_genes, known_genes):
def parse_rubic_results(results_gains, results_losses, known_genes, census_genes):
"""Create a list of lists with the recurrent regions called by GISTIC2."""
regions = []
for result_file in results_gains, results_losses:
......
......@@ -118,7 +118,7 @@ class ReportTools:
def make_tool_report(self, file_tools, stats_tools):
"""Make a report of the results from GISTIC and RUBIC."""
row_names = ["Tool", "Type", "Nr. regions", "Avg. size (Kb)", "Total size (Mb)", "Nr. genes", "Regions with census genes", "Regions with known genes"]
row_names = ["Tool", "Type", "Nr. regions", "Avg. size (Kb)", "Total size (Mb)", "Nr. genes", "Regions with known genes", "Regions with census genes"]
with open(file_tools, 'w') as out:
for i in range(len(row_names)):
list_out = [row_names[i], stats_tools[0][0][i], stats_tools[0][1][i], stats_tools[1][0][i], stats_tools[1][1][i]]
......@@ -176,21 +176,34 @@ class ReportTools:
if size < 900000:
sizes_zoomed += [(size, tool, cnv_label)]
tool = 'RUBIC'
labels = ['Size', 'Tool', 'Type']
plotnr = 1
for data in sizes, sizes_zoomed:
df = pd.DataFrame(data, columns=labels)
plt.subplot(2, 1, plotnr)
g = sns.swarmplot(x="Size", y="Tool", hue="Type", data=df, size=3)
if plotnr == 2:
g.set(xlim=(-10000, None))
g.legend_.remove()
else:
g.set(xlim=(-1000000, None))
plotnr = 2
plt.savefig(out_plot, dpi=300)
labels = ['Size', 'Tool', 'CNV type']
df = pd.DataFrame(sizes, columns=labels)
self.make_swarmplot_log_sizes(df, out_plot)
def make_swarmplot_log_sizes(self, size_list, plot_file):
sns.set_style("whitegrid")
f, ax = plt.subplots(figsize=(7, 7))
ax.set(yscale="log")
g = sns.swarmplot(x="Tool", y="Size", hue="CNV type", data=size_list, size=5)
g.set(xlabel='Tool', ylabel='Log size of recurrent regions', fontsize=25)
plt.savefig(plot_file, dpi=300)
plt.close()
# def make_swarmplot_sizes(self, size_list, plot_file):
# plotnr = 1
# for data in sizes, sizes_zoomed:
# df = pd.DataFrame(data, columns=labels)
# plt.subplot(2, 1, plotnr)
# g = sns.swarmplot(x="Size", y="Tool", hue="Type", data=df, size=3)
# if plotnr == 2:
# g.set(xlim=(-10000, None))
# g.legend_.remove()
# else:
# g.set(xlim=(-1000000, None))
# plotnr = 2
# plt.savefig(out_plot, dpi=300)
# plt.close()
def venn_overlap(self, gene_lists, out_venn):
"""Compare the genes detected by GISTIC and those by RUBIC."""
venn2([set(gene_lists[0]), set(gene_lists[1])], set_labels = ('GISTIC2', 'RUBIC'))
......
......@@ -3,7 +3,7 @@
<<include ticks.conf>>
<image>
#angle_offset* = -82
angle_offset* = -82
<<include etc/image.conf>>
</image>
......
......@@ -8,9 +8,9 @@ axis_break_at_edge = yes
axis_break = yes
axis_break_style = 2
#<pairwise hs22 hs1>
#spacing = 50r
#</pairwise>
<pairwise hs22 hs1>
spacing = 50r
</pairwise>
<break_style 1>
stroke_color = black
......
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