File: EncodedSeq.t

package info (click to toggle)
bioperl 1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 20,336 kB
  • ctags: 8,476
  • sloc: perl: 119,890; xml: 6,001; lisp: 121; makefile: 57
file content (83 lines) | stat: -rw-r--r-- 2,035 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

# -*-Perl-*-
## Bioperl Test Harness Script for Modules
## $Id: EncodedSeq.t,v 1.4 2003/11/18 16:32:27 amackey Exp $
use strict;
use constant NUMTESTS => 37;

BEGIN {     
    eval { require Test; };
    if( $@ ) {
	use lib 't';
    }
    use Test;
    
    plan tests => NUMTESTS;
}
use Bio::Seq::EncodedSeq;


ok(1);
use Bio::SimpleAlign;
use Bio::AlignIO;
use Bio::Root::IO;

my ($str, $aln, $seq, $loc);

ok $seq = new Bio::Seq::EncodedSeq(
			     -seq => '--atg---gta--',
			     -start => 1,
			     -end => 6,
			     -strand => 1
			     );
ok $seq->alphabet, 'dna';
ok $seq->start, 1;
ok $seq->end, 6;
ok $seq->strand, 1;
ok $seq->no_gaps, 1;
ok $seq->column_from_residue_number(4), 9;

# this should fail
eval {
    $seq->column_from_residue_number(8);
};
ok $@;

ok $loc = $seq->location_from_column(4);
ok $loc->isa('Bio::Location::Simple');
ok $loc->to_FTstring, "2";

ok $loc = $seq->location_from_column(6);
ok $loc->isa('Bio::Location::Simple');
ok $loc->start, 3;
ok $loc->location_type, 'IN-BETWEEN';
ok $loc->to_FTstring, '3^4';

ok $loc = $seq->location_from_column(2), undef;

ok $seq->encoding, "GGCCCGGGCCCGG";
ok $seq->encoding(-explicit => 1), "GGCDEGGGCDEGG";

ok $seq = new Bio::Seq::EncodedSeq(
			     -seq => 'atcgta',
			     -start => 10,
			     -end => 15,
			     -strand => -1,
			     );
ok $seq->encoding('CCGGG'), 'CCGGGCCCC';
ok $seq->seq, 'atcg---ta';
ok $seq->column_from_residue_number(14), 2;
ok $seq->encoding('3C2GCG'), 'CCCGGCGCC';
ok $seq->seq, 'at-c--gta';
ok $seq->no_gaps, 2;
ok $seq->location_from_column(2)->to_FTstring, 14;
ok $seq->location_from_column(5)->to_FTstring, "12^13";
ok $seq->encoding("B", Bio::Location::Simple->new(-start => 10, -end => 11,
						  -location_type => 'IN-BETWEEN')), 'B';
ok $seq->seq, 'at-c--gt-a';
ok $seq->encoding, 'CBCCGGCGCC';
ok $seq->cds(-nogaps => 1)->seq, 'tacgat';
ok $seq->translate->seq, 'YD';
ok $seq = $seq->trunc(4,10); # kinda testing LocatableSeq's new trunc() here as well.
ok $seq->seq, 'c--gt-a';
ok $seq->encoding, 'CBCCGGC';