Search
Question: Problem in reading .bam files (aligned to transcriptome) with ribofileCR function
1
9 months ago by

Hi,

I'm a beginner in using R (so I apologise in advance if my question is really naive :) ) and I'm trying to use RiboSeqR to read my .bam files that come from the alignment of riboseq reads to the transcriptome (using bowtie). I've written this so far but it seems unable to access my files..Maybe I'm missing some really important bit of code?

source("https://bioconductor.org/biocLite.R")
biocLite("riboSeqR")
library(riboSeqR)
library(baySeq)
biocLite("Rsamtools")
library(Rsamtools)

humanFasta <- c ("~/Users/bsad/Documents/PhD/polysome_data/NGS_attempt_Footprints_only/[UCSC_Main_on_Human__refGene_(genome)].fasta", sep= "")

fastaCDS <- findCDS(fastaFile = humanFasta,
startCodon = c("ATG"),
stopCodon = c("TAG", "TAA", "TGA"))

ribofileCR <- c("~/Users/PATH_OF_MY_FILE/FILENAME1.bam", "~/Users/PATH_OF_MY_FILE/FILENAME2.bam", "~/Users/PATH_OF_MY_FILE/FILENAME3.bam", "~/Users/PATH_OF_MY_FILE/FILENAME4.bam")

riboDat <-readRibodata (ribofileCR, replicates = c("WT", "WT", "M", "M"))
fCs <-frameCounting(riboDat, fastaCDS)
fS <- readingFrame(rC, lengths = 25:35)

plotFS(fS)

Thanks in advance for any ideas,        Katerina

modified 9 months ago • written 9 months ago by bsad0

Usually the best strategy is to simplify your code to the bare minimum required to produce the error, and then to report (cut and paste) the error into the question. If you really wrote the commands as above, then a guess would be that your BAM files (not fasta files) are really not at ~/Users/PATH_OF_MY_FILE/FILENAME2.bam" but somewhere else on your system.

Hi, thank you very much for your reply, I typed these commands based on the RiboSeqR manual. The error message I'm getting is:

Error in file(file, "r") : cannot open the connection
In file(file, "r") :
cannot open file '/Users/bsad/Documents/PhD/polysome_data/NGS_attempt_Footprints_only/[UCSC_Main_on_Human__refGene_(genome)].fasta': No such file or directory
+ stopCodon = c("TAG", "TAA", "TGA"))
Error in file(file, "r") : cannot open the connection
In file(file, "r") :
cannot open file '/Users/bsad/Documents/PhD/polysome_data/NGS_attempt_Footprints_only/[UCSC_Main_on_Human__refGene_(genome)].fasta': No such file or directory

so that means there is an error in the path I'm giving?

1

Yes, the file path is somehow incorrect. You could try file.choose() to select the file that you are interested in, or file.exists('/Users/bsad/Documents/PhD/polysome_data/NGS_attempt_Footprints_only/[UCSC_Main_on_Human__refGene_(genome)].fasta') to test whether the file actually exists. Also, the use of [] is unusual in a file name; I don't know if this causes problems or not.