1 # -*-Perl-*- Test Harness script for Bioperl
11 test_begin(-tests => 45);
13 use_ok('Bio::LiveSeq::Chain');
16 # this script tests Bio::LiveSeq::Chain methods directly since it isn't OO:
17 # Bio::LiveSeq::Chain->new() isn't expected here.
19 my $chain = Bio::LiveSeq::Chain::string2chain("abcdefghijklmnopqrstuvwxyz");
21 is( Bio::LiveSeq::Chain::down_chain2string($chain),
22 "abcdefghijklmnopqrstuvwxyz");
23 is( Bio::LiveSeq::Chain::down_chain2string($chain,undef,4),
24 "abcd"); # default start=1
25 my ($warning,$output);
27 local $SIG{__WARN__}=sub{ $warning=$_[0]};
28 $output=Bio::LiveSeq::Chain::down_chain2string($chain,1,4,6);
30 is (((index($warning,"Warning chain2string: argument LAST:6 overriding LEN:4!")==0)&&($output eq "abcdef")),1);
31 my $arrayref=Bio::LiveSeq::Chain::down_labels($chain,1,4);
33 $arrayref=Bio::LiveSeq::Chain::up_labels($chain,4,1);
35 $arrayref=Bio::LiveSeq::Chain::up_labels($chain);
36 is scalar(@{$arrayref}), 26; # total number of labels should be 26
37 is Bio::LiveSeq::Chain::start($chain), '1';
38 is Bio::LiveSeq::Chain::end($chain), '26';
39 ok Bio::LiveSeq::Chain::label_exists($chain,'4');
40 is Bio::LiveSeq::Chain::label_exists($chain,'28'), '0';
41 is Bio::LiveSeq::Chain::down_get_pos_of_label($chain,4), '4';
42 is Bio::LiveSeq::Chain::down_get_pos_of_label($chain,4,4), '1';
43 is Bio::LiveSeq::Chain::up_get_pos_of_label($chain,26,1), '1';
44 is Bio::LiveSeq::Chain::down_subchain_length($chain,1,4), '4';
45 is Bio::LiveSeq::Chain::up_subchain_length($chain,4,1), '4';
46 ok Bio::LiveSeq::Chain::invert_chain($chain);
47 ok Bio::LiveSeq::Chain::invert_chain($chain);
48 is Bio::LiveSeq::Chain::down_get_value_at_pos($chain,4), 'd';
49 is Bio::LiveSeq::Chain::down_get_value_at_pos($chain,1,4), 'd';
50 is Bio::LiveSeq::Chain::up_get_value_at_pos($chain,4), 'w';
52 ok Bio::LiveSeq::Chain::up_set_value_at_pos($chain,'W',4);
53 is Bio::LiveSeq::Chain::up_get_value_at_pos($chain,4), 'W';
55 ok Bio::LiveSeq::Chain::down_set_value_at_pos($chain,'D',4);
56 is Bio::LiveSeq::Chain::down_get_value_at_pos($chain,4), 'D';
58 ok Bio::LiveSeq::Chain::set_value_at_label($chain,'d',4);
59 is Bio::LiveSeq::Chain::get_value_at_label($chain,4), 'd';
61 is Bio::LiveSeq::Chain::down_get_label_at_pos($chain,1,4), '4';
62 is Bio::LiveSeq::Chain::up_get_label_at_pos($chain,4), '23';
63 ok Bio::LiveSeq::Chain::is_downstream($chain,3,4);
64 is Bio::LiveSeq::Chain::is_downstream($chain,4,3), '0';
65 ok Bio::LiveSeq::Chain::is_upstream($chain,4,3);
66 is Bio::LiveSeq::Chain::is_upstream($chain,3,4), '0';
67 is Bio::LiveSeq::Chain::splice_chain($chain,4,2), 'de';
68 is Bio::LiveSeq::Chain::splice_chain($chain,7,undef,9), 'ghi';
70 my @array=Bio::LiveSeq::Chain::praeinsert_string($chain,"ghi",10);
74 @array=Bio::LiveSeq::Chain::postinsert_string($chain,"de",3);
77 is Bio::LiveSeq::Chain::up_chain2string($chain), "zyxWvutsrqponmlkjihgfedcba";
79 @array=Bio::LiveSeq::Chain::check_chain($chain);