开发者

Add tag to bioperl DB::SAM/BAM

I have a bam file and use bioperl (Bio::DB::Sam) to work with it. Now i wanted to ask if there is an开发者_如何学编程y possibility to add tags to alignments in this File?

i use

    my $iterator     = $bam->features(-iterator => 1,
                                      -flags    => {M_UNMAPPED=>0});

    while (my $align = $iterator->next_seq) { 
        ...
    }

to loop through the aligned reads. Now i am searching vor anthing like

    $align->addTag(key=>value)

bye


BedTools has a means of annotating BAM files called TagBam

http://biostar.stackexchange.com/questions/9552/basic-bam-file-annotation

https://github.com/arq5x/bedtools


Short answer, no.

It might be possible to do it to the raw SAM and then convert it back to BAM. I've recently been writing a C++ api for BAM and came across this issue myself. The problem is the underlying c structures representing this information are all tightly byte packed and take up a specific amount of memory. Sometimes they might have a little more than they need, but other times they have just the right amount. Adding to these structures would, in most cases, exceed the available memory to them.

So, if I were you I would write out a new SAM file with your additional tags in it and convert it to BAM using samtools

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜