Question: samtools loading in R
gravatar for rbronste
2.4 years ago by
rbronste60 wrote:


Using a package that requires samtools and only finding Rsamtools from Bioconductor, have that loaded and getting the following error:

sh: samtools: command not found
Error in readBAMIndex(bamFile, refgenome = refgenome) : 
  Cannot run "samtools".  Install "samtools" first!

Is there a regular samtools package? Having trouble locating it. Thank you.


rsamtools samtools • 653 views
ADD COMMENTlink modified 2.4 years ago by Martin Morgan ♦♦ 24k • written 2.4 years ago by rbronste60

I realize that this is a long shot, but did you ever find a fix to this? I'm getting the same error but samtools seems to be installed correctly. I can run it in terminal but R can't find it.


ADD REPLYlink written 24 days ago by lstpierr0

The original answer still applies. If the package you are trying to use -- which package? -- requires the samtools application to be installed (and discoverable, so somewhere in specified by the PATH environment variable) then you'll need to install samtools independently of R. If you need help doing that, then probably you need to ask somewhere (biostars?) where there is more likely to be relevant expertise.

Alternatively, if you're trying to access or manipulate BAM files from within R, you might try the Rsamtools or GenomicAlignments (or VariantAnnotation, for VCF) packages.

ADD REPLYlink written 24 days ago by Martin Morgan ♦♦ 24k
Answer: samtools loading in R
gravatar for Martin Morgan
2.4 years ago by
Martin Morgan ♦♦ 24k
United States
Martin Morgan ♦♦ 24k wrote:

samtools isn't R software, so you would have to install it independently of R. This might be 'hard' on Windows. But maybe the task that you want to accomplish doesn't require the package with the unfriendly dependency on samtools?

ADD COMMENTlink written 2.4 years ago by Martin Morgan ♦♦ 24k

I am using Mac OS, unfortunately no way around the R package I am using for this task so need to fix this error.

ADD REPLYlink written 2.4 years ago by rbronste60
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: 143 users visited in the last hour