galaxycomputationalchemistry / galaxy-tools-compchem

:mega: Galaxy Tools for Computational Chemistry
Apache License 2.0
14 stars 16 forks source link

Makendx edits #136

Closed thepineapplepirate closed 2 years ago

thepineapplepirate commented 2 years ago

I noticed there was input argument missing in this tool's xml file. The command line tries to assign a value to the user's input file this way: ln -s '$input_file' ./input.$input_file.ext && (echo '$sel'; echo 'q') | gmx make_ndx -f ./input.$input_file.ext -o ./ndx.ndx &>> verbose.txt &&

However, $input_file.ext was not described elsewhere in the file, so gmx was reading files with no extension and automatically interpreting it as a .txt file, which is an incompatible extension in gmx.

I added an input argument where the user can specify which file format is used in their structure (either pdb or gro as options), and named this variable $extension. The new command works fine now. Tried it on galaxy before and after the changes, and things work. It also passed planemo lint and test succesfully. Thanks!

-BR

simonbray commented 2 years ago

But the current version should work fine if the datatype of the input dataset is set correctly? I did a small test here: https://usegalaxy.eu/u/sbray/h/makendx-test

I don't think it makes sense to set a PDB or GRO file to the TXT datatype, none of our tools will work if you do that :)

thepineapplepirate commented 2 years ago

Hey man,

Not sure what your files look like, but I went on the EU server and ran make_ndx with "str_ions.gro" from the test-data folder in this repo. It failed because it did not read in the extension. I've tried with a few .gro files and it still produces the same error.

Just for repoducibility, could you run make_ndx using "str_ions.gro" from the test-data folder, and tell me if you get a failure? Thanks! :)

simonbray commented 2 years ago

It works, but you need to set the datatype to GRO manually, either during or after upload: https://usegalaxy.eu/u/sbray/h/makendx-test

GRO files are a bit annoying because the format is not very distinctive, compared to PDB files (it's basically just a table with some numbers). So Galaxy is not able to automatically assign uploaded files to the GRO datatype.

The 'sniffer' function which automatically detects PDB files is located here: https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/datatypes/molecules.py#L461 I tried to write an equivalent function for GRO files a couple of years ago, but it was rejected IIRC because it was not specific enough. I can have another go if you like, I can probably do a better job this time.

thepineapplepirate commented 2 years ago

That's so strange. I'm doing the same thing, with the same file, on the EU server. What I get is this:

GROMACS: gmx make_ndx, version 2021.3-bioconda Executable: /usr/local/tools/_conda/envs/gromacs@2021.3/bin.AVX2_256/gmx Data prefix: /usr/local/tools/_conda/envs/gromacs@2021.3 Working dir: /data/dnb03/galaxy_db/job_working_directory/033/727/33727383/working Command line: gmx make_ndx -f ./input.txt -o ./ndx.ndx


Program: gmx make_ndx, version 2021.3-bioconda Source file: src/gromacs/commandline/cmdlineparser.cpp (line 275) Function: void gmx::CommandLineParser::parse(int*, char**)

Error in user input: Invalid command-line options In command-line option -f File './input.txt' cannot be used by GROMACS because it does not have a recognizable extension. The following extensions are possible for this option: .gro, .g96, .pdb, .brk, .ent, .esp, .tpr

For more information and tips for troubleshooting, please check the GROMACS website at http://www.gromacs.org/Documentation/Errors

did you notice though, that in makendx.xml, the variable "$input_file.ext" is used on the command line, yet not described elsewhere?

simonbray commented 2 years ago

It is not defined, ext accesses the datatype attribute of the dataset - there are a lot of other examples here: https://github.com/galaxyproject/tools-iuc/search?q=input.ext

File './input.txt' cannot be used by GROMACS because it does not have a

That should not be happening, can you share a history?

thepineapplepirate commented 2 years ago

Hey Simon,

please disregard this PR. after carefully going through my steps, I was in fact not specifying the file type during upload. It might be the issue with the sniffer function like you said. This actually explains why it wouldn't work directly after the upload, but if I instead ran an energy min on this upload and then tried make_ndx on the output file, it would actually work. I will close this PR. Thanks and sorry for the confusion!

simonbray commented 2 years ago

No problem, I will try and spend some time writing a GRO sniffer anyway, I think that would be useful. (Or if you are interested in making contributions to the main Galaxy codebase, it could be a relatively easy entry point - no pressure though.)