Tophat 2.0.12 compatibility with Samtools 1.0

2,185 views
Skip to first unread message

Vincent Butty

unread,
Aug 16, 2014, 8:52:51 PM8/16/14
to tuxedo-to...@googlegroups.com
Hello,

As several of you will probably have noticed by now, it looks like Tophat 2.0.12 cannot interface with Samtools 1.0, because of its inability to recognize a 2-digit version number (or so it is looking like).

vbutty@n36h:~$ samtools --version                                                                                                                                                                        
samtools 1.0
Using htslib 1.0
Copyright (C) 2014 Genome Research Ltd.

vbutty@n36h:~$ module load bowtie2/2.2.3

vbutty@n36h:~$ /home/software/tophat/tophat-2.0.12/tophat -o test_samtools /home/Genomes/hg19_bowtie2/hg19_bwt2 test.fastq

[2014-08-16 20:48:20] Beginning TopHat run (v2.0.12)
-----------------------------------------------
[2014-08-16 20:48:20] Checking for Bowtie
     Bowtie version:     2.2.3.0
[2014-08-16 20:48:21] Checking for Samtools
Traceback (most recent call last):
  File "/home/software/tophat/tophat-2.0.12/tophat", line 4087, in <module>
    sys.exit(main())
  File "/home/software/tophat/tophat-2.0.12/tophat", line 3885, in main
    check_samtools()
  File "/home/software/tophat/tophat-2.0.12/tophat", line 1559, in check_samtools
    samtools_version_str, samtools_version_arr = get_samtools_version()
  File "/home/software/tophat/tophat-2.0.12/tophat", line 1541, in get_samtools_version
    samtools_version_arr = [int(version_match.group(x)) for x in [1,2,3]]
AttributeError: 'NoneType' object has no attribute 'group'


Any chance this could be fixed to allow Tophat to smoothly interface with Samtools 1.0 in the near future?

Thank you very much in advance,

Sincerely, 

Vincent Butty

Vincent Butty, MD, PhD
Research Scientist

BioMicroCenter @ MIT Biology 68-317A

http://openwetware.org/wiki/BioMicroCenter

77 Massachusetts Avenue

Cambridge MA 02139

Phone: +1 (617) 324-9603

Jeff Hussmann

unread,
Aug 17, 2014, 4:16:52 PM8/17/14
to tuxedo-to...@googlegroups.com
Vincent - 

I have also run into this issue. If you are interested, I've attached a workaround patch to tophat's samtools version detection.

- Jeff
support_for_tophat_1.patch

Vincent Butty

unread,
Aug 18, 2014, 9:22:53 AM8/18/14
to tuxedo-to...@googlegroups.com
Thank you Jeff for sharing your patch. 

- Vincent

Margrét Ásgeirsdóttir

unread,
Aug 28, 2014, 1:59:59 PM8/28/14
to tuxedo-to...@googlegroups.com
When my Tophat was installed the --with-bam flag was used configuring it to use a specific installation of Samtools 0.1.19. All the same I get this same error.

Akarsu Hatice

unread,
Sep 2, 2014, 7:52:04 AM9/2/14
to tuxedo-to...@googlegroups.com
Thanks a lot Jeff, I had the same issue as described above and your patch solved it!


H.

Stephane Plaisance

unread,
Sep 14, 2014, 5:52:22 AM9/14/14
to tuxedo-to...@googlegroups.com
Thanks Jeff for the patch.
However, since I never patched in my life, could you please comment on the few steps I should go (if possible with code) while building tophat from source to add your corrections?
Thanks in advance

Mónica Fabbro

unread,
Sep 17, 2014, 2:50:59 PM9/17/14
to tuxedo-to...@googlegroups.com
You have to use an older version of Samtools, the patch didn't work for me..
With Samtools 0.1.19.0 works just fine. Add this version to your PATH and Tophat will use it!
Regards!
MF

Stephane Plaisance

unread,
Sep 18, 2014, 3:16:24 AM9/18/14
to tuxedo-to...@googlegroups.com
thanks Monica, 

This is what I do now and I use 1.0 for some applications and 0.1.19 for others while I would 'prefer' to have only ONE samtools on my system to keep it simple. Who knows what differences the two version introduce in the output as they work on different code after all...
I am only a biologist, sorry for my simplistic mind

;-)

Daehwan Kim

unread,
Sep 22, 2014, 6:41:32 AM9/22/14
to tuxedo-to...@googlegroups.com
Sorry for the problem.  We've been working to fix this problem and will release a fixed version sometime soon (within two weeks).

Thanks,
Daehwan

Yueqi Wang

unread,
Sep 22, 2014, 10:19:08 AM9/22/14
to tuxedo-to...@googlegroups.com

I'm new to Tophat and also encountered this issue with Samtools 1.0. I'm using the pre-compiled binary release of Tophat 2.0.12 . 
My temporary solution is to disable the Samtools version detection module. So I commented out the line "check_samtools()" in the tophat script as shown below:

    check_bowtie(params)

    # check_samtools()

Now I'm able to run Tophat with Samtools 1.0 .

My question is, does this change affect the output of TopHat run? 

Thanks!


joey zhong

unread,
Sep 22, 2014, 11:12:18 AM9/22/14
to tuxedo-to...@googlegroups.com
I got same problem.

source  code of function check_samtools().
I think comment it will not affect the output of TopHat run.

# Make sure the SAM tools are installed and are recent enough to be useful
def check_samtools():
    th_log("Checking for Samtools")
    global samtools_path
    samtools_path=prog_path("samtools")
    samtools_version_str, samtools_version_arr = get_samtools_version()
    if samtools_version_str == None:
        die("Error: Samtools not found on this system")
    elif  samtools_version_arr[1] < 1 or samtools_version_arr[2] < 7:
        die("Error: TopHat requires Samtools 0.1.7 or later")
    th_logp("\t\tSamtools version:\t %s" % ".".join([str(x) for x in samtools_version_arr]))

Yueqi Wang

unread,
Sep 23, 2014, 3:00:35 AM9/23/14
to tuxedo-to...@googlegroups.com
Thanks Joey.

It turns out that "# check_samtools()" does affect the program, because the value of "samtools_path" (default value is None) is assigned in "check_samtools()" function, and that "samtools_path" will be used later when Tophat reports output tracks. So comment "check_samtools()" will cause Tophat to fail later on. See below
 
           ........ 
[2014-09-22 20:38:41] Mapping right_kept_reads.m2g_um_seg1 to genome segment_juncs with Bowtie (1/1)
[2014-09-22 20:45:33] Joining segment hits
[2014-09-22 20:50:42] Reporting output tracks
Traceback (most recent call last):
  File "/home/moon/app/tophat-2.0.12.Linux_x86_64/tophat", line 4087, in <module>
    sys.exit(main())
  File "/home/moon/app/tophat-2.0.12.Linux_x86_64/tophat", line 4061, in main
    params.gff_annotation)
  File "/home/moon/app/tophat-2.0.12.Linux_x86_64/tophat", line 2679, in compile_reports
    report_cmd.extend(["--samtools="+samtools_path])
TypeError: cannot concatenate 'str' and 'NoneType' objects

While it's not hard to solve this (simply copy "samtools_path=prog_path("samtools")" to somewhere outside the function), it's still better to use Samtools 0.1.19 before the next Tophat release. Because I run into another error earlier, which is the exact same one as described in this thread: https://www.biostars.org/p/112749/ , and the author solved it by using Samtools 0.1.19 instead of 1.0 . 

 

Alexandra Vatsiou

unread,
Nov 16, 2015, 7:57:28 AM11/16/15
to Tuxedo Tools Users
Make sure you have set the path only for the older version of samtools. otherwise it is getting confused. with samtools 0.1.19 it worked for me
Reply all
Reply to author
Forward
0 new messages