Can someone please help me with the following error in scanBam
my code is as follows:
"chr.param<-ScanBamParam(which=aaeg.gr[1:4757],flag=my.flag,what=c("qname","rname","strand","pos","qwidth"))
bam01 <- scanBam(bam.files[1],param=chr.param)"
I am working with aedes aegypti and it has about 4757 contigs. When I run the code in R, I get this error:
"Error in value[3L] : 'scanBam' failed: record: 0 error: 0 file: bamfiles/Aae01.bam index: bamfiles/Aae01.bam In addition: Warning message: In doTryCatch(return(expr), name, parentenv, handler) : space 'supercont1.4754' not in BAM header "
Now I know the problem is that my bam file does not have all the contigs that the aaeg.gr does. I could manually go through and exclude the contigs that are not in the bam file, however that would take forever. Does anyone have a better way of doing this?