bioruby-samtools
bioruby-samtools copied to clipboard
Writing alignments to file
Is it possible to write alignments to file?
E.g. I want to process an existing .bam file by removing a part of the sequence. How do I do that?
Hi, can you clarify what you require. I guess you want to process an alignment, removing some of the sequence, create a new Bio::DB::Alignment object and write that to a new BAM file? Or are you trying to do something more complicated?
cheers
That's exactly what I want.
On Thu, Feb 16, 2012 at 2:13 PM, danmaclean < [email protected]
wrote:
Hi, can you clarify what you require. I guess you want to process an alignment, removing some of the sequence, create a new Bio::DB::Alignment object and write that to a new BAM file? Or are you trying to do something more complicated?
cheers
Reply to this email directly or view it on GitHub: https://github.com/helios/bioruby-samtools/issues/10#issuecomment-3998036
Kind regards, Fedor Gusev.
The official samtools C API function for writing to BAM isn't implemented yet, as it is a bit complicated and we considered most users would want to use BAM as a datasource much more than as a sink. The workaround is to use the Bio::DB::Alignment#to_s method that writes the alignment object in SAM, which you can convert to BAM the old fashioned way. We are working on making BAM writable.
cheers