Entering edit mode
Hi,
Is it possible to fetch the MD:Z field, e.g., 30G44 from bam files using Rsamtools or other Bioconductor packages? Thanks!
Best regards,
Julie
Hi,
Is it possible to fetch the MD:Z field, e.g., 30G44 from bam files using Rsamtools or other Bioconductor packages? Thanks!
Best regards,
Julie
Are ScanBamParam() arguments tag and tagFilter what you are looking for? See ?ScanBamParam.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Martin,
Thanks for the quick response!
I tried to set the tag parameter, but NULL is returned. Here is the code and sessionInfo.
pram1 <- ScanBamParam( tag=c( "MD", "XN", "AS"), what=c("rname", "strand", "pos", "qwidth", "cigar", "mapq", "qual") ) bam <- scanBam(bamPaths, index = bamIndex, pram = pram1) str(bam[[1]][["tag"]]) NULLI also tried with the example code in ScanBamParam with MD added to the tag, but for some reason, NULL is set in the MD field.
fl <- system.file("extdata", "ex1.bam", package="Rsamtools", mustWork=TRUE) p4 <- ScanBamParam(tag=c("NM", "H1", "MD"), what="flag") bam4 <- scanBam(fl, param=p4) str(bam4[[1]][["tag"]]) List of 3 $ NM: int [1:3307] 0 0 0 5 0 1 0 1 0 1 ... $ H1: int [1:3307] 0 0 0 0 0 1 0 1 0 0 ... $ MD: NULLBest regards,
Julie
There is a typo in your call to ScanBamParam --
pram=instead ofparam=. For the system file, there is no record with the MD tag, so no way for R to know what type of vector to allocate for it, hence NULL.