Cython: Sequence objects: repr() method now returns a Fasta or Fastq
formatted string
This commit is contained in:
@ -16,6 +16,10 @@ from .capi.obiview cimport NUC_SEQUENCE_COLUMN, \
|
|||||||
|
|
||||||
from .capi.obiutils cimport reverse_complement_sequence
|
from .capi.obiutils cimport reverse_complement_sequence
|
||||||
|
|
||||||
|
from obitools3.format.fasta import FastaFormat
|
||||||
|
from obitools3.format.fastq import FastqFormat
|
||||||
|
|
||||||
|
|
||||||
from cpython cimport array
|
from cpython cimport array
|
||||||
import array
|
import array
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@ -414,3 +418,10 @@ cdef class Nuc_Seq_Stored(Seq_Stored) :
|
|||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self._view.get_column(NUC_SEQUENCE_COLUMN).get_line(self.index))
|
return len(self._view.get_column(NUC_SEQUENCE_COLUMN).get_line(self.index))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
if self.quality is None:
|
||||||
|
formatter = FastaFormat()
|
||||||
|
else:
|
||||||
|
formatter = FastqFormat()
|
||||||
|
return bytes2str(formatter(self))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user