Commit 9eede366 authored by Beatrice Tan's avatar Beatrice Tan
Browse files

Added boxplot for sizes.

parent 8133c44a
......@@ -24,11 +24,11 @@ cd PrioritizationCNAs
- Set cancer_type and date_data to download Firehose data or provide own input file.
- Provide the remainder files related to the tumor type of the input file.
6. Run the pipeline from the directory containing the Snakefile:
6. Run the pipeline shell script, which will create the required conda environment and run snakemake (recommended when snakemake is not installed yet):
```
bash run_pipeline.sh
```
Or manually create an environment for the pipeline, install the required packages and run snakemake:
Or manually install the required packages and run snakemake:
```
conda install -c bioconda snakemake=4.4.0
conda install -c conda-forge matplotlib-venn=0.11.5
......
......@@ -39,8 +39,8 @@ onerror:
rule all:
"""Define desired output from pipeline."""
input:
"Samplesize/Report.txt",
#"Reports/Tools.txt"
#"Samplesize/Report.txt",
"Reports/Results.html"
#"Reports/Segments.txt",
#"GO/comparison.txt"
......
#Directories to be specified
workdir: /home/bftan/CNA_results #directory to write output
gisticdir: /home/bftan/Tools/GISTIC2 #directory to install GISTIC2
#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
workdir: /home/beatrice/CNA_analysis
gisticdir: /home/beatrice/CNA_analysis/run_gistic2
#Input details to download from firehose
cancer_type: SKCM
......
......@@ -115,7 +115,15 @@ rule report_tools:
rule report:
"""Write html report on segmentation file."""
input:
seg="Reports/Segments.txt"
seg="Reports/Segments.txt",
tools="Reports/Tools.txt",
table_regions="Reports/Recurrent_regions.txt",
genes_both="Reports/Genes_both.txt",
genes_gistic="Reports/Genes_GISTIC2.txt",
genes_rubic="Reports/Genes_RUBIC.txt",
overlap="Reports/Overlap_genes.txt",
venn="Reports/Venn_overlap_genes.png",
swarmplot="Reports/Swarmplot_sizes.png"
output:
html="Reports/Results.html"
run:
......
......@@ -166,7 +166,7 @@ class ReportTools:
def make_swarmplot_sizes(self, parsed_results, out_plot):
"""Make swarmplot of the sizes of recurrent regions detected by either GISTIC2 or RUBIC."""
sizes, sizes_zoomed = [], []
tool = 'GISTIC2'
tool = 'GISTIC2.0'
for tool_results in parsed_results:
amp_sizes, del_sizes = [], []
for cnv in tool_results:
......@@ -181,29 +181,20 @@ class ReportTools:
self.make_swarmplot_log_sizes(df, out_plot)
def make_swarmplot_log_sizes(self, size_list, plot_file):
sns.set_style("whitegrid")
sns.set_style("white")
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)
g = sns.boxplot(x="Tool", y="Size", hue="CNV type", data=size_list, whis=np.inf, palette="deep")
g = sns.swarmplot(x="Tool", y="Size", split=True, hue="CNV type", data=size_list, size=5, palette={"Amplification": "#3f3f3f", "Deletion": "#3f3f3f"})
sns.despine()
g.set_xlabel("Tool",fontsize=16)
g.set_ylabel("Log size of recurrent regions",fontsize=16)
g.tick_params(labelsize=12)
handles, labels = g.get_legend_handles_labels()
plt.legend(handles[0:2], labels[:2], fontsize=12)
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'))
......@@ -373,6 +364,8 @@ class ReportSizes:
png_file = os.path.join(plot_dir, y_axis.replace(" ", "_") + ".png")
plt.savefig(png_file, dpi=300)
# def test_signficance(list_one, list_two):
class ReportControl:
"""Make a report on analyses using control samples or without using them."""
......
Supports Markdown
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