tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / t / Phenotype / OMIMentry.t
blobca3889330c81fdb397cdf9c05fb10ae1c0ac34d7
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7     use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 153);
11         
12     use_ok('Bio::Phenotype::OMIM::OMIMentry');
13     use_ok('Bio::Phenotype::OMIM::MiniMIMentry');
14     use_ok('Bio::Species');
15     use_ok('Bio::Annotation::Reference');
16     use_ok('Bio::Map::CytoPosition');
17     use_ok('Bio::Phenotype::Correlate');
18     use_ok('Bio::Phenotype::Measure');
19     use_ok('Bio::Annotation::DBLink');
22 my $obj = Bio::Phenotype::OMIM::OMIMentry->new();
24 isa_ok( $obj, "Bio::Phenotype::OMIM::OMIMentry" );
26 ok( $obj->to_string() );
28 ok( $obj->MIM_number( "100050" ) );
29 is( $obj->MIM_number(), "100050" );
31 ok( $obj->title( "AARSKOG SYNDROME" ) );
32 is( $obj->title(), "AARSKOG SYNDROME" );
35 ok( $obj->more_than_two_genes( 1 ) );
36 is( $obj->more_than_two_genes(), 1 );
38 ok( $obj->is_separate( 1 ) );
39 is( $obj->is_separate(), 1 );
41 ok( $obj->alternative_titles_and_symbols( "AORTIC ANEURYSM, ABDOMINAL" ) );
42 is( $obj->alternative_titles_and_symbols(), "AORTIC ANEURYSM, ABDOMINAL" );
44 ok( $obj->mapping_method( "PCR of somatic cell hybrid DNA" ) );
45 is( $obj->mapping_method(), "PCR of somatic cell hybrid DNA" );
47 ok( $obj->gene_status( "I" ) );
48 is( $obj->gene_status(), "I" );
51 ok( $obj->clinical_symptoms_raw( "Patients with ..." ) );
52 is( $obj->clinical_symptoms_raw(), "Patients with ..." );
55 ok( $obj->created( "Victor A. McKusick: 6/4/1986" ) );
56 is( $obj->created(), "Victor A. McKusick: 6/4/1986" );
58 ok( $obj->contributors( "Kelly A. Przylepa - revised: 03/18/2002" ) );
59 is( $obj->contributors(), "Kelly A. Przylepa - revised: 03/18/2002" );
61 ok( $obj->edited( "alopez: 06/03/1997" ) );
62 is( $obj->edited(), "alopez: 06/03/1997" );
65 my $mm = Bio::Phenotype::OMIM::MiniMIMentry->new();
67 ok( $obj->miniMIM( $mm ) );
68 is( $obj->miniMIM(), $mm );
72 my $av1 = Bio::Phenotype::OMIM::OMIMentryAllelicVariant->new();
73 my $av2 = Bio::Phenotype::OMIM::OMIMentryAllelicVariant->new();
75 ok( $av1->description( "dedxsc" ) );
77 is( $obj->each_AllelicVariant(), 0 );
79 ok( $obj->add_AllelicVariants( ( $av1, $av2 ) ) );
80 is( $obj->each_AllelicVariant(), 2 );
81 my @avs = $obj->each_AllelicVariant();
82 is( $avs[ 0 ], $av1 );
83 is( $avs[ 1 ], $av2 );
84 is( $avs[ 0 ]->description, "dedxsc" );
85 is( $obj->each_AllelicVariant(), 2 );
87 my @avs2 = $obj->remove_AllelicVariants();
88 is( $avs2[ 0 ], $av1 );
89 is( $avs2[ 1 ], $av2 );
91 is( $obj->each_AllelicVariant(), 0 );
92 is( $obj->remove_AllelicVariants(), 0 );
99 ok( $obj->name( "r1" ) );
100 is( $obj->name(), "r1" );
102 ok( $obj->description( "This is ..." ) );
103 is( $obj->description(), "This is ..." );
105 my $mouse = Bio::Species->new();
106 $mouse->classification( qw( musculus Mus ) );
107 ok( $obj->species( $mouse ) );
108 is( $obj->species()->binomial(), "Mus musculus" );
110 ok( $obj->comment( "putative" ) );
111 is( $obj->comment(), "putative" );
115 is( $obj->each_gene_symbol(), 0 );
117 ok( $obj->add_gene_symbols( ( "A", "B" ) ) );
118 is( $obj->each_gene_symbol(), 2 );
119 my @gs = $obj->each_gene_symbol();
120 is( $gs[ 0 ], "A" );
121 is( $gs[ 1 ], "B" );
122 is( $obj->each_gene_symbol(), 2 );
124 my @gs2 = $obj->remove_gene_symbols();
125 is( $gs2[ 0 ], "A" );
126 is( $gs2[ 1 ], "B" );
128 is( $obj->each_gene_symbol(), 0 );
129 is( $obj->remove_gene_symbols(), 0 );
133 my $v1 = Bio::Variation::VariantI->new();
134 my $v2 = Bio::Variation::VariantI->new();
136 $v1->length( "123" );
138 is( $obj->each_Variant(), 0 );
140 ok( $obj->add_Variants( ( $v1, $v2 ) ) );
141 is( $obj->each_Variant(), 2 );
142 my @vs = $obj->each_Variant();
143 is( $vs[ 0 ], $v1 );
144 is( $vs[ 1 ], $v2 );
145 is( $vs[ 0 ]->length(), "123" );
146 is( $obj->each_Variant(), 2 );
148 my @vs2 = $obj->remove_Variants();
149 is( $vs2[ 0 ], $v1 );
150 is( $vs2[ 1 ], $v2 );
152 is( $obj->each_Variant(), 0 );
153 is( $obj->remove_Variants(), 0 );
158 my $r1 = Bio::Annotation::Reference->new();
159 my $r2 = Bio::Annotation::Reference->new();
161 $r1->title( "title" );
163 is( $obj->each_Reference(), 0 );
165 ok( $obj->add_References( ( $r1, $r2 ) ) );
166 is( $obj->each_Reference(), 2 );
167 my @rs = $obj->each_Reference();
168 is( $rs[ 0 ]->display_text, $r1->display_text,'operator overloading in AnnotationI is deprecated');
169 is( $rs[ 1 ]->display_text, $r2->display_text,'operator overloading in AnnotationI is deprecated');
170 is( $rs[ 0 ]->title(), "title" );
171 is( $obj->each_Reference(), 2 );
173 my @rs2 = $obj->remove_References();
174 is( $rs2[ 0 ]->display_text, $r1->display_text,'operator overloading in AnnotationI is deprecated');
175 is( $rs2[ 1 ]->display_text, $r2->display_text,'operator overloading in AnnotationI is deprecated');
177 is( $obj->each_Reference(), 0 );
178 is( $obj->remove_References(), 0 );
183 my $c1 = Bio::Map::CytoPosition->new();
184 my $c2 = Bio::Map::CytoPosition->new();
186 $c1->chr( "12" );
188 is( $obj->each_CytoPosition(), 0 );
190 ok( $obj->add_CytoPositions( ( $c1, $c2 ) ) );
191 is( $obj->each_CytoPosition(), 2 );
192 my @cs = $obj->each_CytoPosition();
193 is( $cs[ 0 ], $c1 );
194 is( $cs[ 1 ], $c2 );
195 is( $cs[ 0 ]->chr(), "12" );
196 is( $obj->each_CytoPosition(), 2 );
198 my @cs2 = $obj->remove_CytoPositions();
199 is( $cs2[ 0 ], $c1 );
200 is( $cs2[ 1 ], $c2 );
202 is( $obj->each_CytoPosition(), 0 );
203 is( $obj->remove_CytoPositions(), 0 );
208 my $co1 = Bio::Phenotype::Correlate->new();
209 my $co2 = Bio::Phenotype::Correlate->new();
211 ok( $co1->name( "name" ) );
213 is( $obj->each_Correlate(), 0 );
215 ok( $obj->add_Correlates( ( $co1, $co2 ) ) );
216 is( $obj->each_Correlate(), 2 );
217 my @cos = $obj->each_Correlate();
218 is( $cos[ 0 ], $co1 );
219 is( $cos[ 1 ], $co2 );
220 is( $cos[ 0 ]->name, "name" );
221 is( $obj->each_Correlate(), 2 );
223 my @cos2 = $obj->remove_Correlates();
224 is( $cos2[ 0 ], $co1 );
225 is( $cos2[ 1 ], $co2 );
227 is( $obj->each_Correlate(), 0 );
228 is( $obj->remove_Correlates(), 0 );
233 my $m1 = Bio::Phenotype::Measure->new();
234 my $m2 = Bio::Phenotype::Measure->new();
236 ok( $m1->description( "desc" ) );
238 is( $obj->each_Measure(), 0 );
240 ok( $obj->add_Measures( ( $m1, $m2 ) ) );
241 is( $obj->each_Measure(), 2 );
242 my @ms = $obj->each_Measure();
243 is( $ms[ 0 ], $m1 );
244 is( $ms[ 1 ], $m2 );
245 is( $ms[ 0 ]->description, "desc" );
246 is( $obj->each_Measure(), 2 );
248 my @ms2 = $obj->remove_Measures();
249 is( $ms2[ 0 ], $m1 );
250 is( $ms2[ 1 ], $m2 );
252 is( $obj->each_Measure(), 0 );
253 is( $obj->remove_Measures(), 0 );
257 is( $obj->each_keyword(), 0 );
259 ok( $obj->add_keywords( ( "A", "B" ) ) );
260 is( $obj->each_keyword(), 2 );
261 my @ks = $obj->each_keyword();
262 is( $ks[ 0 ], "A" );
263 is( $ks[ 1 ], "B" );
264 is( $obj->each_keyword(), 2 );
266 my @ks2 = $obj->remove_keywords();
267 is( $ks2[ 0 ], "A" );
268 is( $ks2[ 1 ], "B" );
270 is( $obj->each_keyword(), 0 );
271 is( $obj->remove_keywords(), 0 );
275 my $l1 = Bio::Annotation::DBLink->new();
276 my $l2 = Bio::Annotation::DBLink->new();
278 ok( $l1->comment( "comment" ) );
280 is( $obj->each_DBLink(), 0 );
282 ok( $obj->add_DBLinks( ( $l1, $l2 ) ) );
283 is( $obj->each_DBLink(), 2 );
284 my @ls = $obj->each_DBLink();
285 is( $ls[ 0 ]->display_text, $l1->display_text,'operator overloading in AnnotationI is deprecated');
286 is( $ls[ 1 ]->display_text, $l2->display_text,'operator overloading in AnnotationI is deprecated');
287 is( $ls[ 0 ]->comment(), "comment" );
288 is( $obj->each_DBLink(), 2 );
290 my @ls2 = $obj->remove_DBLinks();
291 is( $ls2[ 0 ]->display_text, $l1->display_text,'operator overloading in AnnotationI is deprecated');
292 is( $ls2[ 1 ]->display_text, $l2->display_text,'operator overloading in AnnotationI is deprecated');
294 is( $obj->each_DBLink(), 0 );
295 is( $obj->remove_DBLinks(), 0 );
299 is( $obj->each_Genotype(), 0 );
301 ok( $obj->add_Genotypes( ( "A", "B" ) ) );
302 is( $obj->each_Genotype(), 2 );
303 my @gts = $obj->each_Genotype();
304 is( $gts[ 0 ], "A" );
305 is( $gts[ 1 ], "B" );
306 is( $obj->each_Genotype(), 2 );
308 my @gts2 = $obj->remove_Genotypes();
309 is( $gts2[ 0 ], "A" );
310 is( $gts2[ 1 ], "B" );
312 is( $obj->each_Genotype(), 0 );
313 is( $obj->remove_Genotypes(), 0 );