Question: Filtering Bam file based on specific regions using Rsamtools
0
gravatar for laraib85
4.0 years ago by
laraib850
United States
laraib850 wrote:

I am kind of new to R and am trying to get multiple regions from my bam file and I need to write these back to a bam file using the Rsamtools library. I am trying to do it this way:

myGR <- GRanges(seqnames=c("chrIII","chrXII","chrIV"),ranges=IRanges(start=c(50838,660716,806621),end=c(52340,662833,807748)) )
myparams1<- ScanBamParam(which=myGR)
filterBam("accepted_hits.sorted.bam", "accepted_hits.specific", indexDestination=FALSE, myparams1)

but the filterBam command gives an error:

Error in as.character.default(x) :
  no method for coercing this S4 class to a vector

Any ideas how to fix this?

rsamtools rna-seq • 1.1k views
ADD COMMENTlink modified 4.0 years ago by Devon Ryan81k • written 4.0 years ago by laraib850
2
gravatar for Martin Morgan
4.0 years ago by
Martin Morgan1.5k
United States
Martin Morgan1.5k wrote:

The 'param' argument to filterBam comes after the '...' in the argument list, so needs to be named, something like

filterBam("accepted_hits.sorted.bam", "accepted_hits.specific",
    indexDestination=FALSE, param=myparams1)
ADD COMMENTlink modified 4.0 years ago • written 4.0 years ago by Martin Morgan1.5k
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: 708 users visited in the last hour