def _get_pdb_sequence(structure): """ Retrieves the AA sequence from a PDB structure. """ _aainfo = lambda r: (r.id[1], aa3to1.get(r.resname, 'X')) seq = map(_aainfo, structure.get_residues()) return seq
def get_pdb_sequence(structure): """ Retrieves the AA sequence from a PDB structure. """ _aainfo = lambda r: (r.id[1], aa3to1.get(r.resname, 'X')) seq = [_aainfo(r) for r in structure.get_residues() if is_aa(r)] return seq
def get_pdb_sequence_with_chains(structure): """ Retrieves the AA sequence from a PDB structure. It's a list that looks like [(5, 'R', 'A'), (6, 'E', 'A'), (7, 'H', 'A'), (8, 'W', 'A'),...] """ _aainfo = lambda r: (r.id[1], aa3to1.get(r.resname, 'X'),r.get_parent().get_id(),r.id[0],r.id[2]) seq = [_aainfo(r) for r in structure.get_residues() if (is_aa(r) and r.has_id('CA'))] return seq
def get_pdb_sequence(structure): """ Retrieves the AA sequence from a PDB structure. """ aa = lambda r: (r.id[1], prot_one_letter.get(r.resname, 'X')) seq = [] for r in structure.get_residues(): if Bio.PDB.Polypeptide.is_aa(r): seq.append(aa(r)) return seq
def get_sequence(self, chain_id): ''' Input: self: Use Biopython.PDB structure which has been stored in an object variable chain_id : String (usually in ['A','B', 'C' ...]. The number of chains depends on the specific protein and the resulting structure) Return: Return the amino acid sequence (single-letter alphabet!) of a given chain (chain_id) in a Biopython.PDB structure as a string. ''' for model in self.structure: if chain_id in model: chain = model[chain_id] sequence = "" for residue in chain.get_list(): nom = aa3to1.get(residue.get_resname()) if nom != None: sequence += nom return sequence