rjpbonnal / bioruby-samtools

Porting of samtools-ruby to BioRuby. Binder of samtools for ruby, on the top of FFI -from original project-
Other
33 stars 23 forks source link

Writing alignments to file #10

Open gusevfe opened 12 years ago

gusevfe commented 12 years ago

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?

danmaclean commented 12 years ago

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

gusevfe commented 12 years ago

That's exactly what I want.

On Thu, Feb 16, 2012 at 2:13 PM, danmaclean < reply@reply.github.com

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.

danmaclean commented 12 years ago

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