def getFasta_proteic_DNA(self): self.getFasta_seq_all_proteins() self.getFasta_seq_proteins_DNA() print("je suis diogo 2") print(len(self.file_fasta_protein_seq)) print("je suis diogo") print(type(self.file_fasta_protein_seq)) #print(self.file_fasta_protein_seq) list_keys = [] list_proteins = [] for key, value in self.file_fasta_protein_seq.items(): list_keys.append(key) DNA_string_key = self.get_DNA_description(key) id_protein = -1 id_prot_DB_online = self.get_protein_id( self.file_fasta_protein_seq[key].description) designation = self.get_protein_description( self.file_fasta_protein_seq[key].description) sequence_prot = self.file_fasta_protein_seq[key].seq sequence_DNA = self.file_fasta_nucleic_seq[DNA_string_key].seq start_point, end_point = self.get_protein_location( self.file_fasta_protein_seq[key].description) protein_obj = Protein(id_protein, id_prot_DB_online, designation, sequence_prot, sequence_DNA, start_point, end_point) print(start_point) print(end_point) list_proteins.append(protein_obj) print(len(list_proteins)) print("finiinininininiiiiii") return list_proteins
def createGeneProt(proteinOBJ, fkOrganism, fkContig = None): """ insert the bacterium, the whole genome, the proteins, and the genes :param proteinOBJ: Protein object (old DB) :param fkOrganism: id of the organism created :param fkContig: id of the contig created in case of exists :type proteinOBJ: Protein_new :type fkOrganism: int :type fkContig: int """ dna_head_gene = '' if '>' not in proteinOBJ.designation: dna_head_gene = '>' + proteinOBJ.designation else: dna_head_gene = proteinOBJ.designation geneObjInsert = Gene(dna_head = dna_head_gene, dna_sequence = proteinOBJ.sequence_dna, FK_id_organism = fkOrganism, start_position = proteinOBJ.start_point, end_position = proteinOBJ.end_point) geneId = 0 if fkContig != None: geneId = createGene(geneObjInsert, proteinOBJ.start_point_cnt, proteinOBJ.end_point_cnt, fkContig) else: geneId = createGene(geneObjInsert, None, None, None) proteinOBJInsert = Protein(id_accession = proteinOBJ.id_accession, sequence_prot = proteinOBJ.sequence_prot, designation = proteinOBJ.designation) if (proteinOBJ.sequence_prot != None): proteinId = createProtein(proteinOBJInsert, fkOrganism, geneId)
def getProteinsByOrganism(idOrganism): """ get all the proteins of a given Organism :param idOrganism: Id of the organism :type idOrganism: int :return: list of proteins :rtype list[Protein] """ listProteins = [] qtyprots = 0 listProteins = Protein.get_all_Proteins_by_organism_id(idOrganism) assert len(listProteins) > 1 writeCSVProteinNumber(idOrganism, len(listProteins)) return listProteins
contig_sequence_phage = ncbi_file_genbank.get_contig_of_the_phage() list_ids_prot = ncbi_file_data_prot.get_list_protein_name() list_of_proteins = [] for id_prot in list_ids_prot: sequence_prot = ncbi_file_data_prot.get_protein_sequence_prot_id( id_prot) sequence_nuc = ncbi_file_data_nucleotid.get_nucleotid_sequence_prot_id( id_prot) vec_location = ncbi_file_data_nucleotid.get_location_by_prot_id( id_prot) protein_obj = Protein(id_accession=id_prot, sequence_prot=sequence_prot, sequence_dna=sequence_nuc, start_point=vec_location[0], end_point=vec_location[1]) list_of_proteins.append(protein_obj) family_obj = None genus_obj = None specie_obj = None strain_obj = None family_obj = Family(designation='Phage no family') genus_obj = Genus(designation='Phage no genuse') specie_obj = Specie(designation='Phage no Specie') strain_obj = Strain(designation=file_name[:-4]) print(strain_obj)
def getProteinsDB(id_bacterium): bacteriophage = Organism.get_organism_by_id(id_bacterium) list_proteins = Protein.get_all_Proteins_by_organism_id(id_bacterium) qty_prots_DB = len(list_proteins) return qty_prots_DB