Commit 88b15b8c authored by Beatrice Tan's avatar Beatrice Tan
Browse files

Reference file as input for rules to use correct ensembl version.

parent cddbbceb
from Reports import ReportSegmentation
rule firehose:
"""Download copy number profiles for a cancer type of choice from firehose."""
output:
......@@ -44,6 +46,17 @@ rule define_input:
else: #split firehose data in tumor and normal files.
split_normal_tumor(input[0], output.tumor, output.normal)
rule report_seg:
"""Report information on the input segmentation file."""
input:
seg="Input/Segments_tumor.txt"
output:
"Reports/Segments.txt"
run:
ReportSegmentation(input[0], output[0])
def split_normal_tumor(all_samples, out_tumor, out_normal):
"""Split a segmentation file from firehose in a segmentation file with only tumor samples and one with only normal samples"""
with open(all_samples, 'r') as old:
......
from Rubic import MarkerFile
from Reports import ReportTools, ReportSegmentation
from Reports import ReportTools
import os.path
import datetime
......@@ -69,20 +69,11 @@ rule report_tools:
params: #select input files from repository or own input files
census=os.path.join(workflow.basedir, config["census_genes"]) if config["census_genes"].startswith("input_files") else config["census_genes"],
known=os.path.join(workflow.basedir, config["prev_found_genes"]) if config["prev_found_genes"].startswith("input_files") else config["prev_found_genes"],
gene_info=os.path.join(workflow.basedir, config["biomart_genes"]) if config["biomart_genes"].startswith("input_files") else config["biomart_genes"]
gene_info=os.path.join(workflow.basedir, config["biomart_genes"]) if config["biomart_genes"].startswith("input_files") else config["biomart_genes"],
ref=config["reference"]
run:
ReportTools(input.gistic, input.rubic, params.census, params.known, params.gene_info,
output.tools,output.venn, output.genes_both, output.genes_gistic, output.genes_rubic, output.overlap, output.swarmplot)
rule report_seg:
"""Report information on the input segmentation file."""
input:
seg="Input/Segments_tumor.txt"
output:
"Reports/Segments.txt"
run:
ReportSegmentation(input[0], output[0])
ReportTools(input.gistic, input.rubic, params.census, params.known, params.gene_info, params.ref
output.tools, output.venn, output.genes_both, output.genes_gistic, output.genes_rubic, output.overlap, output.swarmplot)
from snakemake.utils import report
......
......@@ -60,6 +60,7 @@ rule report_sizes:
params:
census=config["census_genes"],
known=config["prev_found_genes"],
reps=config["repeats"]
reps=config["repeats"],
ref=config["reference"]
run:
ReportSizes(input[0], params.census, params.known, params.reps, output.report, output.plots)
ReportSizes(input[0], params.census, params.known, params.reps, params.ref, output.report, output.plots)
......@@ -24,6 +24,7 @@ rule report_control:
"Reports/Control.txt"
params:
census=config["census_genes"],
known=config["prev_found_genes"]
known=config["prev_found_genes"],
ref=config["reference"]
run:
ReportControl(input.control, input.nocontrol, output[0], params.census, params.known)
ReportControl(input.control, input.nocontrol, output[0], params.census, params.known, params.ref)
......@@ -87,10 +87,10 @@ class ReportSegmentation:
class ReportTools:
"""Make a report and gene file from the analyses with GISTIC2 and RUBIC"""
def __init__(self, gistic_dir, rubic_gain_file, census_genes, known_genes, gene_file, file_tools,
def __init__(self, gistic_dir, rubic_gain_file, census_genes, known_genes, gene_file, ref_genome, file_tools,
file_venn, file_genes_both, file_genes_GISTIC, file_genes_RUBIC, file_overlap, file_swarmplot): #double brackets? ((...))
rubic_dir = rubic_gain_file.split("/gains.txt")[0] #get diretory with rubic results from gain file path.
install_ensembl("hg19")
install_ensembl(ref_genome)
parsed, stats = self.calculate_stats(gistic_dir, rubic_dir, file_tools, census_genes, known_genes)
self.make_tool_report(file_tools, stats)
......@@ -253,8 +253,8 @@ class ReportTools:
class ReportSizes:
"""Make a report and plots on analyses with different sample sizes"""
def __init__(self, size_results, census_genes, known_genes, reps, report_file, plot_dir):
install_ensembl("hg19")
def __init__(self, size_results, census_genes, known_genes, reps, ref_genome, report_file, plot_dir):
install_ensembl(ref_genome)
self.make_sizes_report(size_results, census_genes, known_genes, reps, report_file, plot_dir)
def make_sizes_report(self, size_results, census_genes, known_genes, reps, report_file, plot_dir):
......@@ -328,8 +328,8 @@ class ReportSizes:
class ReportControl:
"""Make a report on analyses using control samples or without using them."""
def __init__(self, control_results, nocontrol_results, report_file, census_genes, known_genes):
install_ensembl("hg19")
def __init__(self, control_results, nocontrol_results, report_file, census_genes, known_genes, ref_genome):
install_ensembl(ref_genome)
self.make_control_report(control_results, nocontrol_results, report_file, census_genes, known_genes)
def make_control_report(self, control_results, nocontrol_results, report_file, census_genes, known_genes):
......
This diff is collapsed.
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