Beispiel #1
0
 def __init__(self, rec):
     """Constructs a new object with the given fastq record"""
     # strip quiver appendage from name
     if rec.name.endswith("|quiver"):
         self._name = rec.name[:rec.name.index('|quiver')]
     else:
         self._name = rec.name[:rec.name.index('|arrow')]
     self._qv = np.average(rec.quality)
     self._len = len(rec.sequence)
     self._cov = ContigCoverage(self._name)
class ContigInfo(object):
    """Contains relevant contig information needed for plotting.  Contig id,
    length and averaged QV and average coverage depth.
    """

    def __init__(self, rec):
        """Constructs a new object with the given fastq record"""
        # strip quiver appendage from name
        if rec.name.endswith("|quiver"):
            self._name = rec.name[:rec.name.index('|quiver')]
        else:
            self._name = rec.name[:rec.name.index('|arrow')]
        self._qv = np.average(rec.quality)
        self._len = len(rec.sequence)
        self._cov = ContigCoverage(self._name)

    def __repr__(self):
        _d = dict(k=self.__class__.__name__, n=self.name, l=self.length)
        return "<{k} name:{n} length:{l} >".format(**_d)

    def add_coverage_data(self, gffrec):
        """Adds coverage information from a gff record"""
        self._cov.add_data(gffrec)

    @property
    def name(self):
        """Contig name (or ID)"""
        return self._name

    @property
    def mean_qv(self):
        """Mean QV value"""
        return self._qv

    @property
    def length(self):
        """Contig length"""
        return self._len

    @property
    def mean_coverage(self):
        """Mean coverage"""
        return self._cov.meanCoveragePerBase()
 def __init__(self, rec):
     """Constructs a new object with the given fastq record"""
     # strip quiver appendage from name
     if rec.name.endswith("|quiver"):
         self._name = rec.name[:rec.name.index('|quiver')]
     else:
         self._name = rec.name[:rec.name.index('|arrow')]
     self._qv = np.average(rec.quality)
     self._len = len(rec.sequence)
     self._cov = ContigCoverage(self._name)
Beispiel #4
0
class ContigInfo(object):
    """Contains relevant contig information needed for plotting.  Contig id,
    length and averaged QV and average coverage depth.
    """

    def __init__(self, rec):
        """Constructs a new object with the given fastq record"""
        # strip quiver appendage from name
        if rec.name.endswith("|quiver"):
            self._name = rec.name[:rec.name.index('|quiver')]
        else:
            self._name = rec.name[:rec.name.index('|arrow')]
        self._qv = np.average(rec.quality)
        self._len = len(rec.sequence)
        self._cov = ContigCoverage(self._name)

    def __repr__(self):
        _d = dict(k=self.__class__.__name__, n=self.name, l=self.length)
        return "<{k} name:{n} length:{l} >".format(**_d)

    def add_coverage_data(self, gffrec):
        """Adds coverage information from a gff record"""
        self._cov.add_data(gffrec)

    @property
    def name(self):
        """Contig name (or ID)"""
        return self._name

    @property
    def mean_qv(self):
        """Mean QV value"""
        return self._qv

    @property
    def length(self):
        """Contig length"""
        return self._len

    @property
    def mean_coverage(self):
        """Mean coverage"""
        return self._cov.meanCoveragePerBase()