DaehwanKimLab / tophat

Spliced read mapper for RNA-Seq
http://ccb.jhu.edu/software/tophat
Boost Software License 1.0
90 stars 46 forks source link

The existing version fails on symlinks #41

Open struckma opened 7 years ago

struckma commented 7 years ago

Great tool, thank you! However, I would like to propose a patch, because we have a small problem with relative symlinks for the current tophat2.sh start script:

readlink returns the plain content of the symlink, which may be a relative path resolved from the directory, the link lives in, for example "../Cellar/tophat/2.1.1_1/bin/tophat2" in case of the brew system (homebrew or linuxbrew). The relative path is handled different by the existing tophat2.sh-script than by a shell resolving a symlink. The shell would resolve it relatively to the link's directory, the original tophat2.sh script tries to resolve it relatively to the current working directory, which usually fails. The proposed change will take care of this issue and set DIR to the real directory tophat2.sh lives in. For Linux only, the readlink command supports a "-f" parameter making it return the canonical path, but this is non-standard and won't work e.g. on a Mac.

I have tested my patch on Ubuntu 16.04 with linuxbrew and will test it on a current Mac OS X El Capitan, as soon as possible (currently, there seems to be some network problem with homebrew).

I would really be thankful, if you could consider my change, because we heavily use the brew system and would have to patch after each update otherwise. Thank you,

Stephan

struckma commented 7 years ago

Ok, now I could test it on OS X: Results: The error does not occur on this platform, but the modification anyway works -- and the bug on Ubuntu linuxbrew has been fixed. I don't have any Cygwin ready to test, so, sorry, cannot test that.