Boulder/LocusLink.pm untested

filter: Statementstmt 0.0% 0 / 314 Branchbran 0.0% 0 / 122 Conditioncond 0.0% 0 / 30 MC/DCmcdc 0.0% 0 / 19 Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 18 totaltotal 0.0% 0 / 527 CC 62 SCAR 68.7
CC
62
Cov
0%
parse
1892.0
read_record
56.0
new
12.0
CRAP 964.1
1 package Boulder::LocusLink;
2 use Boulder::Stream;
3 require Exporter;
4 @ISA = qw(Exporter Boulder::Stream);
5 @EXPORT = ();
6 @EXPORT_OK = ();
7 use Carp;
8 $VERSION=1.00;
9 use constant DEFAULT_LOCUSLINK_PATH => '/data/LocusLink/LL_tmpl';
10  
11 =head1 NAME
12  
13 Boulder::LocusLink - Fetch LocusLink data records as parsed Boulder Stones
14  
15 =head1 SYNOPSIS
16  
17 # parse a file of LocusLink records
18 $ll = new Boulder::LocusLink(-accessor=>'File',
19 -param => '/home/data/LocusLink/LL_tmpl');
20 while (my $s = $ll->get) {
21 print $s->Identifier;
22 print $s->Gene;
23 }
24  
25 # parse flatfile records yourself
26 open (LL,"/home/data/LocusLink/LL_tmpl");
27 local $/ = "*RECORD*";
28 while (<LL>) {
29 my $s = Boulder::LocusLink->parse($_);
30 # etc.
31 }
32  
33 =head1 DESCRIPTION
34  
35 Boulder::LocusLink provides retrieval and parsing services for LocusLink records
36  
37 Boulder::LocusLink provides retrieval and parsing services for NCBI
38 LocusLink records. It returns Unigene entries in L<Stone>
39 format, allowing easy access to the various fields and values.
40 Boulder::LocusLink is a descendent of Boulder::Stream, and provides a
41 stream-like interface to a series of Stone objects.
42  
43 Access to LocusLink is provided by one I<accessors>, which
44 give access to local LocusLink database. When you
45 create a new Boulder::LocusLink stream, you provide the
46 accessors, along with accessor-specific parameters that control what
47 entries to fetch. The accessors is:
48  
49 =over 2
50  
51 =item File
52  
53 This provides access to local LocusLink entries by reading from a flat file
54 (typically Hs.dat file downloadable from NCBI's Ftp site).
55 The stream will return a Stone corresponding to each of the entries in
56 the file, starting from the top of the file and working downward. The
57 parameter is the path to the local file.
58  
59 =back
60  
61 It is also possible to parse a single LocusLink entry from a text string
62 stored in a scalar variable, returning a Stone object.
63  
64 =head2 Boulder::LocusLink methods
65  
66 This section lists the public methods that the I<Boulder::LocusLink>
67 class makes available.
68  
69 =over 4
70  
71 =item new()
72  
73 # Local fetch via File
74 $ug=new Boulder::LocusLink(-accessor => 'File',
75 -param => '/data/LocusLink/Hs.dat');
76  
77 The new() method creates a new I<Boulder::LocusLink> stream on the
78 accessor provided. The only possible accessors is B<File>.
79 If successful, the method returns the stream
80 object. Otherwise it returns undef.
81  
82 new() takes the following arguments:
83  
84 -accessor Name of the accessor to use
85 -param Parameters to pass to the accessor
86  
87 Specify the accessor to use with the B<-accessor> argument. If not
88 specified, it defaults to B<File>.
89  
90 B<-param> is an accessor-specific argument. The possibilities is:
91  
92 For B<File>, the B<-param> argument must point to a string-valued
93 scalar, which will be interpreted as the path to the file to read
94 LocusLink entries from.
95  
96 =item get()
97  
98 The get() method is inherited from I<Boulder::Stream>, and simply
99 returns the next parsed LocusLink Stone, or undef if there is nothing
100 more to fetch. It has the same semantics as the parent class,
101 including the ability to restrict access to certain top-level tags.
102  
103 =item put()
104  
105 The put() method is inherited from the parent Boulder::Stream class,
106 and will write the passed Stone to standard output in Boulder format.
107 This means that it is currently not possible to write a
108 Boulder::LocusLink object back into LocusLink flatfile form.
109  
110 =back
111  
112 =head1 OUTPUT TAGS
113  
114 The tags returned by the parsing operation are taken from the names shown in the Flat file
115 Hs.dat since no better description of them is provided yet by the database source producer.
116  
117 =head2 Top-Level Tags
118  
119 These are tags that appear at the top level of the parsed LocusLink
120 entry.
121  
122 =over 4
123  
124 =item Identifier
125  
126 The LocusLink identifier of this entry. Identifier is a single-value tag.
127  
128 Example:
129
130 my $identifierNo = $s->Identifier;
131  
132 =item Current_locusid
133  
134 If a locus has been merged with another, the Current_locusid contains the
135 previous LOCUSID line (A bit confusing, shall be called "previous_locusid",
136 but this is defined in NCBI README File ... ).
137  
138 Example:
139 my $prevlocusid=$s->Current_locusid;
140  
141 =item Organism
142 Source species ased on NCBI's Taxonomy
143  
144 Example:
145 my $theorganism=$s->Organism;
146  
147 =item Status
148 Type of reference sequence record. If "PROVISIONAL"
149 then means that is generated automatically from existing Genbank record and
150 information stored in the LocusLink database, no curation. If "REVIEWED"
151 than it means that is generated from the most representative complete
152 GenBank sequence or merge of GenBank sequenes and from information stored in
153 the LocusLink database
154  
155 Example:
156 my $thestatus=$s->Status;
157  
158 =item LocAss
159 Here comes a complex record ... made up of
160 LOCUS_STRING,
161 NM The value in the LOCUS field of the RefSeq record ,
162 NP The RefSeq accession number for an mRNA record,
163 PRODUCT The name of the produc tof this transcript,
164 TRANSVAR a variant-specific description,
165 ASSEMBLY The Genbank accession used to assemble the refseq record
166  
167 Example:
168 my $theprod=$s->LocAss->Product;
169  
170 =item AccProt
171 Here comes a complex record ... made up of
172 ACCNUM Nucleotide sequence accessio number
173 TYPE e=EST, m=mRNA, g=Genomic
174 PROT set of PID values for the coding region or regions
175 annotated on the nucleotide record. The first value
176 is the PID (an integer or null), then either MMDB or na,
177 separated from the PID by a |. If MMDB is present, it
178 indicates there are structur edata available for a protein
179 related to the protein referenced by the PID
180 Example:
181 my $theprot=$s->AccProt->Prot;
182  
183 =item OFFICIAL_SYMBOL
184 The symbol used for gene reports, validated by the appropriate nomenclature
185 committee
186  
187 =item PREFERRED_SYMBOL
188 Interim symbol used for display
189  
190 =item OFFICIAL_GENE_NAME
191 The gene description used for gene reports validate by the appropriate nomenclatur eommittee. If the symbol is official, the gene name will be official. No records will have both official and interim nomenclature.
192  
193 =item PREFERRED_GENE_NAME
194 Interim used for display
195  
196 =item PREFERRED_PRODUCT
197 The name of the product used in the RefSeq record
198  
199 =item ALIAS_SYMBOL
200 Other symbols associated with this gene
201  
202 =item ALIAS_PROT
203 Other protein names associated with this gene
204  
205 =item PhenoTable
206 A complex record made up of
207 Phenotype
208 Phenotype_ID
209  
210 =item SUmmary
211  
212 =item Unigene
213  
214 =item Omim
215  
216 =item Chr
217  
218 =item Map
219  
220 =item STS
221  
222 =item ECNUM
223  
224 =item ButTable
225 BUTTON
226 LINK
227  
228 =item DBTable
229 DB_DESCR
230 DB_LINK
231  
232 =item PMID
233 a subset of publications associated with this locus with the link being the
234 PubMed unique identifier comma separated
235  
236 =back
237  
238 =head1 SEE ALSO
239  
240 L<Boulder>, L<Boulder::Blast>, L<Boulder::Genbank>
241  
242 =head1 AUTHOR
243  
244 Lincoln Stein <lstein@cshl.org>.
245 Luca I.G. Toldo <luca.toldo@merck.de>
246  
247 Copyright (c) 1997 Lincoln D. Stein
248 Copyright (c) 1999 Luca I.G. Toldo
249  
250 This library is free software; you can redistribute it and/or modify
251 it under the same terms as Perl itself. See DISCLAIMER.txt for
252 disclaimers of warranty.
253  
254 =cut
255  
256 #
257 # Following did not require any changes compared to Genbank.pm
258 #
259 sub new {
260 my($package,@parameters) = @_;
261 # superclass constructor
262 my($self) = new Boulder::Stream;
263
264 # figure out whether parameters are named. Look for
265 # an initial '-'
266 if ($parameters[0]=~/^-/) {
267 my(%parameters) = @parameters;
268 $self->{'accessor'}=$parameters{'-accessor'} || 'File';
269 $self->{'param'}=$parameters{'-param'};
270 $self->{'OUT'}=$parameters{'-out'} || 'main::STDOUT';
271 } else {
272 $self->{'accessor'}='File';
273 $self->{'param'}=[@parameters];
274 }
275
276 croak "Require parameters" unless defined($self->{'param'});
277 $self->{'accessor'} = new {$self->{'accessor'}}($self->{'param'});
278
279 return bless $self,$package;
280 }
281  
282 #
283 # Following required no changes compared to Genbank.pm
284 #
285 sub read_record {
286 my($self,@tags) = @_;
287 my($s);
288  
289 if (wantarray) {
290 my(@result);
291 while (!$self->{'done'}) {
292 $s = $self->read_one_record(@tags);
293 next unless $s;
294 next if $query && !(&$query);
295 push(@result,$s);
296 }
297 return @result;
298 }
299  
300 # we get here if in a scalar context
301 while (!$self->{'done'}) {
302 $s = $self->read_one_record(@tags);
303 next unless $s;
304 return $s unless $query;
305 return $s if &$query;
306 }
307 return undef;
308 }
309  
310 #<LIGT>
311 # Here is everything new
312 #</LIGT>
313 sub parse {
314 my $self = shift;
315 my $record = shift;
316 return unless $record;
317 my $tags = shift;
318 my %ok;
319 %ok = map {$_ => 1} @$tags if ref($tags) eq 'ARRAY';
320 my($s,@lines,$line,$accumulated,$key,$keyword,$value,$feature,@features, $label);
321
322 $s = new Stone;
323 #<LIGT> following this line the parsing of the record must be done
324 # each key-value pair is stored by the following command:
325 # $self->_addToStone($key,$value,$stone,\%ok);
326 #
327 # Process new record lines
328 #
329 #
330 (@recordlines)=split(/\n/,$record);
331 undef $LocusLinkid, $curlocusid, $organism, $status, $locusstring;
332 undef @locass;
333 foreach $line (@recordlines) {
334 if ($line=~/^LOCUSID:/) {
335 ($key,$LocusLinkid)=split(/\s+/,$line);
336 $self->_addToStone('Identifier',$LocusLinkid,$s,\%ok);
337 } elsif ($line=~/^CURRENT_LOCUSID/) {
338 ($key,$curlocusid)=split(/\s+/,$line);
339 $self->_addToStone('Current_locusid',$curlocusid,$s,\%ok);
340 } elsif ($line=~/^ORGANISM/) {
341 ($key,$organism)=split(/\s+/,$line);
342 $self->_addToStone('Organism',$organism,$s,\%ok);
343 } elsif ($line=~/^STATUS/) {
344 ($key,$status)=split(/\s+/,$line);
345 $self->_addToStone('Status',$status,$s,\%ok);
346 # special case for the LOCUS_STRING .. ASSEMBLY table
347 } elsif ($line=~/^LOCUS_STRING/..$line=~/^ASSEMBLY/) {
348 if ($line=~/^LOCUS_STRING:/) {
349 undef @locass;
350 ($key,$locusstring)=split(/\s+/,$line);
351 $locass= {'label'=>'LOCUS_STRING','value'=>$locusstring};
352 push(@locass,$locass);
353 }
354 if ($line=~/^NM:/) {
355 ($key,$nm)=split(/\s+/,$line);
356 $locass= {'label'=>'NM','value'=>$nm};
357 push(@locass,$locass);
358 }
359 if ($line=~/^NP:/) {
360 ($key,$np)=split(/\s+/,$line);
361 $locass= {'label'=>'NP','value'=>$np};
362 push(@locass,$locass);
363 }
364 if ($line=~/^PRODUCT:/) {
365 ($key,$product)=split(/\s+/,$line);
366 $locass= {'label'=>'PRODUCT','value'=>$product};
367 push(@locass,$locass);
368 }
369 if ($line=~/^TRANSVAR:/) {
370 ($key,$transvar)=split(/\s+/,$line);
371 $locass= {'label'=>'TRANSVAR','value'=>$transvar};
372 push(@locass,$locass);
373 }
374 if ($line=~/^ASSEMBLY:/) {
375 ($key,$assembly)=split(/\s+/,$line);
376 $locass= {'label'=>'ASSEMBLY','value'=>$assembly};
377 push(@locass,$locass);
378 $self->_addLocassToStone(\@locass,_trim($'),$s,\%ok);
379 next;
380 }
381 # special case for the ACCNUM .. SYMBOL table
382 } elsif ($line=~/^ACCNUM/..$line=~/_SYMBOL:/) {
383 if ($line=~/^ACCNUM:/) {
384 undef @accsym;
385 ($key,$accnum)=split(/\s+/,$line);
386 $accsym= {'label'=>'ACCNUM','value'=>$accnum};
387 push(@accsym,$accsym);
388 }
389 if ($line=~/^TYPE:/) {
390 ($key,$type)=split(/\s+/,$line);
391 if ($type=~/e/) {
392 $type="EST";
393 } elsif ($type=~/m/) {
394 $type="mRNA";
395 } elsif ($type=~/g/) {
396 $type="genomic";
397 }
398 $accsym= {'label'=>'TYPE','value'=>$type};
399 push(@accsym,$accsym);
400 }
401 if ($line=~/^PROT:/) {
402 ($key,$prot)=split(/\s+/,$line);
403 $accsym= {'label'=>'PROT','value'=>$prot};
404 push(@accsym,$accsym);
405 }
406 if ($line=~/_SYMBOL:/) {
407 $self->_addAccSymToStone(\@accsym,_trim($'),$s,\%ok);
408 ($key,$value)=split(/:\s+/,$line);
409 $self->_addToStone($key,$value,$s,\%ok);
410 }
411 } elsif ($line=~/_GENE_NAME:/) {
412 ($key,$value)=split(/:\s+/,$line);
413 $self->_addToStone($key,$value,$s,\%ok);
414 } elsif ($line=~/^PREFERRED_PRODUCT:/) {
415 ($key,$value)=split(/:\s+/,$line);
416 $self->_addToStone($key,$value,$s,\%ok);
417 } elsif ($line=~/^ALIAS_SYMBOL:/) {
418 ($key,$value)=split(/:\s+/,$line);
419 $self->_addToStone($key,$value,$s,\%ok);
420 } elsif ($line=~/^ALIAS_PROT:/) {
421 ($key,$value)=split(/:\s+/,$line);
422 $self->_addToStone($key,$value,$s,\%ok);
423 # special case for the PHENOTYPE table
424 } elsif ($line=~/^PHENOTYPE/..$line=~/PHENOTYPE_ID:/) {
425 if ($line=~/^PHENOTYPE:/) {
426 undef @pheno;
427 ($key,$pheno)=split(/\s+/,$line);
428 $phenol= {'label'=>'PHENOTYPE','value'=>$pheno};
429 push(@phenol,$phenol);
430 }
431 if ($line=~/^PHENOTYPE_ID:/) {
432 ($key,$phenoid)=split(/\s+/,$line);
433 $phenol= {'label'=>'PHENOTYPE_ID','value'=>$phenoid};
434 push(@phenol,$phenol);
435 $self->_addPhenotypeToStone(\@phenol,_trim($'),$s,\%ok);
436 next;
437 }
438 } elsif ($line=~/^SUMMARY:/) {
439 ($key,$value)=split(/:\s+/,$line);
440 $self->_addToStone($key,$value,$s,\%ok);
441 } elsif ($line=~/^UNIGENE:/) {
442 ($key,$value)=split(/:\s+/,$line);
443 $self->_addToStone($key,$value,$s,\%ok);
444 } elsif ($line=~/^OMIM:/) {
445 ($key,$value)=split(/:\s+/,$line);
446 $self->_addToStone($key,$value,$s,\%ok);
447 } elsif ($line=~/^CHR:/) {
448 ($key,$value)=split(/:\s+/,$line);
449 $self->_addToStone('Chromosome',$value,$s,\%ok);
450 } elsif ($line=~/^MAP:/) {
451 ($key,$value)=split(/:\s+/,$line);
452 $self->_addToStone('Cytogenetic_location',$value,$s,\%ok);
453 } elsif ($line=~/^STS/) {
454 undef @ststab,@stsraw,$stsr,$markname,$chrnum,$sts_id,$d_seg,$a;
455 ($key,$stsr)=split(/\s+/,$line);
456 ($markname,$chrnum,$sts_id,$d_seg)=split(/\|/,$stsr);
457 $a= {'label'=>'Marker_Name','value'=>$markname};
458 push(@ststab,$a);
459 $a= {'label'=>'Chromosome_Number','value'=>$chrnum};
460 push(@ststab,$a);
461 $a= {'label'=>'Sts_id','value'=>$sts_id};
462 push(@ststab,$a);
463 $a= {'label'=>'D_Segment','value'=>$d_seg};
464 push(@ststab,$a);
465 $self->_addStsToStone(\@ststab,_trim($'),$s,\%ok);
466 } elsif ($line=~/^ECNUM/) {
467 ($key,$value)=split(/:\s+/,$line);
468 $self->_addToStone('EC',$value,$s,\%ok);
469 } elsif ($line=~/^BUTTON:/..$line=~/^LINK:/) {
470 if ($line=~/^BUTTON:/) {
471 undef @pheno;
472 ($key,$pheno)=split(/\s+/,$line);
473 $phenol= {'label'=>'BUTTON','value'=>$pheno};
474 push(@phenol,$phenol);
475 }
476 if ($line=~/^LINK:/) {
477 ($key,$phenoid)=split(/\s+/,$line);
478 $phenol= {'label'=>'LINK','value'=>$phenoid};
479 push(@phenol,$phenol);
480 $self->_addButtonToStone(\@phenol,_trim($'),$s,\%ok);
481 next;
482 }
483 } elsif ($line=~/^DB_DESCR:/..$line=~/^DB_LINK:/) {
484 if ($line=~/^DB_DESCR:/) {
485 undef @pheno;
486 ($key,$pheno)=split(/\s+/,$line);
487 $phenol= {'label'=>'DB_DESCR','value'=>$pheno};
488 push(@phenol,$phenol);
489 }
490 if ($line=~/^DB_LINK:/) {
491 ($key,$phenoid)=split(/\s+/,$line);
492 $phenol= {'label'=>'DB_LINK','value'=>$phenoid};
493 push(@phenol,$phenol);
494 $self->_addDBToStone(\@phenol,_trim($'),$s,\%ok);
495 next;
496 }
497 } elsif ($line=~/^PMID:/) {
498 ($key,$value)=split(/:\s+/,$line);
499 (@medlinearray)=split(/\,/,$value);
500 foreach $medlineid (@medlinearray) {
501 $self->_addToStone('MedlineID',$medlineid,$s,\%ok);
502 }
503 }
504 }
505 #</LIGT>
506 return $s;
507 }
508  
509 #
510 # Following is unchanged from Genbank.pm
511 #
512 sub read_one_record {
513 my($self,@tags) = @_;
514 my(%ok);
515 my $accessor = $self->{'accessor'};
516 my $record = $accessor->fetch_next();
517 unless ($record) {
518 $self->{'done'}++;
519 return undef;
520 }
521  
522 return $self->parse($record,\@tags);
523 }
524  
525 #
526 # Following is unchanged from Genbank.pm
527 #
528 sub _trim {
529 my($v) = @_;
530 $v=~s/^\s+//;
531 $v=~s/\s+$//;
532 return $v;
533 }
534  
535 #
536 # Following is unchanged from Genbank.pm
537 #
538 sub _canonicalize {
539 my $h = shift;
540 substr($h,0)=~tr/a-z/A-Z/;
541 substr($h,1,length($h)-1)=~tr/A-Z/a-z/;
542 $h;
543 }
544  
545 #
546 # Following is unchanged from Genbank.pm
547 #
548 sub _addToStone {
549 my($self,$xlabel,$value,$stone,$ok) = @_;
550 return unless !%{$ok} || $ok->{$xlabel};
551 $stone->insert(_canonicalize($xlabel),$value);
552 }
553  
554 #<LIGT>
555 # Following is entirely rewritten
556 #</LIGT>
557  
558 sub _addLocassToStone {
559 my($self,$features,$basecount,$stone,$ok) = @_;
560 if (!%{$ok} || $ok->{'LocAss'}) {
561 # now add the features
562 my($f) = new Stone;
563 my %qualifiers;
564 foreach (@$features) {
565 my($q) = $_->{'value'};
566 my($label) = _canonicalize($_->{'label'});
567 $f->insert($label,$q);
568 }
569 $stone->insert('LocAss',$f);
570 }
571 }
572  
573 sub _addAccSymToStone {
574 my($self,$features,$basecount,$stone,$ok) = @_;
575 if (!%{$ok} || $ok->{'AccSym'}) {
576 # now add the features
577 my($f) = new Stone;
578 my %qualifiers;
579 foreach (@$features) {
580 my($q) = $_->{'value'};
581 my($label) = _canonicalize($_->{'label'});
582 $f->insert($label,$q);
583 }
584 $stone->insert('AccSym',$f);
585 }
586 }
587  
588 sub _addPhenotypeToStone {
589 my($self,$features,$basecount,$stone,$ok) = @_;
590 if (!%{$ok} || $ok->{'PhenoTable'}) {
591 # now add the features
592 my($f) = new Stone;
593 my %qualifiers;
594 foreach (@$features) {
595 my($q) = $_->{'value'};
596 my($label) = _canonicalize($_->{'label'});
597 $f->insert($label,$q);
598 }
599 $stone->insert('PhenoTable',$f);
600 }
601 }
602  
603 sub _addStsToStone {
604 my($self,$features,$basecount,$stone,$ok) = @_;
605 if (!%{$ok} || $ok->{'StsTable'}) {
606 # now add the features
607 my($f) = new Stone;
608 my %qualifiers;
609 foreach (@$features) {
610 my($q) = $_->{'value'};
611 my($label) = _canonicalize($_->{'label'});
612 $f->insert($label,$q);
613 }
614 $stone->insert('StsTable',$f);
615 }
616 }
617  
618 sub _addButtonToStone {
619 my($self,$features,$basecount,$stone,$ok) = @_;
620 if (!%{$ok} || $ok->{'ButtonTable'}) {
621 # now add the features
622 my($f) = new Stone;
623 my %qualifiers;
624 foreach (@$features) {
625 my($q) = $_->{'value'};
626 my($label) = _canonicalize($_->{'label'});
627 $f->insert($label,$q);
628 }
629 $stone->insert('ButtonTable',$f);
630 }
631 }
632  
633 sub _addDBToStone {
634 my($self,$features,$basecount,$stone,$ok) = @_;
635 if (!%{$ok} || $ok->{'DBTable'}) {
636 # now add the features
637 my($f) = new Stone;
638 my %qualifiers;
639 foreach (@$features) {
640 my($q) = $_->{'value'};
641 my($label) = _canonicalize($_->{'label'});
642 $f->insert($label,$q);
643 }
644 $stone->insert('DBTable',$f);
645 }
646 }
647 # -------------------------- DEFINITION OF ACCESSOR OBJECTS ------------------------------
648 #<LIGT>
649 #only name changes for avoid namespace collisions
650 #</LIGT>
651 package LocusLinkAccessor;
652 use Carp;
653  
654 sub new {
655 my($class,@parameters) = @_;
656 croak "LocusLinkAccessor::new: Abstract class\n";
657 }
658  
659 sub fetch_next {
660 my($self) = @_;
661 croak "LocusLinkAccessor::fetch_next: Abstract class\n";
662 }
663  
664 sub DESTROY {
665 }
666  
667 #<LIGT>
668 # Following, only the File package since the only one supported.
669 # If other access methods must be supported, then here appropriate
670 # packages and methods must be implemented
671 #</LIGT>
672 package File;
673 use Carp;
674 @ISA=qw(LocusLinkAccessor);
675 $DEFAULT_PATH = Boulder::LocusLink::DEFAULT_LOCUSLINK_PATH();
676  
677 #<LIGT>
678 # Following, removed the search for the string locus in the file
679 # as validation that the input be compliant with parser
680 #</LIGT>
681 sub new {
682 my($package,$path) = @_;
683 $path = $DEFAULT_PATH unless $path;
684 open (UG,$path) or croak "File::new(): couldn't open $path: $!";
685 # read the junk at the beginning
686 my $found; $found++;
687 croak "File::new(): $path doesn't look like a LocusLink flat file"
688 unless $found;
689 $_ = <UG>;
690 return bless {'fh'=>UG},$package;
691 }
692  
693 #<LIGT>
694 # Following, changed the record separator
695 #</LIGT>
696 sub fetch_next {
697 my $self = shift;
698 return undef unless $self->{'fh'};
699 local($/)=">>";
700 my($line);
701 my($fh) = $self->{'fh'};
702 chomp($line = <$fh>);
703 return $line;
704 }
705  
706 1;
707  
708 __END__