def arguments(): d = """ Calculate coordination number between molecules. Examples: Caculate the coordination number between two parts in a system only considering non hydrogen atoms gmx_coordnum.py -f test_traj_dt1ns.xtc -s reference.pdb -o coordnum -rc " " 1 41 -lc " " 42 137 -atomtype heavy heavy -dt 4 """ parser = gmxcli.GromacsCommanLine(d=d) parser.arguments() parser.parser.add_argument( "-rc", type=str, default=[], nargs="+", help="Input, optional. \n" "The chain identifier, start res index, end res index. ") parser.parser.add_argument( "-lc", type=str, default=[], nargs="+", help="Input, optional. \n" "The chain identifier, start res index, end res index. ") parser.parser.add_argument( "-atomtype", type=str, default=[], nargs="+", help="Input, optional. \n" "The atomtype used for contact calculation. Options: mainchain, sidechain, \n" "heavy, CA. ") parser.parser.add_argument( "-cutoff", type=float, default=0.5, help="Input, optional. Default = 0.5 \n" "The distance cutoff for coordination number calculation. \n" "Unit is nanometer.") parser.parser.add_argument("-byres", type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. Default = False. \n" "Computate contact number per residue. ") parser.parse_arguments() args = parser.args return args
def arguments(): """Parse the gmx-style command arguments for angle calculations. Returns ------- args: Argparser object, the argparse object holding the arguement information """ d = """ Calculate time-series angles using a xtc trajectory. This function is simply designed to simulation gmx angle module, but provide a direct and easy way to save the result. Examples: Print help information gmx_angles.py -h Calculate angles gmx_angles.py -f traj.xtc -n index.ndx -s reference.pdb -o angles.csv -type angle -dt 10 -cos 0 Calculate dihedral angles gmx_angles.py -f traj.xtc -n index.ndx -s reference.pdb -o dihedral_angles.csv -type dihedral -dt 10 -cos 0 """ parser = gmxcli.GromacsCommanLine(d) parser.arguments() parser.parser.add_argument("-type", type=str, default="angle", help="Input, optional. \n" "The angle type for calculation. Options are \n" "angle, dihedral. Default is angle. ") parser.parser.add_argument("-cos", type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. \n" "Calculate the cosine values of the angles.\n" "Options are True, False. Default is False. ") parser.parser.add_argument("-sin", type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. \n" "Calculate the sine values of the angles.\n" "Options are True, False. Default is False. ") parser.parse_arguments() args = parser.args return args
def arguments(): d = """ """ parser = gmxcli.GromacsCommanLine(d=d) parser.arguments() parser.parser.add_argument("-res", default=[1, 5], type=int, nargs="+", help="Input, optional. \n" "The input residue start and end. \n") parser.parse_arguments() return parser.args
def arguements(self): """Argument Parser Returns ------- args: ArgParser object """ d = ''' ################################################################ # Generate GMX Index from a PDB file # # Generate POSRES file for a PDB File # # Contact Zheng Liangzhen, [email protected] # # Version 2.3 # # Update Dec 26, 2018 # ################################################################ Usage examples: Generate backbone index for residue 1 to 1000 within Chain B gmx_index -f reference.pdb -res 1 100 -at backbone -chain B -o index.ndx Generate all atom index for residue 78 to 100 gmx_index -f reference.pdb -o index.ndx -at allatom -chain ' ' -res 78 100 Generate dihedral (PHI only) quadroplex index gmx_index -f input.pdb -o index.ndx -at dihedral -chain ' ' -res 78 100 -dihe PHI Note: The -s option is not used. So if you provide a -s reference.pdb, nothing will be affected. ''' parser = gmxcli.GromacsCommanLine(d=d) parser.arguments() parser.parser.add_argument( '-at', type=str, default='allatom', help="Selected atom type for generating index. \n" "Options including: allatom, mainchain, \n" "non-hydrogen, c-alpha, backbone, sidechain, dihedral\n" "Default choice is: allatom \n") parser.parser.add_argument( '-an', type=str, default=[], nargs='+', help="Select atom by atom names. A list of atom names \n" "could be supplied. If not given, all atom names are \n" "considered. Default is [].") parser.parser.add_argument( '-chain', type=str, default=["A"], nargs="+", help="Protein chain identifier. Default chain ID is [\'A\',]. ") parser.parser.add_argument( '-res', type=int, nargs='+', default=[1, -1], help="Residue sequence number for index generating. \n" "Example, -res 1 100, generateing atom index within \n" "residues 1 to 100. Default is None.") parser.parser.add_argument( '-posres', default=False, help="Generate a postion restraint file for selected index.\n" "Default name is posres.itp \n") parser.parser.add_argument( '-dihe', default=["NA"], type=str, nargs="+", help="Whether generate dihedral angles index (quadruplex).\n" "Phi and Psi are considered. Optional choices are: \n" "PHI, PSI, PHI_PSI, or NA. Default is NA. \n") parser.parser.add_argument( '-gn', type=str, default=None, help="The name of the group of atoms selected. \n" "Default is None.") parser.parser.add_argument( '-append', default=True, type=bool, help="Append the group of index to the output file. \n" "Options: True, False. \n" "Default is True.") parser.parse_arguments() args = parser.args # decide to print help message if len(sys.argv) < 3: # no enough arguments, exit now parser.parser.print_help() print( "\nYou chose non of the arguement!\nDo nothing and exit now!\n" ) sys.exit(1) return args
#!/usr/bin/env python from automd import gentop, fixpdb from mdanaly import gmxcli import sys, os if __name__ == "__main__": d = """ Generate gromacs style toplogy files from pdb files. """ parser = gmxcli.GromacsCommanLine(d=d) parser.arguments() parser.parser.add_argument("-p", type=str, default="topol.top", help="Output, optional. Output format: .top \n" "The output file name of the generated gromacs \n" "style topology files. ") parser.parser.add_argument("-ff", type=str, default=["gaff", ], nargs="+", help="Output, optional. Output format: .top \n" "The output file name of the generated gromacs \n" "style topology files. ") parser.parser.add_argument("-amberhome", type=str, default="/usr/local/amber/", help="Input, optional. \n" "The AMBERHOME environment for topology generation. \n") parser.parser.add_argument("-addH", type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. Default is False. \n" "Whether add hydrogens before generating gmx topologies. \n") parser.parser.add_argument("-cplx", type=lambda x: (str(x).lower() == "true"), default=False,
def arguments(d="Descriptions."): """prepare gmx-style argument for pca calculation Parameters ---------- d : str, the description string of the module Returns ------- args : Argparser object, the argument parser object """ parser = gmxcli.GromacsCommanLine(d=d) parser.arguments() parser.parser.add_argument("-mode", type=str, default="general", help="Input, optional. Default is general. \n" "The PCA calculation mode. \n" "Options: general, xyz, cmap, dihedral \n" "general: perform general PCA using a well formated dataset file. \n" "xyz: perform xyz coordinate PCA analysis using a trajectory xtc file. \n" "cmap: perform contact map PCA analysis using a trajectory xtc file. \n" "dihedral: perform dihedral PCA calculation using a trajectory xtc file. \n") parser.parser.add_argument("-cutoff", default=0.5, type=float, help="Input, optional, it works with mode =cmap. Default is 0.5. \n" "The distance cutoff for contactmap calculation. Unit is nanometer.\n") parser.parser.add_argument("-proj", type=int, default=2, help="Input, optional. Default is 2.\n" "How many number of dimensions to output. \n") parser.parser.add_argument("-select", type=str, default="CA CA", help="Input, optional, it works with mode = xyz or cmap \n" "Atom selected for PCA calculation. \n" "Default is CA CA.") parser.parser.add_argument("-switch", type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. Working with mode == cmap. Default is False. \n" "Apply a swithc function to transform the distance-based contact \n" "to enable a smooth transition and avoid numeric artifacts. ") parser.parser.add_argument("-var_ratio", type=str, default="explained_variance_ratio.dat", help="Output, optional. Default is explained_variance_ratio.dat. \n" "Output file name containing explained eigen values variance ratio. \n") parser.parser.add_argument("-skip_index", type=lambda x: (str(x).lower() == "true"), default=True, help="Input, optional. Working with mode == general. Default is True. \n" "Generally, there would be an index column in the input file, choose\n" "to whether skip the index column. ") parser.parser.add_argument("-eigvect", type=str, default="", help="Output, optional. Default is empty. \n" "The output eigvector file name. It is only useful when \n" "you want to create ensemble of essential dynamics PDB files to generate\n" "a movie based on XYZ coordinates PCA. \n") parser.parser.add_argument("-scale_method", type=str, default="NA", help="Input, optional. Default is NA. \n" "Whether scale the dataset before perform PCA calculation. \n" "NA: do not scale dataset. \n" "minmax: min-max scale \n" "zscore: z-standardization \n" "mean: substract mean values \n") parser.parse_arguments() args = parser.args return args
def arguments(): parser = gmxcli.GromacsCommanLine(d=descriptions()) parser.arguments() parser.parser.add_argument( '-rc', type=str, nargs='+', default=['A', '1', '250'], help="Input, optional. \n" "The receptor chains and residue index for Cmap construction.\n" "You must enter a chain name, start residue index, and end chain index.\n" "Default is: A 1 250 \n") parser.parser.add_argument( '-lc', type=str, nargs='+', default=['A', '1', '250'], help="Input, optional. \n" "The ligand chains and residue index for Cmap construction.\n" "You must enter a chain name, start residue index, and end chain index.\n" "Default is: A 1 250 \n") parser.parser.add_argument( '-cutoff', type=float, default=0.35, help="Input, optional. Default is 0.35 (nanometer). \n" "Distance Cutoff for determining contacts. \n") parser.parser.add_argument( '-atomtype', type=str, nargs='+', default=[], help="Input, optional. \n" "Atom types for Receptor and Ligand in Contact Map Calculation. \n" "Only selected atoms will be considered.\n" "Options: CA, Backbone, MainChain, All, non-H(All-H), lig-all. \n" "CA, alpha-carbon atoms. Backbone, backbone atoms in peptides. \n" "MainChain, including CA and N atoms. All, means all atoms.\n" "non-H, non-hydrogen atoms, all the heavy atoms. \n" "lig-all trys to consider all the atoms of a ligand (H atoms not considered). \n" "Two choices should be provided for receptor and ligand respectively. \n" "If only one atomtype given, the 2nd will be the same as 1st.\n" "Default is: [] \n") parser.parser.add_argument('-atomname1', type=str, nargs='+', default=[], help="Input, optional. \n" "Atom names for Recetpor in Contact Map. \n" "Default is []. ") parser.parser.add_argument('-atomname2', type=str, nargs='+', default=[], help="Input, optional. \n" "Atom names for Ligand in Contact Map. \n" "Default is []. ") parser.parser.add_argument( '-eletype', type=str, nargs="+", default=[], help="Input, optional. \n" "Choose the specific elements for atom indexing to construct the cmap.\n" "Default is [].\n") parser.parser.add_argument( '-switch', type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. Default is False. \n" "Apply a switch function for determing Ca-Ca contacts for a smooth transition. \n" "Only work with atomtype as CA. \n") parser.parser.add_argument( '-NbyN', type=lambda x: (str(x).lower() == "true"), default=False, help="Input, optional. Default is False\n" "For community analysis, calculate atom contact number, normalized. \n" ) parser.parser.add_argument( '-details', default=None, type=str, help="Provide detail contact information and write out to a file. \n" "Default is None.") parser.parser.add_argument( '-opt', default="TS", type=str, help="Optional setting controls. Default is A. \n" "Average, calculating the average cmap along the simulations.\n" "Separated, create time series contact map, suitable for ligand \n" "protein contact information along time.\n" "Options: S(Separated), A(Average).\n") parser.parse_arguments() return parser.args