Open paul-shannon opened 4 years ago
sliceBamFile <- function(existingBamFileNam, chrom, start, end, newBamFileName) { # you write this code }
use Rsamtools and something like this (from my notes)
library(Rsamtools) # psg1 chromloc: chr19:42866464-42879822 which <- GRanges(seqnames = "chr19", ranges = IRanges(42866464, 42879822)) what <- c("rname", "strand", "pos", "qwidth", "seq") param <- ScanBamParam(which = which, what=what) bamFile <- "~/github/igvR/inst/extdata/LN54310_chr19.bam" bam <- scanBam(bamFile, param=param) filterBam(bamFile, "tmp.bam", param=param)
@mariam16548 here's the thread. please read back to the opening comment.
use Rsamtools and something like this (from my notes)