Example #1
0
 def __init__(self, res:Residue):
     fullid            = list( res.get_full_id() )
     self.structure    = fullid[0]
     self.model        = fullid[1]
     self.strand_id    = fullid[2]
     self.chemicalName = res.get_resname()
     self.residue_id   = [*fullid[3]][1]
 def invert_amide_atoms(self, res: Residue):
     """ Fix sidechains with incorrect amide assignments"""
     amide_res = self.data_library.get_amide_data()[0]
     res_type = res.get_resname()
     if res_type not in amide_res:
         raise NotAValidResidueError(res_type)
     mu.swap_atoms(res[amide_res[res_type][0]], res[amide_res[res_type][1]])
Example #3
0
 def __init__(self, res: Residue):
     fid = list(res.get_full_id())
     self.model: int = fid[1]
     self.resname: str = fid[3][0]
     self.struct: str = fid[0]
     self.chemicalName: str = res.get_resname()
     self.strand_id: str = fid[2]
     self.residue_id: int = [*fid[3]][1]
     self.banClass: str = ""
 def fix_chiral_chains(self, res: Residue):
     """ Fix sidechains with chiral errors"""
     chiral_res = self.data_library.get_chiral_data()
     res_type = res.get_resname()
     mu.swap_atoms(res[chiral_res[res_type][0]],
                   res[chiral_res[res_type][1]])
     if res_type == 'ILE':
         mu.delete_atom(res, 'CD1')
         mu.build_atom(res, 'CD1', self.res_library, 'ILE')
Example #5
0
    def addResidue(self, res: Residue) -> None:
        parentStrand = res.get_parent().get_id()

        if res.get_resname() not in [AMINO_ACIDS.keys(), *Nucleotides
                                     ] and res not in self.ligands:
            self.ligands.append(res)
            return

        if parentStrand not in self.strands.keys():
            self.strands[parentStrand] = []
        if res not in self.strands[parentStrand]:
            self.strands[parentStrand].append(res)

            # response = _neoget("""
            # match (n {{entity_poly_strand_id:"{parentStrand}"}})-[]-(r:RibosomeStructure{{rcsb_id:"{pdbid}"}}) \
            # return {{type: n.entity_poly_polymer_type, nomenclature:n.nomenclature}};""".format_map({
            #     "parentStrand": parentStrand,
            #     "pdbid"       : self.pdbid
            # }))

            # try:
            #     profile = response[0]

            #     if profile['type'] == 'RNA':
            #         self.adjacentRnaStrands.append(parentStrand)
            #         self.rna[parentStrand] = []

            #     if profile['type'] == 'Protein':
            #         self.adjacentRPStrands.append(parentStrand)
            #         self.rps            [parentStrand] = []
            #         self.nomenclatureMap[parentStrand] = profile['nomenclature']
            # except:
            #     pass
        # if parentStrand in self.adjacentRnaStrands:
        #     if res in self.rna[parentStrand] :
        #         None
        #     else:
        #         self.rna[parentStrand].append(res)
        # elif parentStrand in self.adjacentRPStrands:
        #     if res in self.rps[parentStrand]:
        #         None
        #     else:
        #         self.rps[parentStrand].append(res)
        # print("added residue")
        self.rescount += 1
Example #6
0
    def __deprecated_addResidue(self, res: Residue) -> None:
        parentStrand = res.get_parent().get_id()

        if res.get_resname() not in [AMINO_ACIDS.keys(), *Nucleotides
                                     ] and res not in self.ligands:
            self.ligands.append(res)

        if parentStrand not in self.adjacentRnaStrands and parentStrand not in self.adjacentRPStrands:

            response = _neoget("""
            match (n {{entity_poly_strand_id:"{parentStrand}"}})-[]-(r:RibosomeStructure{{rcsb_id:"{pdbid}"}}) \
            return {{type: n.entity_poly_polymer_type, nomenclature:n.nomenclature}};"""
                               .format_map({
                                   "parentStrand": parentStrand,
                                   "pdbid": self.pdbid
                               }))

            try:
                profile = response[0]
                if profile['type'] == 'RNA':
                    self.adjacentRnaStrands.append(parentStrand)
                    self.rna[parentStrand] = []

                if profile['type'] == 'Protein':
                    self.adjacentRPStrands.append(parentStrand)
                    self.rps[parentStrand] = []
                    self.nomenclatureMap[parentStrand] = profile[
                        'nomenclature']
            except:
                pass
        if parentStrand in self.adjacentRnaStrands:
            if res in self.rna[parentStrand]:
                None
            else:
                self.rna[parentStrand].append(res)
        elif parentStrand in self.adjacentRPStrands:
            if res in self.rps[parentStrand]:
                None
            else:
                self.rps[parentStrand].append(res)
        print("added residue")
        self.rescount += 1
Example #7
0
def makeResidueTuple(res:Residue)->Tuple[ str, int, NDArray[3] ]: 
    ac     : Atom       = get_alpha_carbon(res)
    coords : NDArray[3] = ac.get_coord()
    resi   : int        = res.get_id()
    resn   : str        = res.get_resname()
    return tuple(( resn, resi, coords ))
def res_full_id(res: Residue):
    """Return full residue identifier for thoroughly comparing residues."""
    return (res.get_resname(), *res.get_id())