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.
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.
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:
include the output folder flag in the command
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")
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.
Have you tried no. 2. with input files in the same folder? Does it still throw the same error?
Log in to answer this question.
try to use the full path to macs2