source: test/test.pl @ 8

Last change on this file since 8 was 8, checked in by maarten, 9 years ago

removed some output bugs

File size: 13.1 KB
Line 
1use strict;
2use warnings;
3
4use lib "../../Bioperl-patch";
5use lib "../lib";
6
7use Data::Dumper;
8use ProccesAllicVariants;
9use Omim2Pubmed;
10use Omim2dbsnp;
11use Bio::Phenotype::OMIM::OMIMparser;
12use Test::More tests => 62;
13
14#lib "../lib";
15my $filename    = "data.bak/ACTA.omim.txt";
16my $pubmedcited = "../data/pubmed_cited";
17
18my $omim2pubmed = Omim2Pubmed->new();
19$omim2pubmed->loadpubmed_cited($pubmedcited);
20my $omim_parser =
21  Bio::Phenotype::OMIM::OMIMparser->new( -omimtext => $filename );
22my $PAV = ProccesAllicVariants->new();
23$PAV->addOmim2pubmed($omim2pubmed);
24
25my $dbsnpref="../data/dbsnp-to-OMIM.cvs";
26my $dbsnp=Omim2dbsnp->new();
27$dbsnp->loadCrossReference($dbsnpref);
28$PAV->addOmim2dbsnp($dbsnp);
29is($PAV->{Omim2DBsnp}->getdbsnp("600046","0025"),"3890182","testing getdbsnp only with numbers");
30is($PAV->{Omim2DBsnp}->getdbsnp("600046","0025a"),"3890182","testing getdbsnp  with numbers and junk");
31
32
33
34
35my $string =
36"Ilkovski et al. (2001) identified a heterozygous ile136-to-met (I136M) substitution in the ACTA1 gene in a 45-year-old man with nemaline myopathy (161800). Although he had infantile-onset and delayed motor development, his weakness was nonprogressive, and he was physically active as an adult and regularly engaged in long-distance competitive cycling. He had a weak cough and frequent respiratory infections. Echocardiography was normal.";
37
38my $years=ProccesAllicVariants::fomatYears("1999");
39is( @$years[0], "1999", "formatyears" );
40
41 $years=ProccesAllicVariants::fomatYears("1999 ,2000");
42is( @$years[0], "1999", "formatyears multiple" );
43is( @$years[1], "2000", "formatyears multiple" );
44my $getauthor = ProccesAllicVariants::getAuthor($string);
45
46
47
48is( @$getauthor[0], "Ilkovski", "get author" );
49is( @$getauthor[1], "2001",     "get author year" );
50
51is( ProccesAllicVariants::getDeceaseID($string), "161800", "get decease id" );
52
53$getauthor = ProccesAllicVariants::getAuthor(
54        "Tiller et al. (1993, 1995) demonstrated that cartilage f");
55is( @$getauthor[0], "Tiller", "get author" );
56is( @$getauthor[1], "1993, 1995",   "get author year" );
57
58my $authorsAndYears = ProccesAllicVariants::formatAuthors($getauthor);
59is( @$authorsAndYears[0], "Tiller", "format author" );
60is( @$authorsAndYears[1], "1993", "format author year" );
61is( @$authorsAndYears[2], "Tiller", "format author" );
62is( @$authorsAndYears[3], "1995", "format author year " );
63
64 my $authandyear=[
65          'Nowak',
66          '1999',
67          'Ilkovski',
68          '2001'
69        ];
70
71$authorsAndYears = ProccesAllicVariants::formatAuthors($authandyear);
72
73
74$getauthor = ProccesAllicVariants::getAuthor(
75        "(Bradley et al., 1975; faf)");
76is( @$getauthor[0], "Bradley", "get author" );
77is( @$getauthor[1], "1975",   "get author year" );
78
79
80$getauthor = ProccesAllicVariants::getAuthor(
81        "See Brennan (1985).");
82is( @$getauthor[0], "Brennan", "get author" );
83is( @$getauthor[1], "1985",   "get author year" );
84
85$getauthor = ProccesAllicVariants::getAuthor(
86        " (Takahashi et al., 1987) ");
87is( @$getauthor[0], "Takahashi", "get author" );
88is( @$getauthor[1], "1987",   "get author year" );
89
90$getauthor = ProccesAllicVariants::getAuthor(
91        "Brennan and Fellowes (1993) that cartilage f");
92        is( @$getauthor[0], "Brennan and Fellowes", "get author" );
93is( @$getauthor[1], "1993",   "get author year" );
94       
95        $getauthor = ProccesAllicVariants::getAuthor("McIntosh et al., (1994)");
96        is( @$getauthor[0], "McIntosh", "get author" );
97        is( @$getauthor[1], "1994",   "get author year" );
98       
99                $getauthor = ProccesAllicVariants::getAuthor("  de Vries and de Wet (1986, 1987)
100");
101        is( @$getauthor[0], "Vries and de Wet", "get author" );
102        is( @$getauthor[1], "1986, 1987",   "get author year" );
103       
104        print("some tests based on bugs\n");
105                        $getauthor = ProccesAllicVariants::getAuthor("  Vohwinkel (1929) and Wigley (1929) ");
106        is( @$getauthor[0], "Vohwinkel", "get author" );
107        is( @$getauthor[1], "1929",   "get author year" );
108        is( @$getauthor[2], "Wigley", "get author" );
109        is( @$getauthor[3], "1929",   "get author year" );
110       
111                        $getauthor = ProccesAllicVariants::getAuthor("(604144.0001) and Y232C (604144.0012)");
112        is( @$getauthor[0], undef, "get author false positive" );
113        is( @$getauthor[1], undef,   "get author year" );
114        #(600617) and SF1 (184757) genes
115                        $getauthor = ProccesAllicVariants::getAuthor("(600617) and SF1 (184757) genes");
116        is( @$getauthor[0], undef, "get author false positive"  );
117        is( @$getauthor[1], undef,   "get author year" );
118       
119       
120        $getauthor = ProccesAllicVariants::getAuthor("titin (188840) and myosin (160710)-binding site");
121                is( @$getauthor[0], undef, "get author false positive myosin"  );
122        is( @$getauthor[1], undef,   "get author year" );
123       
124        $getauthor = ProccesAllicVariants::getAuthor("in (188840)- and myosin (160710)-binding sites.");
125                is( @$getauthor[0], undef, "get author false positive myosin"  );
126        is( @$getauthor[1], undef,   "get author year" );       
127       
128       
129$string =
130  "In patient 2 with a congenital actin myopathy (see 161800), reported by
131Goebel et al. (1997), Nowak et al. (1999) identified a heterozygous
132G-to-C transversion in exon 2 of the ACTA1 gene, resulting in a
133gly15-to-arg (G15R) substitution. The patient was delivered by emergency
134Cesarean section at 37 weeks' gestation due to maternal polyhydramnios,
135had severe hypotonia necessitating ventilatory support, and died at age
1363 months. Postmortem examination excluded spinal muscular atrophy
137(253300). Muscle biopsy showed large areas of sarcoplasm devoid of
138normal myofibrils and mitochondria, and replaced with dense masses of
139thin filaments that were immunoreactive to actin. Central cores, obvious
140rods, ragged red fibers, and necrosis were absent.";
141$string =~ tr/\n/ /;
142
143$getauthor = ProccesAllicVariants::getAuthor($string);
144is( @$getauthor[0],                               "Goebel", "get author" );
145is( @$getauthor[1],                               "1997",   "get author year" );
146is( ProccesAllicVariants::getDeceaseID($string), "161800", "get decease id" );
147is(
148        ProccesAllicVariants::extractnuclitdemutation( $string, "999" ),
149        "heterozygous G-to-C transversion in exon 2",
150        "extract exon info"
151);
152
153$string = "In a male infant with severe fatal nemaline myopathy (NEM3; 161800),
154Garcia-Angarita et al. (2009) identified heterozygosity for an allele
155carrying 2 de novo mutations in cis affecting adjacent nucleotides in
156exon 3 of the ACTA1 gene: a 222G-T transversion, resulting in a
157glu74-to-asp (E74D) substitution, and a 223C-T transition, resulting in
158a his75-to-tyr (H75Y) substitution. Neither unaffected parent carried
159either of the mutations, suggesting possible germline mosaicism.
160Garcia-Angarita et al. (2009) noted that each mutation had previously
161been reported in isolation as causative for nemaline myopathy, but had
162never been reported together on the same allele. The phenotype in their
163patient was severe, including decreased movements in utero, breech
164presentation, and congenital contractures. After birth, there was severe
165hypotonia, lack of spontaneous movements, and death from respiratory
166failure at age 2 months. Skeletal muscle biopsy showed myofibrillar
167disorganization and nemaline rods.";
168$string =~ tr/\n/ /;
169
170is(
171        ProccesAllicVariants::extractnuclitdemutation( $string, "74" ),
172        "222G-T transversion",
173        "get mutation 222G-T transversion"
174);
175
176is(
177        ProccesAllicVariants::extractnuclitdemutation(
178                "RGF 222G-T transversion ASD", "74"
179        ),
180        "222G-T transversion",
181        "get mutation 222G-T transversion"
182);
183
184is(
185        ProccesAllicVariants::extractnuclitdemutation( $string, "75" ),
186        "223C-T transition",
187        "get mutation 223C-T transition"
188);
189
190#n A-to-G transition at nucleotide 1730 in exon 13, resulting in the substitu exon 34
191
192is(
193        ProccesAllicVariants::extractnuclitdemutation( " A-to-G transition at nucleotide 1730 in exon 13, resulting in the substitu exon 34", "75" ),
194        "A-to-G transition at nucleotide 1730 in exon 13",
195        "nucleotide with exon"
196);
197
198is(
199        ProccesAllicVariants::extractnuclitdemutation("on on 1 chromosome in the proband was a T-to-C transition predicted to result in a cys1417-to-arg substitution.The mutation was located in exon 30","10"),"T-to-C transition in exon 30","T-to-C transition BLABLA in exon 30");
200#acta .00010
201$string = "In 5 affected members spanning 3 generations of a Chinese family with
202autosomal dominant congenital myopathy with cores, part of the
203phenotypic spectrum of nemaline myopathy 3 (161800), Kaindl et al.
204(2004) identified a 1110A-C transversion in the ACTA1 gene, resulting in
205a glu334-to-ala (E334A) substitution. Two members of the family
206developed adult-onset hypertrophic cardimyopathy and respiratory
207insufficiency.";
208
209$string =~ tr/\n/ /;
210
211is(
212        ProccesAllicVariants::extractnuclitdemutation( $string, "334" ),
213        "1110A-C transversion",
214        "get 1110A-C transversion"
215);
216
217#120140 .0002
218$string =
219"In a case of type II achondrogenesis-hypochondrogenesis (200610), Vissing et al. (1989) demonstrated heterozygosity for a single base change that converted glycine-943 to serine; the codon change was GGC to AGC.";
220
221#is( ProccesAllicVariants::extractnuclitdemutation( $string, "2" ),
222#       "GGC to AGC", "codon change was GGC to AGC" );
223
224
225print("\ntesting format of deletions inserts and other awkward mutations\n");
226is(
227        ProccesAllicVariants::formatInDelMutation("1-BP DEL, 1764G") ,
228        "1764delG",
229        "1-BP DEL, 1764G"
230);
231
232is(
233        ProccesAllicVariants::formatInDelMutation( "2-BP DEL, 3283TC") ,
234        "3283_3284delTC",
235        "3283_3284delTC"
236);
237
238is(
239        ProccesAllicVariants::formatInDelMutation( "40-BP DEL, NT1294") ,
240        "1294_1333del",
241        "1294_1333del"
242);
243
244is(
245        ProccesAllicVariants::formatInDelMutation( "1675A DEL") ,
246        "1675delA",
247        "1675delA"
248);
249is(
250        ProccesAllicVariants::formatInDelMutation( "1-BP INS, 1135A") ,
251        "1135_1136insA",
252        "1135_1136insA"
253);
254
255is(
256        ProccesAllicVariants::formatInDelMutation( "110-BP INS/14-BP DEL") ,
257        "110-BP INS/14-BP DEL",
258        "110-BP INS/14-BP DEL"
259);
260is(
261        ProccesAllicVariants::formatInDelMutation( "INT12-14 DEL") ,
262        "IVS12+?_IVS14+?del",
263        "IVS12+?_IVS14+?del"
264);
265
266is(
267        ProccesAllicVariants::formatInDelMutation( "INT12-14 DEL, INT16-31 DEL") ,
268        "IVS12+?_IVS14+?del,IVS16+?_IVS31+?del",
269        "IVS12+?_IVS14+?del,IVS16+?_IVS31+?del"
270);
271#BRCA1.0033: 5-BP INS, NT3171. Als de nucleotiden in de tekst gespecificeerd worden, zouden we die graag terug zien, bijv. 3171_3172insAGTCG.
272is(
273        ProccesAllicVariants::formatInDelMutation( "5-BP INS, NT3171") ,
274        "",
275        ""
276);
277is(
278        ProccesAllicVariants::formatInDelMutation( "") ,
279        "",
280        ""
281);
282
283is(
284        ProccesAllicVariants::formatInDelMutation( "") ,
285        "",
286        ""
287);
288
289is(
290        ProccesAllicVariants::formatInDelMutation( "") ,
291        "",
292        ""
293);
294
295
296
297
298my $omim_entry = $omim_parser->next_phenotype();
299my $numb       = $omim_entry->MIM_number();
300my @refs       = $omim_entry->each_Reference();    # *FIELD* RF
301
302my @avs = $omim_entry->each_AllelicVariant();
303
304is( ( $PAV->getPubmedID( \@refs, "Ilkovski", "2001", $numb ) ),
305        "11333380", "get omim record " );
306        #               $self->createAuthorsOutput( $refsref,$authorsAndYears, $numb  );
307         $authandyear=["Ilkovski", "2001"];
308is($PAV->createAuthorsOutput( \@refs, $authandyear, $numb ),"{PMID11333380:Ilkovski (2001)}","testing layout of authors");
309#grep -P -B 2 -A 3718 "313700$" data/omim.txt > test/data.bak/AR.txt
310 $filename    = "data.bak/AR.txt";
311
312 $omim_parser =
313  Bio::Phenotype::OMIM::OMIMparser->new( -omimtext => $filename );
314 $PAV = ProccesAllicVariants->new();
315$PAV->addOmim2pubmed($omim2pubmed);
316$PAV->addOmim2dbsnp($dbsnp);
317
318 $omim_entry = $omim_parser->next_phenotype();
319 $numb       = $omim_entry->MIM_number();
320 @refs       = $omim_entry->each_Reference();    # *FIELD* RF
321
322@avs = $omim_entry->each_AllelicVariant();
323
324print(Dumper(@refs));
325is( ( $PAV->getPubmedID( \@refs, "Pitteloud", "2004", $numb ) ),
326        "Pitteloud(2004) J. Clin. Endocr. Metab. 89 1053-1058 (2004)", "get omim record without omim number " );
327       
328
329is( ( $PAV->getPubmedID( \@refs, "Brown", "1989", $numb ) ),
330        "2563196", "get omim record Brown " );
331               
332is( ( $PAV->getPubmedID( \@refs, "Lumbroso", "1996", $numb ) ),
333        "8626869", "get omim record Lumbroso 100" );
334       
335        is( ( $PAV->getPubmedID( \@refs, "McPhaul", "1991", $numb ) ),
336        "2010552", "get omim record  McPhaul 112" );
337       
338                is( ( $PAV->getPubmedID( \@refs, "Migeon", "1981", $numb ) ),
339        "6947233", "get omim record Migeon 120" );
340       
341                is( ( $PAV->getPubmedID( \@refs, "Mononen", "2000", $numb ) ),
342        "11103816", "get omim record  Mononen 123" );
343       
344                        is( ( $PAV->getPubmedID( \@refs, "Montie", "2009", $numb ) ),
345        "19279159", "get omim record  Montie 124" );
346       
347#                               is( ( $PAV->getPubmedID( \@refs, "", "", $numb ) ),
348#       "", "get omim record  " );
349       
350is( ( $PAV->getPubmedID( \@refs, "Mooney", "2003", $numb ) ),
351        "12682377", "get omim record Mooney " );
352       
353is( ( $PAV->getPubmedID( \@refs, "Trifiro", "1989", $numb ) ),
354        "Trifiro (1989) (Abstract) Am. J. Hum. Genet. 45 (suppl.): A225, 1989", "get omim record whitout PMID" );
355                       
356       
357         $filename    = "data.bak/ABCA4.txt";
358
359 $omim_parser =
360  Bio::Phenotype::OMIM::OMIMparser->new( -omimtext => $filename );
361 $PAV = ProccesAllicVariants->new();
362$PAV->addOmim2pubmed($omim2pubmed);
363$PAV->addOmim2dbsnp($dbsnp);
364
365 $omim_entry = $omim_parser->next_phenotype();
366 $numb       = $omim_entry->MIM_number();
367 @refs       = $omim_entry->each_Reference();    # *FIELD* RF
368
369@avs = $omim_entry->each_AllelicVariant();
370
371is( ( $PAV->getPubmedID( \@refs, "Allikmets", "1997", $numb ) ),
372        "Pitteloud(2004) J. Clin. Endocr. Metab. 89 1053-1058 (2004)", "get omim record without omim number " );
Note: See TracBrowser for help on using the repository browser.