Issue 210 bigwig support

New datasource class for bigwig format files (http://genome.ucsc.edu/goldenpath/help/bigWig.html).

This class uses the ngslib python library to fetch continuous scores from a bigwig file.  For queries spanning a genomic range, the median of scores across the range are returned.


Are you sure?  Do you have the profile info?

On Wed, Nov 5, 2014 at 12:18 PM, Alex Ramos <notifications@github.com>
wrote:

> In oncotator/datasources/BigWig.py:
>
> > +    def __init__(self, src_file, title='', version=None):
> > +        super(BigWigDatasource, self).__init__(src_file, title=title, version=version)
> > +
> > +        self.output_headers = [title + '_score']
> > +        self.bigwig_fh = BigWigFile(src_file)
> > +        self.has_chr = True if self.bigwig_fh.chroms[0].startswith('chr') else False
> > +
> > +    def annotate_mutation(self, mutation):
> > +        if self.has_chr and not mutation.chr.startswith('chr'):
> > +            chrn = 'chr' + mutation.chr
> > +        else:
> > +            chrn = mutation.chr
> > +
> > +        variant_start, variant_end = int(mutation.start) - 1, int(mutation.end) #start - 1 because bigwig format is zero-based coords
> > +
> > +        scores = [r.score for r in self.bigwig_fh.fetch(chrom=chrn, start=variant_start, stop=variant_end)]
>
> Actually this is probably a more accurate per-call estimate:
>
> {wWigIO.getIntervals} per call time: 0.25 milliseconds.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/broadinstitute/oncotator/pull/230/files#r19889062>.
>



-- 
Lee Lichtenstein
Broad Institute
415 Main Street, Room 4041
Cambridge, MA 02142
617 714 8632