common-workflow-library / legacy

Deprecated
https://github.com/common-workflow-library/bio-cwl-tools
Apache License 2.0
100 stars 62 forks source link

Use picard-tools script rather than full path to Picard jar #78

Open samuell opened 8 years ago

samuell commented 8 years ago

(I commented also here about this.)

This is relevant to the Picard sub-tools.

I noticed that at least when intalling via apt-get on Ubuntu, you get a picard-tools script in /usr/bin, which is executable from everywhere, that basically replaces the java -jar [...path...]/picard.jar part.

Calling that script instead of using java and the full path to the jar would be more portable as it is not specific to a given path for the jar. It should also be easy to create a custom such script in one's /usr/bin/ or other folders set in one's PATH, if installing in a custom location.

(For java options, I checked in the picard-tools script that it sends the JAVA_OPTIONS env variable to java, in case that is needed, for setting the memory usage and the like.)

mr-c commented 8 years ago

Howdy @samuell, that is a great find. Can you send a pull request to switch to that usage?

samuell commented 8 years ago

@mr-c Sure, will make a try as soon as I start to grok all the details of the syntax :)

portah commented 8 years ago

@mr-c and @samuell, If you use those picard tools without docker and natively on ubuntu then yes you solution is better, but what if someone runs it somewhere else SuSE, Centos, MacOS, etc...

The particular solution that we have involves docker image, and in that image a particular version of picard is installed in /usr/local/bin...

mr-c commented 8 years ago

CWL tool descriptions in this repository shouldn't require the use of Docker; frankly there shouldn't be any hard coded paths.

The picard-tools shell script is useful; but it is an enhancement from Debian and hasn't been adopted by the original authors.

Java does present a particular problem as there isn't a standard place to install jars.

A more portable approach to running Java programs that don't install a wrapper is for the user (or docker image) to set the CLASSPATH environment variable to the location of the installed jar file. Then the CWL command line tool description can invoke java along with the Main Class and any other default arguments:

baseCommand: [ java, picard.cmdline.PicardCommandLine, BuildBamIndex ]

Equivalent to the following at the command line using the Debian paths:

user@host:~$ CLASSPATH=/usr/share/java/picard.jar java picard.cmdline.PicardCommandLine BuildBamIndex