class ReadStatsSample(mdb.EmbeddedDocument):  # pylint: disable=too-few-public-methods
    """A set of consistent fields for read stats."""

    num_reads = mdb.IntField()
    gc_content = mdb.FloatField()
    codons = mdb.MapField(field=mdb.IntField(), required=True)
    tetramers = mdb.MapField(field=mdb.IntField(), required=True)
Exemple #2
0
class ReadStatsToolResult(ToolResult):  # pylint: disable=too-few-public-methods
    """A set of consistent fields for read stats."""

    num_reads = mongoDB.IntField()
    gc_content = mongoDB.FloatField()
    codons = mongoDB.MapField(field=mongoDB.IntField(), required=True)
    tetramers = mongoDB.MapField(field=mongoDB.IntField(), required=True)

    @staticmethod
    def stat_fields():
        """Return a list of the stats collected."""
        return ['num_reads', 'gc_content', 'codons', 'tetramers']
Exemple #3
0
class FoodPetResult(ToolResult):        # pylint: disable=too-few-public-methods
    """Food/Pet tool's result type."""

    # DictFields are of the form: {<sample_id>: <sample_value>}
    vegetables = mongoDB.DictField(default={})
    fruits = mongoDB.DictField(default={})
    pets = mongoDB.DictField(default={})
    meats = mongoDB.DictField(default={})

    total_reads = mongoDB.IntField()
Exemple #4
0
class MicrobeCensusResult(ToolResult):  # pylint: disable=too-few-public-methods
    """Mic Census tool's result type."""

    average_genome_size = mongoDB.FloatField(required=True)
    total_bases = mongoDB.IntField(required=True)
    genome_equivalents = mongoDB.FloatField(required=True)

    def clean(self):
        """Check all values are non-negative, if not raise an error."""
        def validate(*vals):
            """Check vals are non-negative, return a bool."""
            for val in vals:
                if val is not None and val < 0:
                    return False
            return True

        if not validate(self.average_genome_size,
                        self.total_bases,
                        self.genome_equivalents):
            msg = 'MicrobeCensusResult values must be non-negative'
            raise ValidationError(msg)
class MacrobialRow(mongoDB.EmbeddedDocument):  # pylint: disable=too-few-public-methods
    """Row for a gene in Macrobial."""

    total_reads = mongoDB.IntField()
    rpkm = mongoDB.FloatField()
class KrakenResult(ToolResult):     # pylint: disable=too-few-public-methods
    """Kraken tool's result type."""

    # Taxa is of the form: {<taxon_name>: <abundance_value>}
    taxa = mongoDB.MapField(mongoDB.IntField(), required=True)
Exemple #7
0
class KrakenHLLResult(ToolResult):
    """Kraken tool's result type."""

    # Taxa is of the form: {<taxon_name>: <abundance_value>}
    taxa = mongoDB.MapField(mongoDB.IntField(), required=True)