def createContigNew(contigObj, bacteriumId): head_cnt = '' if '>' not in contigObj.head: head_cnt = '>' + contigObj.head else: head_cnt = contigObj.head contigObj = Contig(id_contig_db_outside = contigObj.id_contig_db_outside, head = head_cnt, sequence = contigObj.sequence) idContig = createContig(contigObj, bacteriumId) return idContig
def getContigsByOrganis(idOrganism): """ get all the contigs of a given Organism :param idOrganism: Id of the organism :type idOrganism: int :return: list of contigs :rtype list[Contig] """ listContigs = [] qtyContigs = 0 listContigs = Contig.get_all_Contigs_by_organism_id(idOrganism) return listContigs
def insertBacteriumProteinsWholeDNAContigsNopositions(bacteriumObj, idStrainAPI, wholeDNAObj, dictProts, dictConts): """ insert the bacterium, the whole genome, the contigs, the proteins, and the genes without protein s contig positions :param bacteriumObj: Organism object (old DB) :param idStrainAPI: id of the strain on the new DB (API) :param wholeDNAObj: Whole Genome object (old DB) :param dictProts: Dict with the proteins Key: id of the contig - Value: list of proteins (old DB) :param dictConts: Dict with the contigs Key: id of the contig - Value: contig object (old DB) :type bacteriumObj: Organism_new :type idStrainAPI: int :type wholeDNAObj: WholeDNA_new :type dictProts: dictionary{int: list[Proteins]} :type dictConts: dictionary{int: Contig} :return: matrix with all the data :rtype panda dataframe """ #Test contigs list_contigs = Contig.get_all_Contigs_by_organism_id(bacteriumObj.id_organism) contigs_validation = testContigContainDNA(list_contigs) if contigs_validation == True: bacteriumCreatedID = createBacterium(bacteriumObj, idStrainAPI) wholeDNACreatedID = createWholeDNA(wholeDNAObj, bacteriumCreatedID) for contig in list_contigs: print('Hello') contigID = createContigNew(contig, bacteriumCreatedID) for key,proteinlist in dictProts.items(): for protein in proteinlist: createProtein(protein, bacteriumCreatedID, None) print('Hello')