0

I have a program called "bowtie2" and I changed the default path in terminal:

$export PATH=/opt/NGS/bowtie2-2.2.8:/usr/local/sbin:/usr/local/bin:/usr/sbin
$bowtie2 --version
/opt/NGS/bowtie2-2.2.8/bowtie2-align-s version 2.2.8

But when I call it from R it's still the old version from other path:

> bowtie2="bowtie2"
> system2(bowtie2,"--version",stdout=TRUE)[1]
[1] "/usr/bin/bowtie2-align version 2.1.0"

My question is how to change the default path for the program in R (so that the version is "/opt/NGS/bowtie2-2.2.8/bowtie2-align-s version 2.2.8" rather "/usr/bin/bowtie2-align version 2.1.0")

David Z
  • 6,641
  • 11
  • 50
  • 101

1 Answers1

1

You need to add export PATH=/opt/NGS/bowtie2-2.2.8:/usr/local/sbin:/usr/local/bin:/usr/sbin to the end of .bashrc(linux) or .bash_profile(mac) file in your home folder.

vi ~/.bash_profile

And then add the export command at the end of the file, otherwise it will only work for your current shell session. When you use system command in R, it launches a new shell session, which the export command won't apply to.

See this link to find out more about export command

Community
  • 1
  • 1
Psidom
  • 209,562
  • 33
  • 339
  • 356