Example #1
0
 def __getitem__(self, slice_data):
     """
     Interpret slice data and return region of sequence from twobit file
     """
     start, stop, stride = slice_data.indices(self.size)
     assert stride == 1, "striding in slices not supported"
     if stop - start < 1:
         return ""
     return _twobit.read(self.twobit_file, self, start, stop, False)
Example #2
0
 def get( self, start, end ):
     # Trim start / stop
     if start < 0:
         start = 0
     if end > seq.size:
         end = seq.size
     out_size = end - start
     if out_size < 1:
         raise Exception( "end before start (%s,%s)" % ( start,end ) )
     # Find position of packed portion
     dna = _twobit.read( self.tbf.file, self, start, end, self.tbf.do_mask )
     # Return
     return dna
 def get(self, start, end):
     # Trim start / stop
     if start < 0:
         start = 0
     if end > self.size:
         end = self.size
     out_size = end - start
     if out_size < 1:
         raise Exception("end before start (%s,%s)" % (start, end))
     # Find position of packed portion
     dna = _twobit.read(self.tbf.file, self, start, end, self.tbf.do_mask)
     # Return
     return dna
Example #4
0
 def get(self, start, end):
     """Get region of sequence from twobit file"""
     # Trim start / stop
     if start < 0:
         start = 0
     if end > self.size:
         end = self.size
     out_size = end - start
     if out_size < 1:
         raise Exception("end before start (%s, %s)" % (start, end))
     # Find position of packed portion
     dna = _twobit.read(self.twobit_file, self, start, end, False)
     # Return
     return dna
Example #5
0
 def __getitem__( self, slice ):
     start, stop, stride = slice.indices( self.size )
     assert stride == 1, "Striding in slices not supported"
     if stop - start < 1:
         return ""
     return _twobit.read( self.tbf.file, self, start, stop, self.tbf.do_mask  )
 def __getitem__(self, slice):
     start, stop, stride = slice.indices(self.size)
     assert stride == 1, "Striding in slices not supported"
     if stop - start < 1:
         return ""
     return _twobit.read(self.tbf.file, self, start, stop, self.tbf.do_mask)