Running linux command macs2 in R error
1
0
Entering edit mode
4.4 years ago

I am trying to call peaks of my data using macs2.

macs2 being linux command, and since I am doing everything in R, I gave this command :

system("macs2 callpeak -t /home/sidrah19220/IP/rawfile/aligned/rsubread_sorted.bam -c /home/sidrah19220/IP/rawfile/aligned/rsubread2_sorted.bam -n peak")

But it is giving error in R as :

sh: 1: macs2: not found
Warning message:
In system("macs2 callpeak -t /home/sidrah19220/IP/rawfile/aligned/rsubread_sorted.bam -c /home/sidrah19220/IP/rawfile/aligned/rsubread2_sorted.bam -n peak") :
  error in running command

However, the same command is running on terminal. Please help what could be the reason for the same.

R sequencing rna-seq ChIP-Seq • 2.1k views
ADD COMMENT
2
Entering edit mode

try to use the full path to macs2

ADD REPLY
0
Entering edit mode
4.4 years ago
Shalu Jhanwar ▴ 540

Could you check if macs2 can run from any directory on the terminal? Else you can set macs2 path in your .bashrc file. After checking into this, I'd suggest running the command on the test data first. Re-running commands with below changes can help to resolve the error:

  1. include the output folder flag in the command

  2. keep the input files in the same directory of Rscirpt such that absolute paths can be removed from the command like below:

    system("macs2 callpeak -t rsubread_sorted.bam -c rsubread2_sorted.bam -n peak")

ADD COMMENT
0
Entering edit mode

Thank you for your response.

Actually yes, the command is running in the terminal from any directory. It's just when I want to run it from RStudio it is showing the error. And I wanted to have a pipeline completely in the R to run as a whole.

ADD REPLY
0
Entering edit mode

Have you tried no. 2. with input files in the same folder? Does it still throw the same error?

ADD REPLY

Login before adding your answer.

Traffic: 2343 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6