Question: R : File Do Not Exists Error. Isilon File Path Not Recognized In R
0
gravatar for ttom
5.5 years ago by
ttom200
ttom200 wrote:

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 • 8.6k views
ADD COMMENTlink modified 5.4 years ago by Biostar ♦♦ 20 • written 5.5 years ago by ttom200
1

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 REPLYlink modified 5.5 years ago • written 5.5 years ago by Irsan6.8k
1

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 REPLYlink modified 5.5 years ago • written 5.5 years ago by ttom200

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

ADD REPLYlink written 5.5 years ago by Irsan6.8k

rwxrwxrwx for all BAM files

ADD REPLYlink written 5.5 years ago by ttom200

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 REPLYlink written 5.5 years ago by Irsan6.8k

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

ADD REPLYlink written 5.5 years ago by ttom200

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 REPLYlink modified 5.5 years ago • written 5.5 years ago by Devon Ryan89k
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 REPLYlink modified 5.5 years ago • written 5.5 years ago by ttom200

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 REPLYlink written 5.5 years ago by Devon Ryan89k

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

ADD REPLYlink written 5.5 years ago by ttom200

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 REPLYlink modified 5.5 years ago • written 5.5 years ago by Devon Ryan89k

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 REPLYlink written 5.5 years ago by ttom200
1

Sounds like you had a typo then.

ADD REPLYlink written 5.5 years ago by Devon Ryan89k
3
gravatar for seidel
5.5 years ago by
seidel6.8k
United States
seidel6.8k wrote:

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 COMMENTlink written 5.5 years ago by seidel6.8k

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

ADD REPLYlink written 5.5 years ago by Devon Ryan89k

Thank you all for the support !!!

ADD REPLYlink written 5.5 years ago by ttom200
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1415 users visited in the last hour