def get_parser(): parser = fuc.get_rna_input_parser('Calculate the RMSD in 2D space between 2 projections of ' 'coarse-grained RNAs.', nargs=2, rna_type="3d", enable_logging=True) parser.add_argument('--directions', nargs=2, type=str, help="The projection directions: e.g. 1.0,1.0,2.4 2.4,0,1", required=True) parser.add_argument('--plot', action="store_true", help="Open a window with a plot of the projections") return parser
def get_parser(): parser = fuc.get_rna_input_parser('Visualize a 3D structure in pymol.', '+', '3d') parser.add_argument('--thin-cylinders', default=None, help='Make coarse_grain RNA thinner') parser.add_argument('--virtual-atoms', default=False, action='store_true', help='Display the virtual atoms') parser.add_argument('--virtual-residues', default=False, action='store_true', help='Display the virtual residues as spheres') parser.add_argument('--only-elements', dest='only_elements', default=None, help='Display only these elements, separated by commas') parser.add_argument('--no-loops', action="store_true", help="Don't display the coarse-grain hairpin loops") parser.add_argument('--longrange', default=False, action='store_true', help="Display long-range interactions") parser.add_argument('--stem-color', default='green', help='The default stem color in coarse-grain drawings') parser.add_argument('--multiloop-color', default='red', help='The default multiloop color in coarse-grain drawings') parser.add_argument('-x', '--text', default=False, action='store_true', help="Add labels indicating the element names to the figure.") parser.add_argument('--labels', type=str, help="Add labels to elements. Expects a comma seperated " "string of element:label, like 'm0:LookHere' to" " display 'LookHere' at the center of 'm0'.") parser.add_argument('--encompassing-stems', default=False, action='store_true', help=argparse.SUPPRESS) # 'Show the big stems that encompass the colinear ones.') parser.add_argument('--sidechain-atoms', default=False, action='store_true', help='Include the sidechain atoms. Automatically enables --virtual-atoms') parser.add_argument('--basis', default=False, action='store_true', help=argparse.SUPPRESS) # Display the second basis vector of each element's coordinate system at its origin") parser.add_argument('--rainbow', default=False, action='store_true', help='Color virtual atoms (if displayed) depending on the nucleotide position.') parser.add_argument('--element-colors', default="", help='Specify a color for certain elements ' '(comma-separated element names or element_name:color)' 'Example: "m1,m2" (makes m1, m2 purple) or ' '"m0:red,m1:green,s0:AA11GG,default:black", ' 'where "AA11GG" is a hex value and "default" addresses all other elements.' ' Warning: colors not understood by PYMOL will be interpreted as black.' ) parser.add_argument('--align', default=False, action='store_true', help='Align the RNAs (if multiple are provided)') parser.add_argument('-o', '--output', default=None, help="Create a picture of the scene and exit", type=str) parser.add_argument('--batch', default=False, action='store_true', help='Start pymol in batch mode') parser.add_argument('--pymol-file', type=str, help=argparse.SUPPRESS) # Store the PYMOL file under this name. WARNING: Do not use .pml as file ending!!! return parser
def generateParser(): parser = fuc.get_rna_input_parser("Extract fragments", nargs="+", rna_type="pdb", enable_logging=True) parser.add_argument( "--fragment-dir", type=str, help= "A directory, where pdb fragments will be stored. If None is given, they will not be stored." ) return parser
def get_parser(): parser = fuc.get_rna_input_parser("Compare two RNA 3d structures based on RMSD, ACC" " or other measures", 2, "3d", enable_logging=True) output_group = parser.add_argument_group("Controlling output", description="Control, based on which measure the two " "structures will be compared") output_group.add_argument("--acc", help="Compare based on the Adjacency correlation coefficient" " ACC", action="store_true") output_group.add_argument( "--rmsd", help="Compare based on CG-RMSD", action="store_true") output_group.add_argument( "--pdb-rmsd", help="Compare based on PDB-RMSD", action="store_true") return parser
def get_parser(): parser = fuc.get_rna_input_parser("Reconstruct a pdb from a forgi *.coord file produced by ernwin.", "+", "only_cg", enable_logging=True) parser.add_argument("--source-pdb-dir", type=str, required=True, help="A directory where all the pdb files, from which fragments " "can be extracted, are located.") parser.add_argument("--source-cg-dir", type=str, required=True, help="A directory where the cg-files corresponding to the pdb files in " "source-pdb-dir are located.") parser.add_argument("--interactive", action="store_true") parser.add_argument("--server", action="store_true") parser.add_argument("--reassign-broken",action="store_true") fbs.update_parser(parser) return parser
def main(): parser = fuc.get_rna_input_parser( "Train a classifier for A-Minior interactions.", nargs="+", rna_type="only_cg") parser.add_argument("--fr3d-result", type=str, required=True, help="A file containing the FR3D output") parser.add_argument("--fr3d-query", type=str, help="Add this string describing the FR3D query " "as a comment to the trainingsdata-out file") parser.add_argument("--chain-id-mapping-dir", type=str, help="If you use PDB-bundles, this directory " "needs to hold all chain-id-mapping.txt files.") parser.add_argument("--trainingsdata-out", type=str, default="forgi/threedee/data/aminor_geometries.csv", help="File that will be written for the geometries " "of interactions and non-interactions.") parser.add_argument("--model-params-out", type=str, default="forgi/threedee/data/aminor_params.json", help="File that will be written for the " "model's hyper-parameters.") parser.add_argument("--test-set", type=str, help="':'-separated PDB-ids" " for the test-set.") parser.add_argument("--train-set", type=str, help="':'-separated PDB-ids for the train-set." "Note: This is only used for cross-validation." "The final model will be trained on all the data.") args = parser.parse_args() cgs, cg_filenames = fuc.cgs_from_args(args, rna_type="only_cg", return_filenames=True) ftcta.create_geometry_file(args.trainingsdata_out, cgs, cg_filenames, args.fr3d_result, args.chain_id_mapping_dir, args.fr3d_query) hyper_params = ftcta.tune_model(args.trainingsdata_out, args.train_set, args.test_set) with open(args.model_params_out, "w") as f: json.dump(hyper_params, f)
def generateParser(): parser = fuc.get_rna_input_parser("Collect data about a list of rna files and store it as a csv.", nargs="+", rna_type="any", enable_logging=True) parser.add_argument( "--csv", type=str, help="Store dataframe under this filename. (Prints to stdout if not given)") parser.add_argument("-k", "--keys", type=str, help="Only print the following properties. " "(A comma-seperated list of column headers, e.g. rog_vres") parser.add_argument( "--angles", type=str, help="Store the angles between the given pairs of elements. Comma-seperated element tuples, seperated by colons. (e.g.: 's0,s1:s1,s2')") parser.add_argument("--distances", type=str, help="Store the distances between the given nucleotides. Comma-seperated nucleotide tuples, seperated by colons. (e.g.: '1,20:2,19')") parser.add_argument("--per-ml", action="store_true", help="Describe junction segments instead of the whole cg (one entry per segment)") parser.add_argument( "--mode", type=str, help="For use with --csv. Either 'a' for append or 'o' for overwrite. Default: Abort if file exists.") return parser
def get_parser(): parser = fuc.get_rna_input_parser( 'Calculate the RMSD in 2D space between 2 projections of ' 'coarse-grained RNAs.', nargs=2, rna_type="3d", enable_logging=True) parser.add_argument( '--directions', nargs=2, type=str, help="The projection directions: e.g. 1.0,1.0,2.4 2.4,0,1", required=True) parser.add_argument('--plot', action="store_true", help="Open a window with a plot of the projections") return parser
def generateParser(): parser = fuc.get_rna_input_parser( "Collect data about a list of rna files and store it as a csv.", nargs="+", rna_type="any", enable_logging=True) parser.add_argument( "--csv", type=str, help= "Store dataframe under this filename. (Prints to stdout if not given)") parser.add_argument( "-k", "--keys", type=str, help="Only print the following properties. " "(A comma-seperated list of column headers, e.g. rog_vres") parser.add_argument( "--angles", type=str, help= "Store the angles between the given pairs of elements. Comma-seperated element tuples, seperated by colons. (e.g.: 's0,s1:s1,s2')" ) parser.add_argument( "--distances", type=str, help= "Store the distances between the given nucleotides. Comma-seperated nucleotide tuples, seperated by colons. (e.g.: '1,20:2,19')" ) parser.add_argument( "--per-ml", action="store_true", help= "Describe junction segments instead of the whole cg (one entry per segment)" ) parser.add_argument( "--mode", type=str, help= "For use with --csv. Either 'a' for append or 'o' for overwrite. Default: Abort if file exists." ) return parser
def get_parser(): parser = fuc.get_rna_input_parser( "Compare two RNA 3d structures based on RMSD, ACC" " or other measures", 2, "3d", enable_logging=True) output_group = parser.add_argument_group( "Controlling output", description="Control, based on which measure the two " "structures will be compared") output_group.add_argument( "--acc", help="Compare based on the Adjacency correlation coefficient" " ACC", action="store_true") output_group.add_argument("--rmsd", help="Compare based on CG-RMSD", action="store_true") output_group.add_argument("--pdb-rmsd", help="Compare based on PDB-RMSD", action="store_true") return parser
def main(): parser = fuc.get_rna_input_parser("Train a classifier for A-Minior interactions.", nargs="+", rna_type="only_cg") parser.add_argument("--fr3d-result", type=str, required=True, help="A file containing the FR3D output") parser.add_argument("--fr3d-query", type=str, help="Add this string describing the FR3D query " "as a comment to the trainingsdata-out file") parser.add_argument("--chain-id-mapping-dir", type=str, help="If you use PDB-bundles, this directory " "needs to hold all chain-id-mapping.txt files.") parser.add_argument("--trainingsdata-out", type=str, default="forgi/threedee/data/aminor_geometries.csv", help="File that will be written for the geometries " "of interactions and non-interactions.") parser.add_argument("--model-params-out", type=str, default="forgi/threedee/data/aminor_params.json", help="File that will be written for the " "model's hyper-parameters.") parser.add_argument("--test-set", type=str, help="':'-separated PDB-ids" " for the test-set.") parser.add_argument("--train-set", type=str, help="':'-separated PDB-ids for the train-set." "Note: This is only used for cross-validation." "The final model will be trained on all the data.") args = parser.parse_args() cgs, cg_filenames = fuc.cgs_from_args(args, rna_type="only_cg", return_filenames=True) ftcta.create_geometry_file(args.trainingsdata_out, cgs, cg_filenames, args.fr3d_result, args.chain_id_mapping_dir, args.fr3d_query) hyper_params = ftcta.tune_model( args.trainingsdata_out, args.train_set, args.test_set) with open(args.model_params_out, "w") as f: json.dump(hyper_params, f)
def main(): parser = fuc.get_rna_input_parser( "Find pseudoknots in RNA structures, " "classify them into shapes and analyze " "their 3D architecturre.", "+", parser_kwargs={"conflict_handler": "resolve"}) parser.add_argument("--pseudoknots", action="store_true", help=argparse.SUPPRESS) parser.add_argument("--outfile-mode", choices=["w", "a"], default='w', help="Overwrite ('w') or append ('a') to output file") parser.add_argument("--minlength", type=int, help="Minimum length of each stem. " "Stems with fewer base-pairs are treated as unpaired.", default=2) args = parser.parse_args() args.pseudoknots = True rnas, filenames = fuc.cgs_from_args(args, rna_type="any", return_filenames=True, skip_errors=True) #variables for statistics unfold = 0 without_pk = 0 with_pk = 0 pseudoknot_dataset = [] pseudoknot_dataset_extended = defaultdict(list) for pos, rna in enumerate(rnas): try: without_pk, with_pk, unfold, pseudoknots = identification_pseudoknot\ (rna, without_pk, with_pk, unfold,args.minlength) #count types of pseudoknots total_pk_g1 = len(pseudoknots) pk_sortclasses = {} other = 0 other_pk = [] pk_classes, other = classify_pseudoknots(pseudoknots) print("pk_classes:") for key, pks in sorted(pk_classes.items()): print("{:<17s} {}\t{}".format(key, len(pks), ", ".join(map(str, pks)))) print("other:" + "\t" + ", ".join(map(str, other))) filename = str(filenames[pos]).split("/")[-1] entry = {} for key, pks in pk_classes.items(): entry[key] = len(pks) entry["other"] = len(other) entry["PK_other_structures"] = ",".join(map(str, other)) entry["filename"] = filename entry["rnaname"] = rna.name print(filename) pseudoknot_dataset.append(entry) pk_id = 0 for key, pks in pk_classes.items(): for pk in pks: pk_id += 1 extend_pk_description(pseudoknot_dataset_extended, filename, key, rna, pk, pk_id) for pk in other: pk_id += 1 extend_pk_description(pseudoknot_dataset_extended, filename, "other", rna, pk, pk_id) except GraphIntegrityError: log.exception("Ignoring RNA %s; GraphIntegrityError", rna.name) except GraphConstructionError: log.exception("Ignoring RNA %s; GraphConstructionError", rna.name) except Exception: log.error("Error processing %s", rna.name) raise df1 = pandas.DataFrame(pseudoknot_dataset) df1.to_csv("pseudoknot_identification_genus2.csv", mode=args.outfile_mode, header=args.outfile_mode != "a", sep="\t") df2 = pandas.DataFrame(pseudoknot_dataset_extended) df2.to_csv("pseudoknot_identification_extended_genus2.csv", mode=args.outfile_mode, header=args.outfile_mode != "a", sep="\t") print("Structures with Pseudoknots: {}".format(with_pk)) print("Structures without Pseudoknots: {}".format(without_pk)) print("Structures unfold: {}".format(unfold))
import fess.builder.monitor as fbm import fess.builder.move as fbmov import fess.builder._other_movers import fess.builder.replicaExchange as fbr import fess.builder.builder as fbb import fess.builder.models as fbmodel import fess.builder.sampling as fbs from fess.utils import get_version_string import logging log = logging.getLogger("ernwin.__main__") parser = fuc.get_rna_input_parser( "ERNWIN: Coarse-grained sampling of RNA 3D structures.", nargs=1, rna_type="cg", parser_kwargs={"formatter_class": argparse.RawTextHelpFormatter}) parser.add_argument( '--seed', action='store', help= "Seed for the random number generator. It is taken module 2**32 to work with numpy.", type=int) parser.add_argument('-i', '--iterations', action='store', default=10000, help='Number of structures to generate', type=int) parser.add_argument('--replica-exchange', type=int, help="Experimental")
"bpseq": OutFiletype(fgb.BulgeGraph.to_bpseq_string, lambda x: ".bpseq", "cg"), "fasta": OutFiletype(fgb.BulgeGraph.to_fasta_string, lambda x: ".fa", "cg"), "dotbracket": OutFiletype(fgb.BulgeGraph.to_dotbracket_string, lambda x: ".dotbracket", "any"), "neato": OutFiletype(fgb.BulgeGraph.to_neato_string, lambda x: ".neato", "any"), "element_string": OutFiletype(bg_to_elem_string, lambda x: ".element_string", "any"), "pdb": OutFiletype(to_pdb, lambda x: ".pdb", "3d"), } parser = fuc.get_rna_input_parser( "Convert RNA files between different file formats.", "+") parser.add_argument("-T", "--target-type", default="forgi", choices=FILETYPES.keys(), type=str, help="The target file-type to convert into.") parser.add_argument( "--to-file", action="store_true", help="Store the converted RNA in files instead of printing them to stdout. " "The file-name will be the RNA's name (if present), otherwise 'rna001' etc." ) parser.add_argument( "--filename", type=str,
def get_parser(): """ Here all commandline & help-messages arguments are defined. :returns: an instance of argparse.ArgumentParser """ parser = fuc.get_rna_input_parser( "Generate target distributions for ernwin", nargs="+") ### Options ### # Options to modify general behavior parser.add_argument( '--plot-only', action="store_true", help='Do not generate any files, only plot results from existing files' ) parser.add_argument( '--use-subgraphs', type=int, help= 'Use subgraphs for the target distribution. Default: Use enough subgraphs to generate a total of 10000 graphs.' ) # Files that will be generated parser.add_argument( '--rog-target-file', help='Filename where the ROG target distribution will be stored', type=str) parser.add_argument( '--ame-target-file', help='Filename where the AMinor target distribution will be stored', type=str) parser.add_argument( '--sld-target-file', help= 'Filename where the Shortest loop distance target distribution will be stored', type=str) parser.add_argument( '--ame-orientation-outfile', default="stats/test_aminor_orientation_1S72.txt", help='Filename where the AMinor orientations will be stored', type=str) parser.add_argument( '--chain-id-mapping-dir', help= 'Directory name where chain-id-mappings for pdb bundles are located.', type=str) # Files that are required parser.add_argument('--fr3d-result-file', default="fess/stats/AMinor_FR3D_hits.txt", help='Filename with the output of FR3D', type=str) #Additional info parser.add_argument( '--fr3d-query-string', default=fr3d_query_string, help='FR3D query information that will be added to the file generated.', type=str) #parser.add_argument('--ame-pdb-id-file', help='For the AMinor energy, only consider pdb ids from this file', type=str) parser.add_argument('--precalculated-ame-orient', default=False, action="store_true") return parser
def get_parser(): parser = fuc.get_rna_input_parser("Create stats", nargs='+', rna_type="only_cg") return parser
continue shortened.add(to_shorten) # find the stems which are connected to this multiloop # and pick a random one db = list(bg.to_dotbracket_string()) # get the side of the stem which is connected to the # multiloop (s1b, s1e) = bg.get_sides(to_shorten, m) # print to_shorten, s1b, "(", bg.defines[to_shorten], ")" # the nucleotides that need to be changed to_change = bg.get_side_nucleotides(to_shorten, s1b) # print bg.defines[to_shorten], to_change db[to_change[0] - 1] = '.' db[to_change[1] - 1] = '.' print("".join(db)) parser = fuc.get_rna_input_parser( "Add (default) or remove a basepair from a random multiloop in the file and " "print out the resulting structure.", nargs=1, rna_type="any", enable_logging=True) args = parser.parse_args() if __name__ == '__main__': main(args)
# The C1'->B1 and B1->B2 vectors define the plane of the base # The O4'->C1'->B1->B2 sequence defines the torsion # angle chi if aname == ftup.chi_torsion_atoms[resname][-2]: aname = 'B1' elif aname == ftup.chi_torsion_atoms[resname][-1]: aname = 'B2' elif aname in scatoms: aname = resname + "." + aname avec = a.get_vector().get_array() atom_pos = ftuv.change_basis(avec - origin, basis, ftuv.standard_basis) identifier = "%s %s %d %d %s" % (d[0], " ".join( map(str, cg.get_node_dimensions(d))), conn_type, i, aname) poss[identifier] += [atom_pos] sources[identifier] += [d] print("{}:{}".format(identifier, ",".join(map(str, atom_pos)))) parser = fuc.get_rna_input_parser( "Generate a list of all atom positions found in the pdb files", nargs="+", rna_type="pdb", enable_logging=True) if __name__ == '__main__': main(parser)
def main(): parser = fuc.get_rna_input_parser("Find pseudoknots in RNA structures, " "classify them into shapes and analyze " "their 3D architecturre.", "+", parser_kwargs={"conflict_handler":"resolve"}) parser.add_argument("--pseudoknots", action="store_true", help=argparse.SUPPRESS) parser.add_argument("--outfile-mode", choices=["w","a"], default='w', help="Overwrite ('w') or append ('a') to output file") parser.add_argument("--minlength", type= int, help= "Minimum length of each stem. " "Stems with fewer base-pairs are treated as unpaired.", default = 2) args = parser.parse_args() args.pseudoknots=True rnas, filenames = fuc.cgs_from_args(args, rna_type="any",return_filenames = True, skip_errors=True) #variables for statistics unfold = 0 without_pk = 0 with_pk = 0 pseudoknot_dataset = [] pseudoknot_dataset_extended = defaultdict(list) for pos, rna in enumerate(rnas): try: without_pk, with_pk, unfold, pseudoknots = identification_pseudoknot\ (rna, without_pk, with_pk, unfold,args.minlength) #count types of pseudoknots total_pk_g1 = len(pseudoknots) pk_sortclasses = {} other = 0 other_pk = [] pk_classes, other = classify_pseudoknots(pseudoknots) print("pk_classes:") for key, pks in sorted(pk_classes.items()): print("{:<17s} {}\t{}".format(key, len(pks), ", ".join(map(str, pks)))) print("other:"+"\t"+", ".join(map(str,other))) filename = str(filenames[pos]).split("/")[-1] entry={} for key, pks in pk_classes.items(): entry[key] = len(pks) entry["other"] = len(other) entry["PK_other_structures"] = ",".join(map(str, other)) entry["filename"] = filename entry["rnaname"] = rna.name print(filename) pseudoknot_dataset.append(entry) pk_id = 0 for key, pks in pk_classes.items(): for pk in pks: pk_id+=1 extend_pk_description(pseudoknot_dataset_extended, filename, key, rna, pk, pk_id) for pk in other: pk_id+=1 extend_pk_description(pseudoknot_dataset_extended, filename, "other", rna, pk, pk_id) except GraphIntegrityError: log.exception("Ignoring RNA %s; GraphIntegrityError", rna.name) except GraphConstructionError: log.exception("Ignoring RNA %s; GraphConstructionError", rna.name) except Exception: log.error("Error processing %s", rna.name) raise df1 = pandas.DataFrame(pseudoknot_dataset) df1.to_csv("pseudoknot_identification_genus2.csv", mode=args.outfile_mode, header=args.outfile_mode!="a", sep="\t") df2 = pandas.DataFrame(pseudoknot_dataset_extended) df2.to_csv("pseudoknot_identification_extended_genus2.csv", mode=args.outfile_mode, header=args.outfile_mode!="a", sep="\t") print("Structures with Pseudoknots: {}".format(with_pk)) print("Structures without Pseudoknots: {}".format(without_pk)) print("Structures unfold: {}".format(unfold))
def get_parser(): parser = fuc.get_rna_input_parser('Visualize a 3D structure in pymol.', '+', '3d') parser.add_argument('--thin-cylinders', default=None, help='Make coarse_grain RNA thinner') parser.add_argument('--virtual-atoms', default=False, action='store_true', help='Display the virtual atoms') parser.add_argument('--virtual-residues', default=False, action='store_true', help='Display the virtual residues as spheres') parser.add_argument( '--only-elements', dest='only_elements', default=None, help='Display only these elements, separated by commas') parser.add_argument('--no-loops', action="store_true", help="Don't display the coarse-grain hairpin loops") parser.add_argument('--longrange', default=False, action='store_true', help="Display long-range interactions") parser.add_argument('--stem-color', default='green', help='The default stem color in coarse-grain drawings') parser.add_argument( '--multiloop-color', default='red', help='The default multiloop color in coarse-grain drawings') parser.add_argument( '-x', '--text', default=False, action='store_true', help="Add labels indicating the element names to the figure.") parser.add_argument( '--labels', type=str, help="Add labels to elements. Expects a comma seperated " "string of element:label, like 'm0:LookHere' to" " display 'LookHere' at the center of 'm0'.") parser.add_argument( '--encompassing-stems', default=False, action='store_true', help=argparse.SUPPRESS ) # 'Show the big stems that encompass the colinear ones.') parser.add_argument( '--sidechain-atoms', default=False, action='store_true', help= 'Include the sidechain atoms. Automatically enables --virtual-atoms') parser.add_argument( '--basis', default=False, action='store_true', help=argparse.SUPPRESS ) # Display the second basis vector of each element's coordinate system at its origin") parser.add_argument( '--rainbow', default=False, action='store_true', help= 'Color virtual atoms (if displayed) depending on the nucleotide position.' ) parser.add_argument( '--element-colors', default="", help='Specify a color for certain elements ' '(comma-separated element names or element_name:color)' 'Example: "m1,m2" (makes m1, m2 purple) or ' '"m0:red,m1:green,s0:AA11GG,default:black", ' 'where "AA11GG" is a hex value and "default" addresses all other elements.' ' Warning: colors not understood by PYMOL will be interpreted as black.' ) parser.add_argument('--align', default=False, action='store_true', help='Align the RNAs (if multiple are provided)') parser.add_argument('-o', '--output', default=None, help="Create a picture of the scene and exit", type=str) parser.add_argument('--batch', default=False, action='store_true', help='Start pymol in batch mode') parser.add_argument( '--pymol-file', type=str, help=argparse.SUPPRESS ) # Store the PYMOL file under this name. WARNING: Do not use .pml as file ending!!! return parser
self.get_extention = extention_fun self.rna_type = rna_type FILETYPES = { "forgi": OutFiletype(to_bg_or_cg_string, cg_or_bg_extention, "any"), "bpseq": OutFiletype(fgb.BulgeGraph.to_bpseq_string, lambda x: ".bpseq", "cg"), "fasta": OutFiletype(fgb.BulgeGraph.to_fasta_string, lambda x: ".fa", "cg"), "dotbracket": OutFiletype(fgb.BulgeGraph.to_dotbracket_string, lambda x: ".dotbracket", "any"), "neato": OutFiletype(fgb.BulgeGraph.to_neato_string, lambda x: ".neato", "any"), "element_string": OutFiletype(bg_to_elem_string, lambda x: ".element_string", "any"), "pdb": OutFiletype(to_pdb, lambda x: ".pdb", "3d"), } parser = fuc.get_rna_input_parser( "Convert RNA files between different file formats.", "+") parser.add_argument("-T", "--target-type", default="forgi", choices=FILETYPES.keys(), type=str, help="The target file-type to convert into.") parser.add_argument("--to-file", action="store_true", help="Store the converted RNA in files instead of printing them to stdout. " "The file-name will be the RNA's name (if present), otherwise 'rna001' etc.") parser.add_argument("--filename", type=str, help="If this is present, --to-file will automatically be true." "A target filename (or path) without extention. " "If it is a filename, use the given filename instead of the RNA's name. " "If more than one input-RNA is present, appends automatically a increasing number." "If it is a directory, create files in this directory.") parser.add_argument("-f", "--force", action="store_true", help="Overwrite files, if they already exist. Note: In case of race conditions, " "files could be overwritten even if this flag is not provided.")
import fess.builder.move as fbmov import fess.builder._other_movers import fess.builder.replicaExchange as fbr import fess.builder.builder as fbb import fess.builder.models as fbmodel import fess.builder.sampling as fbs from fess.utils import get_version_string import logging log = logging.getLogger("ernwin.__main__") parser = fuc.get_rna_input_parser( "MULTIERNWIN: Coarse-grained sampling of RNA 3D structures from multiple secondary structures.", nargs='+', rna_type="cg", parser_kwargs={ "formatter_class": argparse.RawTextHelpFormatter, "conflict_handler": "resolve" }) parser.add_argument( '--seed', action='store', help= "Seed for the random number generator. It is taken module 2**32 to work with numpy.", type=int) parser.add_argument('-i', '--iterations', action='store', default=10000, help='Number of structures to generate', type=int)