raphael-group / THetA

Tumor Heterogeneity Analysis (THetA) and THetA2 are algorithms that estimate the tumor purity and clonal/subclonal copy number aberrations directly from high-throughput DNA sequencing data. This repository includes the updated algorithm, called THetA2.
http://compbio.cs.brown.edu/projects/theta/
70 stars 33 forks source link

Support for BICSeq2 #14

Open amcpherson opened 7 years ago

amcpherson commented 7 years ago

It appears that the bicseq output has changed (perhaps from bicseq to bicseq2). As a result BICSeqToTHetA doesnt work with the most recent version of bicseq2. Is there any reason to not use bicseq2 as input to theta?

In case it is helpful, the following python code does most of what BICSeqToTHetA does, and is robust to column order:

import pandas as pd

segs = pd.read_csv(
    bicseq2_seg_filename, sep='\t',
    converters={'chrom': str, 'start': int, 'end': int})
segs['#ID'] = (
    'start_' + segs['chrom'] + '_' + segs['start'].astype(str) +
    'end_' + segs['chrom'] + '_' + segs['end'].astype(str))
segs['chrm'] = segs['chrom']
segs['tumorCount'] = segs['tumor']
segs['normalCount'] = segs['normal']
segs['length'] = segs['end'] - segs['start']

# Length filter (default 10Mb)
segs = segs[segs['length'] >= config.get('min_length', int(10e6))]

theta_seg_filename = os.path.join(tmp_directory, 'theta_input.seg')
cols = ['#ID', 'chrm', 'start', 'end', 'tumorCount', 'normalCount']
segs[cols].to_csv(theta_seg_filename, sep='\t', index=False)