#---> Locate and read in the bam files
bamfiles <- dir(file.path("C:/Users/Desktop/Research/Summer 2020/BAMRnaSeq1/Local alignment"), ".bam")
file.exists(bamfiles)
Output: [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#---> Define bam files for count step on Rsamtools
library("Rsamtools")
bamfiles <- BamFileList(bamfiles, yieldSize=2000000)
#---> Check correct chr names
seqinfo(bamfiles[1])
Output:
Error in value[[3L]](cond) :
failed to open BamFile: failed to open SAM/BAM file
file: 'CD8-O-Hi_21_II_19_local.bam'
Could there be something wrong with my code, or is it most likely the file that isn't working? Given the fact that it first said All True for the file.exists, I don't see why the seqinfo isn't reading the bamfiles.