~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to t/Align/SimpleAlign.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2011-06-17 13:51:18 UTC
  • mfrom: (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110617135118-hncy38e0134j8oi5
Tags: 1.6.901-1
* New upstream release.
* Point debian/watch to search.cpan.org.
* Build using dh and overrides:
  - Use Debhelper 8 (debian/rules, debian/control).
  - Simplified debian/rules.
* Split into libbio-perl-perl, as discussed with the Debian Perl team.
  (debian/control, debian/bioperl.install, debian libbio-perl-perl.install)
* debian/control:
  - Incremented Standards-Version to reflect conformance with Policy 3.9.2.
    No other changes needed.
  - Vcs-Browser URL made redirectable to viewvc.
  - Removed useless ‘svn’ in the Vcs-Svn URL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*-Perl-*- Test Harness script for Bioperl
2
 
# $Id: SimpleAlign.t 16103 2009-09-16 04:27:51Z cjfields $
 
2
# $Id$
3
3
 
4
4
use strict;
5
5
 
7
7
    use lib '.';
8
8
    use Bio::Root::Test;
9
9
 
10
 
    test_begin( -tests => 179 );
 
10
    test_begin( -tests => 199 );
11
11
 
12
12
    use_ok('Bio::SimpleAlign');
13
13
    use_ok('Bio::AlignIO');
101
101
is( sprintf( "%.2f", $aln->overall_percentage_identity() ),
102
102
    33.06, 'overall_percentage_identity' );
103
103
is( sprintf( "%.2f", $aln->overall_percentage_identity('align') ),
104
 
    33.06, 'overall_percentage_identity' );
 
104
    33.06, 'overall_percentage_identity (align)' );
105
105
is( sprintf( "%.2f", $aln->overall_percentage_identity('short') ),
106
 
    35.24, 'overall_percentage_identity' );
 
106
    35.24, 'overall_percentage_identity (short)' );
107
107
is( sprintf( "%.2f", $aln->overall_percentage_identity('long') ),
108
 
    33.47, 'overall_percentage_identity' );
 
108
    33.47, 'overall_percentage_identity (long)' );
109
109
is( sprintf( "%.2f", $aln->average_percentage_identity() ),
110
110
    66.91, 'average_percentage_identity' );
111
111
 
548
548
# is _remove_col really working correctly?
549
549
my $a = Bio::LocatableSeq->new(
550
550
    -id    => 'a',
 
551
    -strand => 1,
551
552
    -seq   => 'atcgatcgatcgatcg',
552
553
    -start => 5,
553
554
    -end   => 20
554
555
);
555
556
my $b = Bio::LocatableSeq->new(
556
557
    -id    => 'b',
 
558
    -strand => 1,
557
559
    -seq   => '-tcgatc-atcgatcg',
558
560
    -start => 30,
559
561
    -end   => 43
560
562
);
561
563
my $c = Bio::LocatableSeq->new(
562
564
    -id    => 'c',
 
565
    -strand => -1,
563
566
    -seq   => 'atcgatcgatc-atc-',
564
567
    -start => 50,
565
568
    -end   => 63
566
569
);
567
570
my $d = Bio::LocatableSeq->new(
568
571
    -id    => 'd',
 
572
    -strand => -1,
569
573
    -seq   => '--cgatcgatcgat--',
570
574
    -start => 80,
571
575
    -end   => 91
572
576
);
573
577
my $e = Bio::LocatableSeq->new(
574
578
    -id    => 'e',
 
579
    -strand => 1,    
575
580
    -seq   => '-t-gatcgatcga-c-',
576
581
    -start => 100,
577
582
    -end   => 111
631
636
    }
632
637
}
633
638
 
 
639
# bug 3077
 
640
 
 
641
my $slice = $aln->slice(1,4);
 
642
 
 
643
for my $seq ($slice->each_seq) {
 
644
    if ( $seq->id eq 'a' ) {
 
645
        is $seq->start, 5;
 
646
        is $seq->end,   8;
 
647
        is $seq->strand, 1;
 
648
        is $seq->seq,   'atcg';
 
649
    }
 
650
    elsif ( $seq->id eq 'b' ) {
 
651
        is $seq->start, 30;
 
652
        is $seq->end,   32;
 
653
        is $seq->strand, 1;
 
654
        is $seq->seq,   '-tcg';
 
655
    }
 
656
    elsif ( $seq->id eq 'c' ) {
 
657
        is $seq->start, 60;
 
658
        is $seq->end,   63;
 
659
        is $seq->strand, -1;
 
660
        is $seq->seq,   'atcg';
 
661
    }
 
662
    elsif ( $seq->id eq 'd' ) {
 
663
        is $seq->start, 90;
 
664
        is $seq->end,   91;
 
665
        is $seq->strand, -1;
 
666
        is $seq->seq,   '--cg';
 
667
    }
 
668
    elsif ( $seq->id eq 'e' ) {
 
669
        is $seq->start, 100;
 
670
        is $seq->end,   101;
 
671
        is $seq->strand, 1;
 
672
        is $seq->seq,   '-t-g';
 
673
    }    
 
674
}
 
675
 
634
676
my $f = Bio::LocatableSeq->new(
635
677
    -id    => 'f',
636
678
    -seq   => 'a-cgatcgatcgat-g',