def __init__(self, residues): self.residues = residues self.seq = self.get_peptide_sequence(self.residues) self.blast_online = BlastSearchOnline() self.id = '' self.mapping = {} self.map_aux()
class AuxProtein(object): """ Class storing the mapping of the fusion/auxiliary protein. """ residue_list = [ "ARG", "ASP", "GLU", "HIS", "ASN", "GLN", "LYS", "SER", "THR", "HIS", "HID", "PHE", "LEU", "ILE", "TYR", "TRP", "VAL", "MET", "PRO", "CYS", "ALA", "GLY" ] def __init__(self, residues): self.residues = residues self.seq = self.get_peptide_sequence(self.residues) self.blast_online = BlastSearchOnline() self.id = '' self.mapping = {} self.map_aux() def get_peptide_sequence(self, residues): """ Returns a sequence string of a given list of Bio.PDB.Residue objects. """ return "".join([ polypeptide.three_to_one(x.resname.replace('HID', 'HIS')) for x in residues if x.resname in self.residue_list ]) def map_aux(self): alignments = self.blast_online.run(self.seq) for alignment in alignments: self.id = alignment[0] for hsps in alignment[1].hsps: self.map_hsps(hsps) def map_hsps(self, hsps): """ Analyzes the High Similarity Protein Segment. """ offset = min([int(x.id[1]) for x in self.residues]) q = hsps.query sbjct = hsps.sbjct sbjct_counter = hsps.sbjct_start q_counter = hsps.query_start for s, q in zip(sbjct, q): if s == q: self.mapping[sbjct_counter] = offset - 1 + q_counter sbjct_counter += 1 q_counter += 1 elif s != '-' and q != '-': self.mapping[sbjct_counter] = offset - 1 + q_counter sbjct_counter += 1 q_counter += 1 elif s != '-' and q == '-': sbjct_counter += 1 else: sbjct_counter += 1 q_counter += 1 def get_info(self): return OrderedDict({ "presence": 'YES', "type": "fusion", "uniprot": self.id, "description": "", "start": min(self.mapping.values()), "end": max(self.mapping.values()), "start (pdb)": min(self.mapping.keys()), "end (pdb)": max(self.mapping.keys()), })
class AuxProtein(object): """ Class storing the mapping of the fusion/auxiliary protein. """ residue_list = ["ARG","ASP","GLU","HIS","ASN","GLN","LYS","SER","THR", "HIS", "HID","PHE","LEU","ILE","TYR","TRP","VAL","MET","PRO","CYS","ALA","GLY"] def __init__(self, residues): self.residues = residues self.seq = self.get_peptide_sequence(self.residues) self.blast_online = BlastSearchOnline() self.id = '' self.mapping = {} self.map_aux() def get_peptide_sequence(self, residues): """ Returns a sequence string of a given list of Bio.PDB.Residue objects. """ return "".join([polypeptide.three_to_one(x.resname.replace('HID', 'HIS')) for x in residues if x.resname in self.residue_list]) def map_aux(self): print('aux1',datetime.now() - startTime) alignments = self.blast_online.run(self.seq) print('aux2',datetime.now() - startTime) for alignment in alignments: self.id = alignment[0] for hsps in alignment[1].hsps: self.map_hsps(hsps) def map_hsps(self, hsps): """ Analyzes the High Similarity Protein Segment. """ offset = min([int(x.id[1]) for x in self.residues]) q = hsps.query sbjct = hsps.sbjct sbjct_counter = hsps.sbjct_start q_counter = hsps.query_start for s, q in zip(sbjct, q): if s == q: self.mapping[sbjct_counter] = offset - 1 + q_counter sbjct_counter += 1 q_counter += 1 elif s != '-' and q != '-': self.mapping[sbjct_counter] = offset - 1 + q_counter sbjct_counter += 1 q_counter += 1 elif s != '-' and q == '-': sbjct_counter += 1 else: sbjct_counter += 1 q_counter += 1 def get_info(self): return OrderedDict({ "presence" : 'YES', "type" : "fusion", "uniprot" : self.id, "description" : "", "start" : min(self.mapping.values()), "end" : max(self.mapping.values()), "start (pdb)" : min(self.mapping.keys()), "end (pdb)" : max(self.mapping.keys()), })