[ensembl-dev] BAM reads on reverse strand

Fedor Gusev gusevfe at gmail.com
Wed Apr 20 08:58:49 BST 2011


Hello everyone.

It seems to that reads (those on reverse strand) from BAM files are
displayed wrong. Basically, they are displayed as reverse
complimentary sequence.
I had to make the following change to fix that. Does anyone have any
comments on this?

=== modified file 'ensembl-draw/modules/Bio/EnsEMBL/GlyphSet/bam.pm'
--- old/ensembl-draw/modules/Bio/EnsEMBL/GlyphSet/bam.pm
2011-03-17 14:30:12 +0000
+++ new/ensembl-draw/modules/Bio/EnsEMBL/GlyphSet/bam.pm
2011-04-20 07:57:15 +0000
@@ -1,6 +1,7 @@
 package Bio::EnsEMBL::GlyphSet::bam;
 use strict;
 use base qw(Bio::EnsEMBL::GlyphSet::sequence);
+use Bio::Seq;

 use Bio::EnsEMBL::ExternalData::BAM::BAMAdaptor;
 use Data::Dumper;
@@ -713,6 +714,11 @@

 #  my $seq = $a->qdna;
   my $seq = $a->query->dna;
+  if ($a->reversed) {
+    my $seqobj = Bio::Seq->new(-seq => $a->query->dna, -strand => -1);
+    $seq = $seqobj->revcom->seq;
+  }
+
   my $cl = $a->cigar_str;
   my @inserts = () ;




-- 
Kind regards,
Fedor Gusev.




More information about the Dev mailing list