[BioC] writing BAM files from within R
Valerie Obenchain
vobencha at fhcrc.org
Mon Jan 23 01:17:54 CET 2012
Hi Margherita,
See ?filterBam. This function parses records in a BAM file according to
the filters specified in the 'param' argument and writes them out to a
new BAM file. If you can accomplish your filtering with the 'param'
argument (?ScanBamParam) this should work for you. If merging is
necessary after filtering you can use mergeBam().
As far as I know, there is no general function for writing data to a BAM
file from an R object (i.e., once the data have been read into R).
Valerie
On 01/22/12 14:35, margherita mutarelli wrote:
> Dear all,
> I have searched Rsamtools help pages and the mailing lists archives, but I
> couldn't find an answer to my question: is there any function to write a
> BAM file from within R?
> I use the scanBam function to read in R an input file and, after some
> merging and filtering within R, I would like to write the output a BAM file.
>
> Have you any suggestion? My first option at the moment is to create a SAM
> text file by writing the fields in the corresponding order and then use
> samtools to convert the SAM in BAM, but maybe there is a better solution
> that I have missed.
>
> Thank you all in advance.
>
> Best,
>
> Margherita
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list