Mercurial > repos > chemteam > gromacs_extract_topology
annotate gmxtras_add_newmolparam.py @ 0:9faa4f4b8b76 draft default tip
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
author | chemteam |
---|---|
date | Thu, 27 Jan 2022 18:17:05 +0000 |
parents | |
children |
rev | line source |
---|---|
0
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
2 import argparse |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
3 |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
4 |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
5 def __main__(): |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
6 parser = argparse.ArgumentParser( |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
7 description='Adds New topologies to gromacs topology file') |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
8 parser.add_argument( |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
9 '--top_file', default=None, |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
10 help="Topology file input") |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
11 parser.add_argument( |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
12 '--mol_file', default=None, |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
13 help='molecule type and bonded parameters input') |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
14 parser.add_argument( |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
15 '--atom_file', default=None, |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
16 help='atomtype and nonbonded parameters input') |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
17 parser.add_argument( |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
18 '--out', default=None, |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
19 help='Path to output') |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
20 args = parser.parse_args() |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
21 with open(args.out, 'w') as fh_out: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
22 with open(args.top_file, 'r') as fh: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
23 # these two short loop takes care of |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
24 # adding the atom types and molecule types. |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
25 for line in fh: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
26 fh_out.write(line) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
27 if ';name bond_type' in line: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
28 for contents in open(args.atom_file): |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
29 fh_out.write(contents) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
30 break |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
31 for line in fh: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
32 if '[ system ]' in line: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
33 fh_out.write("\n; Begin NewTopologyInfo\n") |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
34 for contents in open(args.mol_file): |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
35 fh_out.write(contents) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
36 fh_out.write("; end NewTopologyInfo\n\n") |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
37 fh_out.write(line) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
38 break |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
39 fh_out.write(line) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
40 for line in fh: |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
41 fh_out.write(line) |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
42 |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
43 |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
44 if __name__ == "__main__": |
9faa4f4b8b76
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/buildtools/topologyeditors commit ae026d4ea6fe2ebaa53611b86f9047941c7b899b"
chemteam
parents:
diff
changeset
|
45 __main__() |