Commit 4802e32f authored by Celine Mercier's avatar Celine Mercier

Cython: Sequence objects: repr() method now returns a Fasta or Fastq

formatted string
parent b0277620
...@@ -16,6 +16,10 @@ from .capi.obiview cimport NUC_SEQUENCE_COLUMN, \ ...@@ -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) : ...@@ -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))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment