return 1.4 elif atom.mass == 32.06 : return 1.85 else : return 2.0 if __name__ == "__main__": parser = argparse.ArgumentParser(description="Program make a PQR file") parser.add_argument('-f','--file',help="the input gro-file") parser.add_argument('-p','--topol',help="the topology file") parser.add_argument('-o','--out',help="the output pqr-file",default="conv.pqr") parser.add_argument('-m','--mol',nargs="+",help="the molecule to write out",default=["protein"]) args = parser.parse_args() ref = gmx.TopFile(args.topol) pdbfile = pdb.PDBFile(args.file) mols = [] for topol_mol in ref.moleculetypes : for argmol in args.mol : if topol_mol.name.lower() == argmol.lower() : mols.append(topol_mol) break natom = sum([len(mol.atoms) for mol in mols]) pdbfile.residues = [res for res in pdbfile.residues if res.atoms[0].serial <= natom] pdbfile.atoms = pdbfile.atoms[:natom] start = 0 for mol in mols :
""" import argparse import math from sgenlib import gmx if __name__ == "__main__": parser = argparse.ArgumentParser( description="Program make Glycam pair params") parser.add_argument('-f', '--file', help="the input top-file") parser.add_argument('-m', '--molecule', help="the molecule name") args = parser.parse_args() reftop = gmx.TopFile(args.file) atypes = {} for atype in reftop.atomtypes: atypes[atype.name] = atype refmol = None for mol in reftop.moleculetypes: if mol.name == args.molecule: refmol = mol break if refmol is None: print "Could not find moleculetype %s. Exit." % args.molecule quit() for pair in refmol.pairs:
'--nreplace', type=int, help="how many POPI molecules to replace") args = parser.parse_args() # Read in a gro-file popimem = pdb.PDBFile() popimem.read(args.file, gro=True) # Read in a template IPC-file ipc_pdb = pdb.PDBFile(filename=args.template) # Read in the z-matrix of the IPC molecule ipc_zmat = [ line.strip().split() for line in open(args.zmat, "r").readlines() ] # Read in the atom order of the IPC itp-file ipctop = gmx.TopFile(args.itp) ipc_atomlist = [atom.name for atom in ipctop.moleculetypes[0].atoms] nreplace = args.nreplace # Check where the middle of the membrane is midz = popimem.xyz[:, 2].mean() # Hash the IPC atoms ipc_hash = {} for atom in ipc_pdb.atoms: ipc_hash[atom.name.strip()] = atom.xyz # Find POPI residues in lower and upper part of the membrane popires_low = [] popires_upp = [] for residue in popimem.residues:
help="the protein molecule") args = parser.parse_args() # Read a Xrya structure file xray = gpcr_lib.load_xray(args.mol, loadsigma=True) pdb = xray.pdbfile # Remove cholesterols at the end while pdb.residues[-1].resname == "CHOL": for atom in pdb.residues[-1].atoms: pdb.atoms.remove(atom) del pdb.residues[-1] pdb.xyz = np.array([atom.xyz for atom in pdb.atoms]) # Read a Gromacs topology file top = gmx.TopFile(args.top) # Store away all interesting LJ parameter pairs roh_type = "SP1" #"SC1" roh_pairs = [] for p in top.pairtypes: if p.atomi == roh_type or p.atomj == roh_type: roh_pairs.append(p) # Find the protein molecule definition protein_type = None for m in top.moleculetypes: if m.name == "Protein": protein_type = m if protein_type is None: raise Exception("Could not find a protein molecule type") # Check that the given structure is compatible with the found protein force field