source: test/test.pl @ 7

Last change on this file since 7 was 7, checked in by maarten, 10 years ago

added rewriting of insertions and deletions

File size: 10.5 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 => 57;
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"),"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);
260
261#BRCA1.0033: 5-BP INS, NT3171. Als de nucleotiden in de tekst gespecificeerd worden, zouden we die graag terug zien, bijv. 3171_3172insAGTCG.
262is(
263        ProccesAllicVariants::formatInDelMutation( "5-BP INS, NT3171") ,
264        "",
265        ""
266);
267is(
268        ProccesAllicVariants::formatInDelMutation( "") ,
269        "",
270        ""
271);
272
273is(
274        ProccesAllicVariants::formatInDelMutation( "") ,
275        "",
276        ""
277);
278
279is(
280        ProccesAllicVariants::formatInDelMutation( "") ,
281        "",
282        ""
283);
284
285
286
287
288my $omim_entry = $omim_parser->next_phenotype();
289my $numb       = $omim_entry->MIM_number();
290my @refs       = $omim_entry->each_Reference();    # *FIELD* RF
291
292my @avs = $omim_entry->each_AllelicVariant();
293
294is( ( $PAV->getPubmedID( \@refs, "Ilkovski", "2001", $numb ) ),
295        "11333380", "get omim record " );
296        #               $self->createAuthorsOutput( $refsref,$authorsAndYears, $numb  );
297         $authandyear=["Ilkovski", "2001"];
298is($PAV->createAuthorsOutput( \@refs, $authandyear, $numb ),"{PMID11333380: Ilkovski (2001)}","testing layout of authors");
299
Note: See TracBrowser for help on using the repository browser.