R : File Do Not Exists Error. Isilon File Path Not Recognized In R
1
0
Entering edit mode
10.5 years ago
ttom ▴ 220

I am trying to run ExomeDepth R package

BAM_set1<-c("/path_to_folder/Sample1.bam")
Set1_CountData<-getBamCounts(bed.frame=exons.hg19, bam.files=BAM_set1)

Parse 1 BAM files
[1] "/path_to_folder/Sample1.bam"
Error in .io_check_exists(path(con)) : file(s) do not exist:
  "/path_to_folder/Sample1.bam"

getwd()
[1]    "/path_to_folder/"

Getting the following error. But in R I am in the right folder where my BAMs are present and also have given the entire path to the file when giving BAM list. Have uploaded all the dependent libraries for running ExomeDepth and R version 2.15.1 (2012-06-22) Platform: x86_64-redhat-linux-gnu (64-bit)

Any help much appreciated !!

Thanks, Tinu

r • 14k views
ADD COMMENT
1
Entering edit mode

Is the output from getwd() literally /path_to_folder/? That would mean you have created a folder called path_to_folder in your file system root (/), not really a conventional place to store some bam-file. Can you post the output of dir()?

And can you open a command terminal and post the output of ls -l /path_to_folder

ADD REPLY
1
Entering edit mode

Thanks for the response !!

Output from getwd() is not literally '/path_to_folder', for simplicity wrote so. It is actually a mount point from isilon.

dir()
Sample1.bam
Sample1.bai
Sample2.bam
Sample2.bai

And ls -l '/path_to_folder' gets me list of my BAM files

ADD REPLY
0
Entering edit mode

But what are the file permissions of the files in /path_to_folder?

ADD REPLY
0
Entering edit mode

rwxrwxrwx for all BAM files

ADD REPLY
0
Entering edit mode

I have the impression that the R environment you are working in has problems connecting to your isolon NAS. Can you open or import any file that is on the isolon?

ADD REPLY
0
Entering edit mode

I tried importing a text file in isilon path and it worked

ADD REPLY
0
Entering edit mode

If you type the following, do you get a number after the 2nd line? This basically just checks that R can actually open the file for reading.

fp <- file(BAM_set1,"rb")
readBin(fp, integer())
close(fp)
ADD REPLY
0
Entering edit mode
fp<-file(BAM_set1,"rb")
Error in file(BAM_set1, "rb") : cannot open the connection
In addition: Warning message:
In file(BAM_set1, "rb") :
  cannot open file '/path_to_folder/Sample1.bam': No such file or directory
ADD REPLY
0
Entering edit mode

Then as Irsan suggested, either there's a typo in BAM_set1, or there's some sort of filesystem issue going on. Can you "samtools view Sample1.bam" successfully from the command line?

ADD REPLY
0
Entering edit mode

I am able to see BAM file contents using samtools view command. Looks like it is an issue with the filesystem

ADD REPLY
0
Entering edit mode

Does seidel's example of setting BAM_set1 via a call to dir() fix the problem? If so, then this is just a typo issue. That'd be a much easier fix :)

ADD REPLY
0
Entering edit mode

Yes it worked. I used the following lines

BAM_set1<-dir(pattern=".bam$")
set1_CountData<-getBamCounts(bed.frame=exons.hg19, bam.files=BAM_set1)
ADD REPLY
1
Entering edit mode

Sounds like you had a typo then.

ADD REPLY
3
Entering edit mode
10.5 years ago
seidel 11k

If getwd() is actually:

[1]    "/path_to_folder/"

Then you don't need to put /path_to_folder/ in BAM_set1<-c("/path_to_folder/Sample1.bam") because you are already in the folder with the BAM files. This is further evident since dir() gives you:

Sample1.bam Sample1.bai Sample2.bam Sample2.bai

So

BAM_set1<- dir(pattern=".bam$")
Set1_CountData<-getBamCounts(bed.frame=exons.hg19, bam.files=BAM_set1)

should suffice.

ADD COMMENT
0
Entering edit mode

Changing an absolute to a relative path shouldn't make a difference, though setting BAM_set1 from dir() should fix any typo issues :)

ADD REPLY
0
Entering edit mode

Thank you all for the support !!!

ADD REPLY

Login before adding your answer.

Traffic: 1503 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