Ejemplo n.º 1
0
    def getAllAPI():
        """
        get all the Bacteria on the database

        :return: list of Bacteria
        :rtype: vector[BacteriuJson]
        """
        list_bacteria = BacteriumAPI().get_all()
        schema = BacteriumSchema()
        results = schema.load(list_bacteria, many=True)
        return results
Ejemplo n.º 2
0
    def getByID(id_bacterium: int):
        """
        get a bacterium given its id

        :param id_bacterium: id of the bacterium that it will be returned

        :type id_bacteriophage: int

        :return: a json of the bacterium 
        :rtype: BacteriumJson
        """
        bacterium = BacteriumAPI().get_by_id(id_bacterium)
        schema = BacteriumSchema()
        results = schema.load(bacterium, many=False)
        return results
Ejemplo n.º 3
0
    def getByAccnumber(acc_number: str):
        """
        get a bacterium given its acc

        :param acc_number: acc of the bacterium that it will be returned

        :type acc_number: String

        :return: a json of the bacterium
        :rtype: BacteriumJson
        """
        bacterium = BacteriumAPI().getBacteriumByAcc(acc_number)
        schema = BacteriumSchema()
        results = schema.load(bacterium, many=False)
        return results[0]
Ejemplo n.º 4
0
    def verifiyBacteriumExistanceByAcc(acc_value):
        """
        Verify if a bacterium exists according an accValue

        :param acc_value: accession number of the bacterium that you want to check the existence

        :type acc_value: string

        :return: return True or False according the existence
        :rtype: boolean
        """

        resultsCreation = BacteriumAPI().setBacteriumExistsByAcc(
            acc_value=acc_value)
        bacterium_existence = resultsCreation['value']['bacterium_exists']
        return bacterium_existence
Ejemplo n.º 5
0
    def setBacterium(self):
        """
        set new bacterium

        :return: new bacterium completed with the id
        :rtype: BacteriumJson
        """

        schema = BacteriumSchema(only=[
            'acc_number', 'gi_number', 'source_data', 'person_responsible',
            'strain'
        ])
        jsonBacterium = schema.dump(self)
        resultsCreation = BacteriumAPI().set_bacterium(
            jsonData=jsonBacterium.data)
        schema = BacteriumSchema()
        results = schema.load(resultsCreation)
        return results[0]