Commit 6401d987 authored by BeatriceTan's avatar BeatriceTan
Browse files

Counts range of raw CN values.

parent 6babeff8
......@@ -42,10 +42,10 @@ onerror:
rule all:
"""Define desired output from pipeline."""
input:
"Samplesize/Report.txt",
#"Samplesize/Report.txt",
#"Reports/Results.html",
#"Reports/Overlap_regions.bed"
#"Reports/Segments.txt",
"Reports/Segments.txt",
#"GO/comparison.txt"
......
......@@ -60,10 +60,16 @@ class ReportSegmentation:
def parse_segments(self, segmentation_file):
"""Parse the input segmentation file and return a dictionary with number of CNVs and total CNV length per sample."""
stat_dict = OrderedDict()
minimal_seg = 0
maximal_seg = 0
with open(segmentation_file, 'r') as lines:
lines.readline()
for line in lines:
sample, chrom, start, end, num_prob, seg_CN = line.strip().split("\t")
if float(seg_CN) > 0:
maximal_seg = float(seg_CN) if float(seg_CN) > maximal_seg else maximal_seg
if float(seg_CN) < 0:
minimal_seg = float(seg_CN) if float(seg_CN) < minimal_seg else minimal_seg
if sample not in stat_dict:
stat_dict[sample] = [0, 0, 0, 0]
cnv_length = int(end) - int(start)
......@@ -75,6 +81,8 @@ class ReportSegmentation:
stat_dict[sample][2] += 1
if deletion:
stat_dict[sample][3] += 1
print(minimal_seg)
print(maximal_seg)
return stat_dict
def calculate_stats(self, tot_size, tot_nr_focal, tot_nr_del, tot_nr_cnvs, nr_samples):
......
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