Skip to content

Commit

Permalink
Updates to vis data providers for pysam API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Oct 22, 2015
1 parent 048f0be commit 7e372d3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/galaxy/visualization/data_providers/genome.py
Expand Up @@ -9,10 +9,12 @@
import re
import sys

import pysam

from bx.interval_index_file import Indexes
from bx.bbi.bigbed_file import BigBedFile
from bx.bbi.bigwig_file import BigWigFile
from pysam import csamtools, ctabix
from pysam import ctabix

from galaxy.datatypes.interval import Bed, Gff, Gtf
from galaxy.datatypes.util.gff_util import convert_gff_coords_to_bed, GFFFeature, GFFInterval, GFFReaderWrapper, parse_gff_attributes
Expand Down Expand Up @@ -845,11 +847,11 @@ def write_data_to_file( self, regions, filename ):
"""

# Open current BAM file using index.
bamfile = csamtools.Samfile( filename=self.original_dataset.file_name, mode='rb',
index_filename=self.converted_dataset.file_name )
bamfile = pysam.AlignmentFile( filename=self.original_dataset.file_name, mode='rb',
index_filename=self.converted_dataset.file_name )

# TODO: write headers as well?
new_bamfile = csamtools.Samfile( template=bamfile, filename=filename, mode='wb' )
new_bamfile = pysam.AlignmentFile( template=bamfile, filename=filename, mode='wb' )

for region in regions:
# Write data from region.
Expand Down Expand Up @@ -877,7 +879,7 @@ def write_data_to_file( self, regions, filename ):

def open_data_file( self ):
# Attempt to open the BAM file with index
return csamtools.Samfile( filename=self.original_dataset.file_name, mode='rb',
return pysam.AlignmentFile( filename=self.original_dataset.file_name, mode='rb',
index_filename=self.converted_dataset.file_name )

def get_iterator( self, data_file, chrom, start, end, **kwargs ):
Expand Down

0 comments on commit 7e372d3

Please sign in to comment.