1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: AlignIO_stockholm.t 14971 2008-10-28 16:08:52Z cjfields $
10 test_begin(-tests => 75);
12 use_ok('Bio::AlignIO');
15 my $DEBUG = test_debug();
17 my ($str,$aln,$strout,$status);
19 # STOCKHOLM (multiple concatenated files)
21 $str = Bio::AlignIO->new(
22 '-file' => test_input_file("rfam_tests.stk"),
23 '-format' => 'stockholm');
24 $strout = Bio::AlignIO->new('-file' => ">".test_output_file(),
25 '-format' => 'stockholm', );
27 isa_ok($str,'Bio::AlignIO');
28 $aln = $str->next_aln();
29 isa_ok($aln,'Bio::Align::AlignI');
30 is($aln->source, 'stockholm');
31 is($aln->get_seq_by_pos(1)->get_nse, 'Z11765.1/1-89');
32 is($aln->accession, 'RF00006');
33 is($aln->id, 'Vault');
34 is($aln->description,'Vault RNA');
36 my ($ann) = $aln->annotation->get_Annotations('alignment_comment');
37 isa_ok($ann, 'Bio::Annotation::Comment');
38 is($ann->text,'This family of RNAs are found as part of the enigmatic vault'.
39 ' ribonucleoprotein complex. The complex consists of a major vault protein'.
40 ' (MVP), two minor vault proteins (VPARP and TEP1), and several small '.
41 'untranslated RNA molecules. It has been suggested that the vault complex '.
42 'is involved in drug resistance. We have identified a putative novel vault '.
43 'RNA on chromosome 5 EMBL:AC005219.','Stockholm annotation');
44 is($ann->tagname,'alignment_comment','Stockholm annotation');
47 $status = $strout->write_aln($aln);
48 is $status, 1, "stockholm output test";
50 $aln = $str->next_aln();
51 isa_ok($aln,'Bio::Align::AlignI');
52 is($aln->source, 'stockholm');
53 is($aln->get_seq_by_pos(1)->get_nse, 'L43844.1/2-149');
54 is($aln->get_seq_by_pos(1)->version, '1');
55 is($aln->accession, 'RF00007');
57 is($aln->description,'U12 minor spliceosomal RNA');
58 my @anns = $aln->annotation->get_Annotations('reference');
60 isa_ok($ann, 'Bio::Annotation::Reference', 'Stockholm annotation');
62 is($ann->pubmed,'9149533', 'Stockholm annotation');
64 'Pre-mRNA splicing: the discovery of a new spliceosome doubles the challenge.',
65 'Stockholm annotation');
66 is($ann->authors,'Tarn WY, Steitz JA;', 'Stockholm annotation');
67 is($ann->location,'Trends Biochem Sci 1997;22:132-137.', 'Stockholm annotation');
69 my $meta = $aln->consensus_meta;
70 isa_ok($meta, 'Bio::Seq::MetaI');
71 my ($name) = $meta->meta_names;
72 is($name,'SS_cons', 'Rfam meta data');
73 my $meta_str = $meta->named_meta($name);
74 is($meta_str, '...<<<<<..........>>>>>........<<<<......<<<<......>>>>>>>>'.
75 '<<<<<.......>>>>>...........<<<<<<<...<<<<<<<.....>>>>>>>.>>>>>>>..<<<'.
76 '<<<<<<.........>>>>>>>>>...', 'Rfam meta data');
77 $aln = $str->next_aln();
78 is($aln->source, 'stockholm');
79 isa_ok($aln,'Bio::Align::AlignI');
80 is($aln->get_seq_by_pos(1)->get_nse, 'AJ295015.1/1-58');
81 is($aln->accession, 'RF00008');
82 is($aln->id, 'Hammerhead_3');
83 is($aln->description,'Hammerhead ribozyme (type III)');
85 $meta = $aln->consensus_meta;
86 isa_ok($meta, 'Bio::Seq::MetaI');
87 ($name) = $meta->meta_names;
88 is($name,'SS_cons', 'Rfam meta data');
89 $meta_str = $meta->named_meta($name);
90 is($meta_str, '.<<<<<<..<<<<<.........>>>>>.......<<<<.....................'.
91 '...........>>>>...>>>>>>.', 'Rfam meta data');
94 $str = Bio::AlignIO->new(
95 '-file' => test_input_file("pfam_tests.stk"),
96 '-format' => 'stockholm');
97 isa_ok($str,'Bio::AlignIO');
98 $aln = $str->next_aln();
99 is($aln->source, 'stockholm');
100 isa_ok($aln,'Bio::Align::AlignI');
101 is($aln->get_seq_by_pos(1)->get_nse, 'RAD25_SCHPO/5-240');
102 is($aln->accession, 'PF00244.9');
103 is($aln->id, '14-3-3');
104 is($aln->description,'14-3-3 protein');
105 ($ann) = $aln->annotation->get_Annotations('gathering_threshold');
106 isa_ok($ann, 'Bio::Annotation::SimpleValue');
107 is($ann->display_text, '25.00 25.00; 25.00 25.00;', 'Pfam annotation');
108 $aln = $str->next_aln();
109 is($aln->source, 'stockholm');
110 isa_ok($aln,'Bio::Align::AlignI');
111 is($aln->get_seq_by_pos(1)->get_nse, 'COMB_CLOAB/6-235');
112 is($aln->accession, 'PF04029.4');
113 is($aln->id, '2-ph_phosp');
114 is($aln->description,'2-phosphosulpholactate phosphatase');
115 $aln = $str->next_aln();
116 isa_ok($aln,'Bio::Align::AlignI');
117 is($aln->source, 'stockholm');
118 is($aln->get_seq_by_pos(1)->get_nse, 'Y278_HAEIN/174-219');
119 is($aln->accession, 'PF03475.3');
120 is($aln->id, '3-alpha');
121 is($aln->description,'3-alpha domain');
122 # alignment meta data
123 $meta = $aln->consensus_meta;
124 isa_ok($meta, 'Bio::Seq::MetaI');
125 my %test_data = ('SA_cons' => '6000320010013274....3372052026033.108303630350385563',
126 'SS_cons' => 'SCBHHHHHHHHHTSCC....CHHHHHHHHTSTT.CCHHHHHHHHHHHHHSSC',
127 'seq_cons' => 'plTVtclsclhasc......stphLcphLshss.Lupsa+cohpK+lspshs',);
128 for my $name ($meta->meta_names) {
129 ok(exists $test_data{$name}, 'Pfam aln meta data');
130 $meta_str = $meta->named_meta($name);
131 is($meta_str, $test_data{$name}, 'Pfam aln meta data');
135 %test_data = ('SA' => '6000320010013274....3372052026033.108303630350385563',
136 'SS' => 'SCBHHHHHHHHHTSCC....CHHHHHHHHTSTT.CCHHHHHHHHHHHHHSSC');
137 for my $seq ($aln->each_seq) {
138 for my $name ($seq->meta_names) {
139 ok(exists $test_data{$name}, 'Pfam seq meta data');
140 is($seq->named_meta($name), $test_data{$name}, 'Pfam seq meta data');
144 # sequence-specific alignments
145 # this is a kludge for now until we can get a better class system in place (but
147 my ($seqann) = $aln->annotation->get_Annotations('seq_annotation');
148 isa_ok($seqann, 'Bio::AnnotationCollectionI');
149 @anns = $seqann->get_all_Annotations();
151 isa_ok($anns[0], 'Bio::AnnotationI');
152 is($anns[1]->comment, 'NSE: YIIM_ECOLI/168-214 Start: 178 End: 224');
153 is($anns[2]->database, 'PDB');
154 is($anns[2]->primary_id, '1o65');
155 is($anns[2]->optional_id, 'C');