forgi 2.0.0 documentation

«  forgi.threedee.utilities.my_math module   ::   Contents   ::   forgi.threedee.utilities.vector module  »

forgi.threedee.utilities.pdb module

class forgi.threedee.utilities.pdb.AtomName[source]

Bases: str

Like a string, but “C1’” and “C1*” compare equal

forgi.threedee.utilities.pdb.annotate_fallback(chain_list)[source]

If neither DSSR nor MC-Annotate are available, we use an ad-hoc implementation of canonical basepair detection as fallback. This does not work well for missing atoms or modified residues.

forgi.threedee.utilities.pdb.clean_chain(chain, query_PDBeChem=False)[source]

Clean a pdb chain for further use with forgi.

It will be modified so that all hetatms are removed, modified residues will be renamed to regular residues, residue ids will be positive integers, …

Parameters:
  • chain – A Bio.PDB.Chain object
  • query_PDBeChem – If true, query the PDBeChem database whenever a modified residue with unknown 3-letter code is encountered.
Returns:

A modified version of this chain

forgi.threedee.utilities.pdb.contains_rna(chain)[source]

Determine if a Bio.PDB.Chain structure corresponds to an RNA molecule.

Parameters:chain – A Bio.PDB.Chain molecule
Returns:True if it is an RNA molecule, False if at least one residue is not an RNA.
forgi.threedee.utilities.pdb.enumerate_interactions_kdtree(model)[source]
forgi.threedee.utilities.pdb.extract_subchains_from_seq_ids(all_chains, seq_ids)[source]

Extract a portion of one or more pdb chains. Creates a list of new chains which contain only the specified residues copied from the original chain.

The chain ids are not modified.

Parameters:
  • all_chains – A dictionary {chainid:chains}.
  • seq_ids – An iterable of complete RESIDS.
Returns:

A dictionary chain-id:Bio.PDB.Chain.Chain objects

forgi.threedee.utilities.pdb.get_all_chains(in_filename, parser=None, no_annotation=False, assembly_nr=None)[source]

Load the PDB file located at filename, read all chains and return them.

Parameters:
  • in_filename – The location of the original file.
  • assembly_nr – Which assembly to return. Default: The first.
Returns:

a tuple chains, missing_residues

  • chains: A list of Bio.PDB chain structures corresponding to all
    RNA structures stored in in_filename
  • missing_residues: A list of dictionaries, describing the missing residues.
  • interacting residues: A list of residues

forgi.threedee.utilities.pdb.get_biggest_chain(in_filename, parser=None)[source]

Load the PDB file located at filename, select the longest chain and return it.

Parameters:in_filename – The location of the original file.
Returns:A Bio.PDB chain structure corresponding to the longest chain in the structure stored in in_filename
forgi.threedee.utilities.pdb.get_first_chain(filename)[source]

Load a PDB file using the Bio.PDB module and return the first chain.

Parameters:filename – The path to the pdb file
forgi.threedee.utilities.pdb.get_particular_chain(in_filename, chain_id, parser=None)[source]

Load a PDB file and return a particular chain.

Parameters:
  • in_filename – The name of the pdb file.
  • chain_id – The id of the chain.
Returns:

A Bio.PDB.Chain object containing that particular chain.

forgi.threedee.utilities.pdb.interchain_contacts(struct)[source]
forgi.threedee.utilities.pdb.is_almost_coplanar(*points)[source]
forgi.threedee.utilities.pdb.is_basepair_pair(res1, res2)[source]
forgi.threedee.utilities.pdb.is_covalent(contact)[source]

Determine if a particular contact is covalent.

This does not look at the geometric distance but only at the atom names.

Parameters:contact – A pair of two Atom objects
Returns:True if they are covalently bonded False otherwise
forgi.threedee.utilities.pdb.is_protein(chain)[source]

Determine if a Bio.PDB.Chain structure corresponds to an protein molecule.

Parameters:chain – A Bio.PDB.Chain molecule
Returns:True if it is a protein molecule, False otherwise
forgi.threedee.utilities.pdb.load_structure(pdb_filename)[source]

Load a Bio.PDB.Structure object and return the largest chain. This chain will be modified so that all hetatms are removed, modified residues will be renamed to regular residues, etc…

forgi.threedee.utilities.pdb.noncovalent_distances(chain, cutoff=0.3)[source]

Print out the distances between all non-covalently bonded atoms which are closer than cutoff to each other.

Parameters:
  • chain – The Bio.PDB chain.
  • cutoff – The maximum distance
forgi.threedee.utilities.pdb.num_noncovalent_clashes(chain)[source]

Check if a chain has non-covalent clashes. Non-covalent clashes are found when two atoms that aren’t covalently linked are within 1.8 A of each other.

Parameters:
  • chain – The chain to evaluate
  • return – The number of non-covalent clashes.
forgi.threedee.utilities.pdb.output_chain(chain, filename, fr=None, to=None)[source]

Dump a chain to an output file. Remove the hydrogen atoms.

Parameters:
  • chain – The Bio.PDB.Chain to dump.
  • filename – The place to dump it.
forgi.threedee.utilities.pdb.output_multiple_chains(chains, filename, file_type=u'pdb')[source]

Dump multiple chains to an output file. Remove the hydrogen atoms.

Parameters:
  • chains – An iterable of Bio.PDB.Chain to dump.
  • filename – The place to dump it.
forgi.threedee.utilities.pdb.pdb_file_rmsd(fn1, fn2)[source]

Calculate the RMSD of all the atoms in two pdb structures.

Parameters:
  • fn1 – The first filename.
  • fn2 – The second filename.
Returns:

The rmsd between the two structures.

forgi.threedee.utilities.pdb.pdb_rmsd(c1, c2, sidechains=False, superimpose=True)[source]

Calculate the all-atom rmsd between two RNA chains.

Parameters:
  • c1 – A Bio.PDB.Chain
  • c2 – Another Bio.PDB.Chain
Returns:

The rmsd between the locations of all the atoms in the chains.

forgi.threedee.utilities.pdb.remove_disordered(chain)[source]
forgi.threedee.utilities.pdb.rename_rosetta_atoms(chain)[source]

Rosetta names all the backbone atoms with an asterisk rather than an apostrophe. All that needs to be reversed.

:param chain. A Bio.PDB.Chain structure generated by Rosetta :return: The same chain with renamed atoms

forgi.threedee.utilities.pdb.renumber_chain(chain, resids=None)[source]

Renumber all the residues in this chain so that they start at 1 and end at len(chain)

Parameters:chain – A Bio.PDB.Chain object
Returns:The same chain, but with renamed nucleotides
forgi.threedee.utilities.pdb.residuelist_rmsd(c1_list, c2_list, sidechains=False, superimpose=True)[source]
forgi.threedee.utilities.pdb.trim_chain_between(chain, start_res, end_res)[source]

Remove all nucleotides between start_res and end_res, inclusive.

The chain is modified in place so there is no return value.

«  forgi.threedee.utilities.my_math module   ::   Contents   ::   forgi.threedee.utilities.vector module  »