moleculekit.readers module#
- moleculekit.readers.ALPHAFOLDread(filename, frame=None, topoloc=None, validateElements=True, uri='https://alphafold.ebi.ac.uk/files/AF-{uniprot}-F1-model_v3.cif')#
- moleculekit.readers.BCIFread(filename, frame=None, topoloc=None, zerowarning=True, uri='https://models.rcsb.org/{pdbid}.bcif.gz', covalentonly=True)#
- moleculekit.readers.BINCOORread(filename, frame=None, topoloc=None)#
- moleculekit.readers.BINPOSread(filename, frame=None, topoloc=None, stride=None, atom_indices=None)#
- moleculekit.readers.CIFread(filename, frame=None, topoloc=None, zerowarning=True, data=None, covalentonly=True)#
- moleculekit.readers.CRDCARDread(filename, frame=None, topoloc=None)#
https://www.charmmtutorial.org/index.php/CHARMM:The_Basics title = * WATER title = * DATE: 4/10/07 4:25:51 CREATED BY USER: USER title = * Number of atoms (NATOM) = 6 Atom number (ATOMNO) = 1 (just an exmaple) Residue number (RESNO) = 1 Residue name (RESName) = TIP3 Atom type (TYPE) = OH2 Coordinate (X) = -1.30910 Coordinate (Y) = -0.25601 Coordinate (Z) = -0.24045 Segment ID (SEGID) = W Residue ID (RESID) = 1 Atom weight (Weighting) = 0.00000
now what that looks like…
WATER
DATE: 4/10/07 4:25:51 CREATED BY USER: USER
6 1 1 TIP3 OH2 -1.30910 -0.25601 -0.24045 W 1 0.00000 2 1 TIP3 H1 -1.85344 0.07163 0.52275 W 1 0.00000 3 1 TIP3 H2 -1.70410 0.16529 -1.04499 W 1 0.00000 4 2 TIP3 OH2 1.37293 0.05498 0.10603 W 2 0.00000 5 2 TIP3 H1 1.65858 -0.85643 0.10318 W 2 0.00000 6 2 TIP3 H2 0.40780 -0.02508 -0.02820 W 2 0.00000
- moleculekit.readers.CRDread(filename, frame=None, topoloc=None)#
- moleculekit.readers.DCDread(filename, frame=None, topoloc=None, stride=None, atom_indices=None)#
- moleculekit.readers.GJFread(filename, frame=None, topoloc=None)#
- moleculekit.readers.GROTOPread(filename, frame=None, topoloc=None)#
- moleculekit.readers.JSONread(filename, frame=None, topoloc=None, stride=None, atom_indices=None)#
- moleculekit.readers.MAEread(fname, frame=None, topoloc=None)#
Reads maestro files.
- Parameters:
fname (str) – .mae file
- Returns:
topo (Topology)
coords (list of lists)
- moleculekit.readers.MDTRAJTOPOread(filename, frame=None, topoloc=None, validateElements=True)#
- moleculekit.readers.MDTRAJread(filename, frame=None, topoloc=None, validateElements=True)#
- moleculekit.readers.MMTFread(filename, frame=None, topoloc=None, validateElements=True)#
- moleculekit.readers.MOL2read(filename, frame=None, topoloc=None, singlemol=True, validateElements=True)#
- class moleculekit.readers.MolFactory#
Bases:
object
This class converts Topology and Trajectory data into Molecule objects
- static construct(topos, trajs, filename, frame, validateElements=True, uniqueBonds=False)#
- moleculekit.readers.NETCDFread(filename, frame=None, topoloc=None, stride=None, atom_indices=None)#
- moleculekit.readers.PDBQTread(filename, frame=None, topoloc=None)#
- moleculekit.readers.PDBread(filename, mode='pdb', frame=None, topoloc=None, validateElements=True, uniqueBonds=True)#
- moleculekit.readers.PREPIread(filename, frame=None, topoloc=None)#
- moleculekit.readers.PRMTOPread(filename, frame=None, topoloc=None, validateElements=True)#
- moleculekit.readers.PSFread(filename, frame=None, topoloc=None, validateElements=True)#
- moleculekit.readers.RTFread(filename, frame=None, topoloc=None)#
- moleculekit.readers.SDFread(filename, frame=None, topoloc=None, mol_idx=None)#
- moleculekit.readers.TRRread(filename, frame=None, topoloc=None, stride=None, atom_indices=None)#
- class moleculekit.readers.Topology(pandasdata=None)#
Bases:
object
- property atominfo#
- fromMolecule(mol)#
- class moleculekit.readers.Trajectory(coords=None, box=None, boxangles=None, fileloc=None, step=None, time=None)#
Bases:
object
- property numFrames#
- moleculekit.readers.XSCread(filename, frame=None, topoloc=None)#
- moleculekit.readers.XTCread(filename, frame=None, topoloc=None)#
- moleculekit.readers.XYZread(filename, frame=None, topoloc=None)#
- moleculekit.readers.box_vectors_to_lengths_and_angles(a, b, c)#
Convert box vectors into the lengths and angles defining the box.
- Parameters:
a (np.ndarray) – the vector defining the first edge of the periodic box (length 3), or an array of this vector in multiple frames, where a[i,:] gives the length 3 array of vector a in each frame of a simulation
b (np.ndarray) – the vector defining the second edge of the periodic box (length 3), or an array of this vector in multiple frames, where b[i,:] gives the length 3 array of vector a in each frame of a simulation
c (np.ndarray) – the vector defining the third edge of the periodic box (length 3), or an array of this vector in multiple frames, where c[i,:] gives the length 3 array of vector a in each frame of a simulation
Examples
>>> a = np.array([2,0,0], dtype=float) >>> b = np.array([0,1,0], dtype=float) >>> c = np.array([0,1,1], dtype=float) >>> l1, l2, l3, alpha, beta, gamma = box_vectors_to_lengths_and_angles(a, b, c) >>> (l1 == 2.0) and (l2 == 1.0) and (l3 == np.sqrt(2)) True >>> np.abs(alpha - 45) < 1e-6 True >>> np.abs(beta - 90.0) < 1e-6 True >>> np.abs(gamma - 90.0) < 1e-6 True
- Returns:
a_length (scalar or np.ndarray) – length of Bravais unit vector a
b_length (scalar or np.ndarray) – length of Bravais unit vector b
c_length (scalar or np.ndarray) – length of Bravais unit vector c
alpha (scalar or np.ndarray) – angle between vectors b and c, in degrees.
beta (scalar or np.ndarray) – angle between vectors c and a, in degrees.
gamma (scalar or np.ndarray) – angle between vectors a and b, in degrees.
- moleculekit.readers.get_raw_data_from_url(pdb_id, reduced=False)#
“ Get the msgpack unpacked data given a PDB id.
- Parameters:
pdb_id – the input PDB id
:return the unpacked data (a dict)
- moleculekit.readers.lengths_and_angles_to_box_vectors(a_length, b_length, c_length, alpha, beta, gamma)#
Convert from the lengths/angles of the unit cell to the box vectors (Bravais vectors). The angles should be in degrees.
- Parameters:
a_length (scalar or np.ndarray) – length of Bravais unit vector a
b_length (scalar or np.ndarray) – length of Bravais unit vector b
c_length (scalar or np.ndarray) – length of Bravais unit vector c
alpha (scalar or np.ndarray) – angle between vectors b and c, in degrees.
beta (scalar or np.ndarray) – angle between vectors c and a, in degrees.
gamma (scalar or np.ndarray) – angle between vectors a and b, in degrees.
- Returns:
a (np.ndarray) – If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
b (np.ndarray) – If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
c (np.ndarray) – If the inputs are scalar, the vectors will one dimesninoal (length 3). If the inputs are one dimension, shape=(n_frames, ), then the output will be (n_frames, 3)
Examples
>>> import numpy as np >>> result = lengths_and_angles_to_box_vectors(1, 1, 1, 90.0, 90.0, 90.0)
Notes
This code is adapted from gyroid, which is licensed under the BSD http://pythonhosted.org/gyroid/_modules/gyroid/unitcell.html
- moleculekit.readers.openFileOrStringIO(strData, mode=None)#
- moleculekit.readers.pdbGuessElementByName(elements, names, onlymissing=True)#
https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html#misalignment which states that elements should be right-aligned in columns 13-14 unless it’s a 4 letter name when it would end up being left-aligned.
- moleculekit.readers.sdf_generator(sdffile)#
Generates Molecule objects from an SDF file