-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a new tool with an accessory python script, and also modified the macros.xml file #137
Open
thepineapplepirate
wants to merge
4
commits into
galaxycomputationalchemistry:master
Choose a base branch
from
thepineapplepirate:gmxinsertmol
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
57afc5e
added a new tool with an accessory python script, and also modified t…
thepineapplepirate 1c63c77
new tool gmx insert-molecules and small edit to macros.xml
thepineapplepirate fb0b511
changed required python version to 3.7, so it passes test
thepineapplepirate 2093095
changed back to python3.8 and fixed the flake8 issue that was caussin…
thepineapplepirate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<tool id="gmx_insertmolecules" name="GROMACS insert-molecules" version="@TOOL_VERSION@+galaxy@GALAXY_VERSION@"> | ||
<description>to structure and topology files</description> | ||
<macros> | ||
<import>macros.xml</import> | ||
<token name="@GALAXY_VERSION@">0</token> | ||
</macros> | ||
|
||
<expand macro="requirements"> | ||
<requirement type="package" version="3.8">python</requirement> | ||
</expand> | ||
|
||
<command detect_errors="exit_code"><![CDATA[ | ||
|
||
ln -s '$gro_input' ./gro_input.gro && | ||
ln -s '$mol_input' ./mol_input.gro && | ||
|
||
gmx insert-molecules -f ./gro_input.gro -ci ./mol_input.gro -o multiples.gro -nmol '$nmols' | ||
#if $str($box.config) == "true": | ||
-box $box.dim | ||
#end if | ||
|
||
>> verbose.txt 2>&1 | ||
&& python '$__tool_directory__/nmols.py' | ||
]]></command> | ||
|
||
<inputs> | ||
<param argument="gro_input" type="data" format='gro' label="GRO structure file to insert into"/> | ||
<param argument="mol_input" type="data" format='gro' label="Inserting molecule's GRO structure file"/> | ||
<param name="nmols" type="integer" value="0" min="0" label="Number of copies of the molecule to add to system"/> | ||
<conditional name="box"> | ||
<param name="config" type="select" label="Change box size?"> | ||
<option value="true">Yes</option> | ||
<option value="false" selected="true">No</option> | ||
</param> | ||
<when value="true"> | ||
<param name="dim" type="integer" value="0" min="0" label="New box dimensions in nanometers. By default produces a cubic box, so the value provided is assigned to all 3 dimensions x, y, and z." help="This is useful if you're adding a lot of large molecules that may not fit inside the original box size. These dimensions, and box type can always be changed later with gmx_editconf." /> | ||
</when> | ||
<when value="false"/> | ||
</conditional> | ||
</inputs> | ||
<outputs> | ||
<data name="output1" format="gro" from_work_dir="./multiples.gro" label="GROMACS new structure with inserted-molecules (GRO) on ${on_string}"/> | ||
<data name="output2" format="txt" from_work_dir="./addedmols.txt" label="Total number of molecules succesfully added on ${on_string}"/> | ||
<expand macro="log_outputs" /> | ||
</outputs> | ||
<tests> | ||
<test> | ||
<param name="gro_input" value="newbox.gro" /> | ||
<param name="nmols" value="5" /> | ||
<param name="mol_input" value="lig.gro" /> | ||
<output name="output1" ftype="gro"> | ||
<!-- file is big, thus we do not compare the whole file --> | ||
<assert_contents> | ||
<has_line line="TEST" /> | ||
<has_text text="197"/> | ||
<has_text text="6G5E C1 93"/> | ||
<has_text text="7G5E C1 114"/> | ||
<has_text text="8G5E C1 135"/> | ||
<has_text text="9G5E C1 156"/> | ||
<has_text text="10G5E C1 177"/> | ||
<has_text text="4.09123 4.09123 4.09123"/> | ||
</assert_contents> | ||
</output> | ||
<output name="output2" ftype="txt"> | ||
<assert_contents> | ||
<has_text text="5" /> | ||
</assert_contents> | ||
</output> | ||
</test> | ||
<test> | ||
<param name="gro_input" value="newbox.gro" /> | ||
<param name="nmols" value="5" /> | ||
<param name="mol_input" value="lig.gro" /> | ||
<param name="config" value="true" /> | ||
<param name="dim" value="7" /> | ||
<output name="output1" ftype="gro"> | ||
<assert_contents> | ||
<has_line line="TEST" /> | ||
<has_text text="197"/> | ||
<has_text text="6G5E C1 93"/> | ||
<has_text text="7G5E C1 114"/> | ||
<has_text text="8G5E C1 135"/> | ||
<has_text text="9G5E C1 156"/> | ||
<has_text text="10G5E C1 177"/> | ||
<has_text text="7.00000 7.00000 7.00000"/> | ||
</assert_contents> | ||
</output> | ||
<output name="output2" ftype="txt"> | ||
<assert_contents> | ||
<has_text text="5" /> | ||
</assert_contents> | ||
</output> | ||
|
||
</test> | ||
</tests> | ||
<help><![CDATA[ | ||
|
||
.. class:: infomark | ||
|
||
**What it does** | ||
|
||
This tool adds n number of copies of any given molecule into another system using their .gro files. The inserting molecule can be a small ligand or an entire protein. The output can later be solvated using gmx_solvate if desired. The resulting files can be used to run a molecular dynamics simulation, provided that the topologies are updated to reflect all the new changes. | ||
|
||
_____ | ||
|
||
.. class:: infomark | ||
|
||
**Input** | ||
|
||
- GRO structure file of system to insert into. | ||
- GRO file of inserting molecule. | ||
|
||
_____ | ||
|
||
|
||
.. class:: infomark | ||
|
||
**Output** | ||
|
||
- GRO structure file of new system with inserted molecules. | ||
- txt file containing number of succesfully added molecules. | ||
]]></help> | ||
|
||
<expand macro="citations" /> | ||
</tool> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env python3 | ||
|
||
'#extracts the number of molecules succesfully added by gmx insert-molecules.' | ||
|
||
import re | ||
|
||
|
||
inFile = open('verbose.txt', 'r') | ||
outFile = open("addedmols.txt", "w") | ||
lines = inFile.read() | ||
result = re.search('Added(.*)molecules', lines) | ||
|
||
inFile.close() | ||
outFile.write(str(result.group(1))) | ||
outFile.close() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really convinced about this, I guess the idea is that the user modifies the top file themselves? It would be nice if we could do this as part of the tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Simon,
We were originally going to make this an all-in-one tool, but we decided to keep it as the standard gmx tool. We are working on a separate "add topologies" tool which will add topologies for inserted molecules, water, NaCL, and everything else. This output containing the number of added molecules would then be used as an input in the next step of adding topologies.
The reason why this is necessary is because not all systems can be setup via the GROMACS initial setup tool (not all force fields are present in gromacs, which leads to unrecognized residue and atom types depending on your system). So having a separate tool that adds topologies will allow versatility for users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correctly, the addedmols.txt will just contain a single integer, with the same value as the nmols parameter? If so, I don't think this is useful, I think the user can take care of this parameter themselves and remembering to use the same value for both tools.