def get_formatter(): try: return argparse.RawTextHelpFormatter( prog=sys.argv[0], max_help_position=40) except: return argparse.RawTextHelpFormatter(prog=sys.argv[0])
def launch(): if os.name == "nt" and sys.platform != "cygwin": __name__ = "__main__" parser = argparse.ArgumentParser(description="version " + __version__, prog="almonds", formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, max_help_position=45)) parser.add_argument("save", nargs="?", type=str, default=None, help="path of a save to load") parser.add_argument("-p", "--processes", type=int, metavar="N", default=multiprocessing.cpu_count(), help="number of concurrent processes") group = parser.add_mutually_exclusive_group() group.add_argument("-r", "--char-ratio", type=float, default=0.428, metavar="RATIO", help="width to height ratio of the terminal characters") group.add_argument("-d", "--dimensions", type=int, nargs=2, metavar=("W", "H"), help="width and height of the terminal characters") parser.add_argument("-z", "--qwertz", action="store_true", default=False, help='swap the "z" and "y" keys') parser.print_help = wrap_prolog(parser.print_help, "\n".join(splash)) parser.print_usage = wrap_prolog(parser.print_usage, "") args = parser.parse_args() ratio = args.char_ratio if args.dimensions is not None: ratio = args.dimensions[0] / args.dimensions[1] pool = multiprocessing.Pool(args.processes) main(pool, ratio, args.qwertz, args.save)
def main(): parser = argparse.ArgumentParser( description= 'Parses the AMBER (sander) minimization output file (log) and dumps statistics that can then be plotted. Using the process_minout.pl tool from the AmberTools MD package.', formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_log_path', required=True, help= 'AMBER (sander) minimization output (log) file. Accepted formats: log, out, txt, o.' ) required_args.add_argument( '--output_dat_path', required=True, help= 'Dat output file containing data from the specified terms along the minimization process. File type: output. Accepted formats: dat, txt, csv.' ) args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call process_minout(input_log_path=args.input_log_path, output_dat_path=args.output_dat_path, properties=properties)
def get_args(args): program = "ledgerbil/main.py port" description = dedent("""\ Portfolio! This is currently independent of ledger data although eventually some integration would be swell. Uses a json data file to give you a simple yearly view of your investing portfolio. """) parser = argparse.ArgumentParser( prog=program, description=description, formatter_class=(lambda prog: argparse.RawTextHelpFormatter( prog, max_help_position=40, width=71)), ) parser.add_argument( "-a", "--accounts", type=str, metavar="REGEX", dest="accounts_regex", default=".*", help="include accounts that match this regex,\ndefault = .* (all)", ) parser.add_argument( "-L", "--labels", type=str, default="", help="include accounts that match these labels", ) parser.add_argument( "-c", "--compare", action="store_true", help="compare accounts or labels\n(if --labels, will group by labels)", ) parser.add_argument( "-C", "--compare-accounts", action="store_true", help="compare accounts only\n(labels still modifies included accounts)", ) parser.add_argument( "-s", "--sort", type=str, default="a", help="sort comparison report by:\n\tv (alue)\n\tg (ain value)\n\t" "y (ears)\n\ta (ll years gain) default\n\t1 (year gain)\n\t" "3 (year gain)\n\t5 (year gain)\n\t10 (year gain)", ) parser.add_argument("-H", "--history", action="store_true", help="show account history") parser.add_argument("-l", "--list", action="store_true", help="list account names and labels") return parser.parse_args(args)
def main(): # pragma: no cover import argparse p = argparse.ArgumentParser( epilog=''' - sqlite3 promnesia.sqlite 'select distinct orig_url from visits' | cannon.py --domains - running comparison sqlite3 promnesia.sqlite 'select distinct orig_url from visits where norm_url like "%twitter%" order by orig_url' | src/promnesia/cannon.py ''', formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=100) # type: ignore ) p.add_argument('input', nargs='?') p.add_argument('--human', action='store_true') p.add_argument('--groups', action='store_true') p.add_argument('--domains', action='store_true', help='useful for counting number of URLs by domains') args = p.parse_args() it: Iterable[str] if args.input is None: import sys it = sys.stdin else: it = [args.input] if args.groups: groups(it, args) if args.domains: domains(it) else: display(it, args)
def main(): parser = argparse.ArgumentParser( description="Flip the clashing amide groups to avoid clashes.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument('-i', '--input_pdb_path', required=True, help="Input PDB file name") required_args.add_argument('-o', '--output_pdb_path', required=True, help="Output PDB file name") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block fix_amides(input_pdb_path=args.input_pdb_path, output_pdb_path=args.output_pdb_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Extracts energy components from a given GROMACS energy file.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') #Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_energy_path', required=True, help='Path to the input EDR file. Accepted formats: edr.') required_args.add_argument( '--output_xvg_path', required=True, help='Path to the XVG output file. Accepted formats: xvg.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() #Specific call of each building block gmx_energy(input_energy_path=args.input_energy_path, output_xvg_path=args.output_xvg_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Generates a correlation matrix from a given dataset", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_dataset_path', required=True, help='Path to the input dataset. Accepted formats: csv.') required_args.add_argument( '--output_plot_path', required=True, help='Path to the correlation matrix plot. Accepted formats: png.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block correlation_matrix(input_dataset_path=args.input_dataset_path, output_plot_path=args.output_plot_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "This class is a wrapper for downloading a MMCIF structure from the Protein Data Bank.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '-o', '--output_mmcif_path', required=True, help="Path to the output MMCIF file. Accepted formats: cif, mmcif.") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block mmcif(output_mmcif_path=args.output_mmcif_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Wrapper for the Protein Data Bank in Europe (https://www.ebi.ac.uk/pdbe/) and the MMB PDB mirror (http://mmb.irbbarcelona.org/api/) for downloading a single PDB ligand.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") #Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '-o', '--output_pdb_path', required=True, help="Path to the output PDB ligand file. Accepted formats: pdb.") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() #Specific call of each building block ligand(output_pdb_path=args.output_pdb_path, properties=properties)
def formatter(prog: str) -> argparse.RawTextHelpFormatter: """ This method format the text of the different parsers. """ return argparse.RawTextHelpFormatter(prog, max_help_position=100, width=100)
def Parser(*args, **kwargs) -> argparse.ArgumentParser: # just more reasonable default for literate usage return argparse.ArgumentParser( # type: ignore[misc] *args, formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=100), # type: ignore **kwargs, )
def main(): parser = argparse.ArgumentParser( description= "Check the errors of a PDB structure and create a report log file.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument('-i', '--input_pdb_path', required=True, help="Input PDB file name") required_args.add_argument('-o', '--output_log_path', required=True, help="Output log file name") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block checking_log(input_pdb_path=args.input_pdb_path, output_log_path=args.output_log_path, properties=properties)
def main(): parser = argparse.ArgumentParser( description="Superimposer for two pdb structures.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) required_args = parser.add_argument_group('required arguments') required_args.add_argument('-r', '--reference', required=True, help='Path for the reference pdb file') required_args.add_argument('-s', '--sample', required=True, help="Path for the sample pdb file") required_args.add_argument( '-t', '--type', required=True, help="Type of superimposition. Accepted values: structure, ligand") required_args.add_argument('-o', '--output', required=True, help="Path for the output pdb file") args = parser.parse_args() Superimposer(reference=args.reference, sample=args.sample, type=args.type, output=args.output).launch()
def parse_args(): """Parse command line arguments """ parser = MNGArgumentParser( description=MNG_CLI_MESSAGE, formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, max_help_position=52), epilog=EXAMPLE_USAGE) # -- add subparsers subparsers = parser.add_subparsers( dest='command', metavar='COMMAND', help=('O comando está relacionado a um item do sistema, \n' '\tselecione um da listagem a baixo e em seguida \n' '\tescolha uma operação.\n')) subparsers.required = True setup_init(subparsers) setup_configure(subparsers) setup_charts(subparsers) setup_note(subparsers) setup_comment(subparsers) setup_environment(subparsers) setup_host(subparsers) setup_instance(subparsers) setup_service(subparsers) # -- parse args and pre-process if needed return parser.parse_args()
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Sets the center and the size of a rectangular parallelepiped box around a set of residues from a given PDB or a pocket from a given PQR.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_pdb_path', required=True, help= 'PDB file containing a selection of residue numbers or PQR file containing the pocket. Accepted formats: pdb, pqr.' ) required_args.add_argument( '--output_pdb_path', required=True, help= 'PDB including the annotation of the box center and size as REMARKs. Accepted formats: pdb.' ) args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block box(input_pdb_path=args.input_pdb_path, output_pdb_path=args.output_pdb_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Wrapper for the MemProtMD DB REST API (http://memprotmd.bioch.ox.ac.uk/) to download a simulation.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '-o', '--output_simulation', required=True, help= "Path to the output simulation in a ZIP file. Accepted formats: zip.") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block memprotmd_sim(output_simulation=args.output_simulation, properties=properties)
def main(): if not sys.version_info >= (3, 6): sys.exit("ERROR: rsp needs Python 3.6 or later.") if not len(sys.argv) > 1: print("rsp: RoboSat.pink command line tools") print("") print("Usages:") print("rsp -h, --help show tools availables") print("rsp <tool> -h, --help show options availables for a tool") print("rsp <tool> [...] launch an rsp tool command") sys.exit() tools = [ os.path.basename(tool)[:-3] for tool in glob.glob( os.path.join(os.path.dirname(__file__), "[a-z]*.py")) ] tools = [sys.argv[1]] if sys.argv[1] in tools else tools os.environ["COLUMNS"] = str(shutil.get_terminal_size().columns ) # cf https://bugs.python.org/issue13041 fc = lambda prog: argparse.RawTextHelpFormatter( prog, max_help_position=40, indent_increment=1) # noqa: E731 parser = argparse.ArgumentParser(prog="rsp", formatter_class=fc) subparser = parser.add_subparsers(title="RoboSat.pink tools", metavar="") for tool in tools: module = import_module("robosat_pink.tools.{}".format(tool)) module.add_parser(subparser, formatter_class=fc) args = parser.parse_args() args.func(args)
def main(): parser = argparse.ArgumentParser( description="Wrapper for the GROMACS solvate module.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument('--input_solute_gro_path', required=True) required_args.add_argument('--output_gro_path', required=True) required_args.add_argument('--input_top_zip_path', required=True) required_args.add_argument('--output_top_zip_path', required=True) args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block Solvate(input_solute_gro_path=args.input_solute_gro_path, output_gro_path=args.output_gro_path, input_top_zip_path=args.input_top_zip_path, output_top_zip_path=args.output_top_zip_path, properties=properties).launch()
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Sets the center and the size of a rectangular parallelepiped box around a selection of residues found in a given PDB.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_pdb_path', required=True, help= 'PDB protein structure for which the box will be build. Its size and center will be set around the \'resid_list\' property once mapped against this PDB. Accepted formats: pdb.' ) required_args.add_argument( '--output_pdb_path', required=True, help= 'PDB including the annotation of the box center and size as REMARKs. Accepted formats: pdb.' ) args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block box_residues(input_pdb_path=args.input_pdb_path, output_pdb_path=args.output_pdb_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Wrapper of the scikit-learn SpectralClustering method.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_dataset_path', required=True, help='Path to the input dataset. Accepted formats: csv.') required_args.add_argument( '--output_results_path', required=True, help='Path to the clustered dataset. Accepted formats: csv.') parser.add_argument( '--output_plot_path', required=False, help='Path to the clustering plot. Accepted formats: png.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block spectral_clustering(input_dataset_path=args.input_dataset_path, output_results_path=args.output_results_path, output_plot_path=args.output_plot_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Wrapper of the scikit-learn PLSRegression method.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_dataset_path', required=True, help='Path to the input dataset. Accepted formats: csv.') required_args.add_argument( '--output_results_path', required=True, help= 'Table with R2 and MSE for calibration and cross-validation data for the best number of components. Accepted formats: csv.' ) parser.add_argument( '--output_plot_path', required=False, help='Path to the Mean Square Error plot. Accepted formats: png.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block pls_components(input_dataset_path=args.input_dataset_path, output_results_path=args.output_results_path, output_plot_path=args.output_plot_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "This class is a wrapper for the PDBe REST API Binding Sites endpoint", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") #Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '-o', '--output_json_path', required=True, help= "Path to the JSON file with the binding sites for the requested structure. Accepted formats: json." ) args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() #Specific call of each building block api_binding_site(output_json_path=args.output_json_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "Makes predictions from an input dataset and a given classification model.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_model_path', required=True, help='Path to the input model. Accepted formats: pkl.') required_args.add_argument( '--output_results_path', required=True, help='Path to the output results file. Accepted formats: csv.') parser.add_argument( '--input_dataset_path', required=False, help='Path to the dataset to predict. Accepted formats: csv.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block classification_predict(input_model_path=args.input_model_path, output_results_path=args.output_results_path, input_dataset_path=args.input_dataset_path, properties=properties)
def main(): parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.RawTextHelpFormatter(prog, width=200), description="""example: python3 vpc.py -i ak -s sk -r cn-shanghai -a CreateVpc --cidr-block "10.0.0.0/8" --vpc-name imm-dev-hl-vpc-bc python3 vpc.py -i ak -s sk -r cn-shanghai -a DescribeVpcs --vpc-name imm-dev-hl-vpc-shanghai-ecs """) parser.add_argument("-i", "--access-key-id", help="access key id") parser.add_argument("-s", "--access-key-secret", help="access key secret") parser.add_argument("-c", "--credential", help="credential file") parser.add_argument("-r", "--region-id", help="region id") parser.add_argument("--vpc-id", help="vpc id") parser.add_argument("--vpc-name", help="vpc name") parser.add_argument("--cidr-block", help="cidr block") parser.add_argument("--vswitch-name", help="vswitch name") parser.add_argument("--description", default="create by vpc.py", help="description") parser.add_argument("-a", "--action", help="action", choices=[ "CreateVpc", "DescribeVpcs", "DescribeVSwitches" ]) args = parser.parse_args() if args.credential: args.access_key_id, args.access_key_secret = aksk.load_from_file(args.credential) config = open_api_models.Config( access_key_id=args.access_key_id, access_key_secret=args.access_key_secret, region_id=args.region_id, ) if args.action == "CreateVpc": print(json.dumps(create_vpc(config, args.region_id, args.vpc_name, args.cidr_block, args.description))) elif args.action == "DescribeVpcs": print(json.dumps(describe_vpcs(config, args.region_id, args.vpc_id, args.vpc_name))) elif args.action == "DescribeVSwitches": print(json.dumps(describe_vswitches(config, args.region_id, args.vpc_id, args.vpc_name, args.vswitch_name))) else: parser.print_help()
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Adds hydrogen atoms to small molecules.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument('--config', required=False, help='Configuration file') # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '--input_path', required=True, help='Path to the input file. Accepted formats: pdb.') required_args.add_argument( '--output_path', required=True, help='Path to the output file. Accepted formats: pdb.') args = parser.parse_args() args.config = args.config or "{}" properties = settings.ConfReader(config=args.config).get_prop_dic() # Specific call of each building block reduce_add_hydrogens(input_path=args.input_path, output_path=args.output_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Remove the selected ligand atoms from a 3D structure.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument('-i', '--input_structure_path', required=True, help="Input structure file name") required_args.add_argument('-o', '--output_structure_path', required=True, help="Output structure file name") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block extract_atoms(input_structure_path=args.input_structure_path, output_structure_path=args.output_structure_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description= "This class is a wrapper of the Structure Checking tool to generate summary checking results on a json file.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument( '-i', '--input_structure_path', required=True, help="Input structure file path. Accepted formats: pdb.") required_args.add_argument( '-o', '--output_summary_path', required=True, help="Output summary checking results. Accepted formats: json.") args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block structure_check(input_structure_path=args.input_structure_path, output_summary_path=args.output_summary_path, properties=properties)
def main(): """Command line execution of this building block. Please check the command line documentation.""" parser = argparse.ArgumentParser( description="Wrapper for the GROMACS make_ndx module.", formatter_class=lambda prog: argparse.RawTextHelpFormatter( prog, width=99999)) parser.add_argument( '-c', '--config', required=False, help="This file can be a YAML file, JSON file or JSON string") # Specific args of each building block required_args = parser.add_argument_group('required arguments') required_args.add_argument('--input_structure_path', required=True) required_args.add_argument('--output_ndx_path', required=True) parser.add_argument('--input_ndx_path', required=False) args = parser.parse_args() config = args.config if args.config else None properties = settings.ConfReader(config=config).get_prop_dic() # Specific call of each building block make_ndx(input_structure_path=args.input_structure_path, output_ndx_path=args.output_ndx_path, input_ndx_path=args.input_ndx_path, properties=properties)
def main(): ''' Find the yaml file of arguments ''' import yaml import argparse import sys arg_formatter = lambda prog: argparse.RawTextHelpFormatter(prog, max_help_position=4, width = 80) parser = argparse.ArgumentParser( formatter_class= arg_formatter, description='Seq2Geno2Pheno: the pipline tool ' 'for genomic features computation and phenotype predictor ' 'training') parser.add_argument('-v', action= 'version', version='v.Beta') parser.add_argument('-d', dest= 'dsply_args', action= 'store_true', help= 'display the arguments in yaml and exit') parser.add_argument('-f', dest= 'yml_f', required= True, help= 'the yaml file where the arguments are listed') primary_args= parser.parse_args() args= read_options(primary_args.yml_f, primary_args.dsply_args) return(args)