1 # -*-Perl-*- Test Harness script for Bioperl
6 # this script simply tests parsing ace* files
7 # - it cares nothing about the chromat_dir,phd_dir,edit_dir types of things
16 test_begin(-tests => 15);
18 use_ok('Bio::Tools::Alignment::Consed');
21 my $DEBUG = test_debug();
23 # scope some variables
24 my($o_consed,@singlets,@singletons,@pairs,@doublets,@multiplets,$invoker);
26 # instantiate a new object
27 my $passed_in_acefile = test_input_file('acefile.ace.1');
28 $o_consed = Bio::Tools::Alignment::Consed->new(-acefile => $passed_in_acefile);
29 ok defined $o_consed, 'new CSM::Consed object was created';
31 $o_consed->verbose($DEBUG);
33 isa_ok($o_consed,'Bio::Tools::Alignment::Consed');
35 isnt($o_consed->set_singlets(), 1, 'singlets can be successfully set');
37 @singlets = $o_consed->get_singlets();
38 is (scalar(@singlets), 65, 'singlets can be retrieved');
40 isnt ($o_consed->set_doublets(), 1, 'doublets can be set');
42 ok @doublets = $o_consed->get_doublets(), 'doublets can be retreived';
44 print(scalar(@doublets)." doublets were found\n") if ($DEBUG > 0);
45 is (scalar(@doublets), 45, 'doublets can be retrieved');
47 @pairs = $o_consed->get_pairs();
48 is (scalar(@pairs),1, 'pairs can be retrieved');
50 @multiplets = $o_consed->get_multiplets();
51 is (scalar(@multiplets), 4, 'multiplets can be retrieved');
53 @singletons = $o_consed->get_singletons();
54 is (scalar(@singletons), 3, 'singletons can be retrieved');
55 my($total_object_sequences, $total_grep_sequences);
56 is($total_grep_sequences = $o_consed->count_sequences_with_grep(), 179, 'how many sequences there are in the acefile _and_ in the singlets file');
58 is($total_object_sequences = $o_consed->sum_lets("total_only"),179, 'statistics from the Bio::Tools::Alignment::Consed object to compare the total number of sequences accounted for there to the number of sequences found via grep');
59 print("Match?\n") if($DEBUG > 0) ;
60 is ($total_object_sequences, $total_grep_sequences);
62 print("These are the statistics. Look right? ".$o_consed->sum_lets()."\n") if($DEBUG > 0);
63 is($o_consed->sum_lets(),'Singt/singn/doub/pair/mult/total : 65,3,45(90),1(2),4(19),179');
65 print("Dumping out the hash in a compact way...\n")if($DEBUG > 0) ;
66 $o_consed->dump_hash_compact() if($DEBUG > 0) ;
68 # print("Dumping out the hash in an ugly way...\n");
69 # $o_consed->dump_hash();
74 isa_ok $a, 'Bio::Variation::Allele';
76 is $a->accession_number(), 'X677667';
77 is $a->seq(), 'ACTGACTGACTG';
78 is $a->display_id(),'new-id' ;
79 is $a->desc, 'Sample Bio::Seq object';
80 is $a->moltype(), 'dna';
82 ok defined($trunc = $a->trunc(1,4));
83 is $trunc->seq(), 'ACTG', "Expecting ACTG. Got ". $trunc->seq();
85 ok defined($rev = $a->revcom());
86 is $rev->seq(), 'CAGTCAGTCAGT';
91 $a->repeat_unit('ACTG');
92 is $a->repeat_unit, 'ACTG';
95 is $a->repeat_count, 3;