Question: Error Setting BAM Metadata
gravatar for changk16
4.2 years ago by
United States
changk160 wrote:

Hello All,


I am running a Galaxy instance on Linux and have installed tools from the Galaxy Main Tool Shed. However, whenever I run TopHat2, the program is unable to complete the job before I get the following error message:


Traceback (most recent call last):
 File "/home/ubuntu/galaxy-dist/lib/galaxy/jobs/runners/", line 129, in queue_job
   job_wrapper.finish( stdout, stderr, exit_code )
 File "/home/ubuntu/galaxy-dist/lib/galaxy/jobs/", line 998, in finish
   dataset.datatype.set_meta( dataset, overwrite=False )  # call datatype.set_meta directly for the initial set_meta call during dataset creation
 File "/home/ubuntu/galaxy-dist/lib/galaxy/datatypes/", line 251, in set_meta
   raise Exception, "Error Setting BAM Metadata: %s" % stderr
Exception: Error Setting BAM Metadata: /bin/sh: 1: samtools: not found


To try and fix the problem, I moved the samtools executable into the TopHat2 /bin, I also went into the “universe_wsgi.ini” and uncommented+changed the line “retry_metadata_internally=true” to “retry_metadata_internally=false”.

Then, when I ran the TopHat2 alignment again, the job was able to be completed. However, now the only problem is a small notification under the "Accepted Hits" file saying that “An error occurred setting the metadata for this dataset. You may be able to set it manually or retry auto-detection”. When I tried to run Cufflinks using this file, it showed an error about not correctly setting the metadata for file.


Does anyone have any suggestions about how I could possibly fix this problem? I have practically done everything I could think of to solve this problem, but I have run into a wall.


Thanks and any advice is highly appreciated!

Kevin C

ADD COMMENTlink modified 4.2 years ago by Bjoern Gruening5.1k • written 4.2 years ago by changk160
gravatar for Bjoern Gruening
4.2 years ago by
Bjoern Gruening5.1k
Bjoern Gruening5.1k wrote:

Hi Kevin,

samtools need to be globally available. It is used by the framework and is (is this case) not tool specific.



ADD COMMENTlink written 4.2 years ago by Bjoern Gruening5.1k

Hi Bjoern,

Thanks for the quick reply! I am a bit of a tyro to using Galaxy; could you explain how I would go about making samtools globally available?



ADD REPLYlink written 4.2 years ago by changk160

Sure :)

You can install samtools with apt-get install samtools under debian/ubuntu systems or with yum install samtools under fedora. If you don't want to install an additional version you can add the samtools binary from the toolshed to your PATH with:

export PATH=/dat/tools/my/samtools/bin:$PATH

Hope this works for you!


ADD REPLYlink written 4.2 years ago by Bjoern Gruening5.1k

Hi Bjoern,


Thank you SO much for the help. After I installed samtools using "sudo apt-get install samtools", I was able to run the TopHat2 successfully without errors, and did not run into BAM metadata issues. Thanks again for the advice, I had spent almost 2 weeks now trying to solve this issue. If you had not suggested this solution, I do not know how long it would have taken for me to get it to work.


Best Regards,

Kevin Chang

ADD REPLYlink written 4.2 years ago by changk160

No problem, welcome to the Galaxy community!

By the way you can accept the answer as solution to make it easier for others to find it.

ADD REPLYlink written 4.2 years ago by Bjoern Gruening5.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 175 users visited in the last hour