Closed bryan-brancotte closed 6 years ago
@bneron
Instead of class method, another option (do not know right whether it is better or not) is to set a decorator ( @ requires("gatb") ) but here we need to use it for executables only (not python libraries that should be in the requirements). However, other dependencies (compiled ones) should be handled that way most probably.
by the way, we should drop GATB because it has different names on pypi and bioconda and has caused problems since the beginning. However, the idea raised in this issue is still valid for all other methods. Let us keep this example for now and see how we can implement it.
This raises a general question though. Do we want to include non-python libraries on the master. The answer is yes. For instance, we do not want to recode samtools. So at the end we will need to install third-party tools. I do not see any alternatives right now.
Some recommendations for now:
I proposed in the branch a decorator, but for now it will only works correctly on unix like system : I use which to test if the binary is in the path or not. How about writing test on this decorator ? I for now have no idea
Following a discution with @bneron
I've never used the distutils.spawn.find_executable.
which is a unix command so indeed using a more generic command (moreover faster) is a good idea indeed.
Refactoring done. Decorator is tested in ci.
Seems good to me. I'm closing this issue. It works in the dev branch. More tests will come but the implementation works.
As an example fastq2fasta has a method GATB which needs gatb.Bank. If you don't have the dependency on your machin, using this method will fail. Why couldn't we remove this method from the proposed methods (displayed in -h, and acceptable with -c)
The drawback being that methods _isusablemethod are run at each startup of bioconvert, and for method relying on shell we thus need to evaluate if the binary is in the path which could increase the booting time of bioconvert.