Permalink
Browse files

fix parser so that it only reads frequencies up to the number expecte…

…d, the rest of the line is comment I assume (and is dropped)

svn path=/bioperl-pedigree/trunk/; revision=12112
  • Loading branch information...
1 parent 169cfd4 commit 0b39eab7a4862a223ea30cf8e3a5c298eff379e3 @hyphaltip hyphaltip committed Jun 25, 2003
Showing with 2 additions and 2 deletions.
  1. +2 −2 Bio/Pedigree/PedIO/ped.pm
@@ -121,7 +121,7 @@ sub read_pedigree{
$line =~ s/\#//g;
#name may be undefined. assign it the marker id number if
#we don't have it.
- my($type,$alleles, $name) = split(/\s+/,$line);
+ my($type,$num_alleles, $name) = split(/\s+/,$line);
$name ||= $_;
# $name =~ s/\#//;
my $marker;
@@ -150,8 +150,8 @@ sub read_pedigree{
$line = $fh->_readline;
$line =~ s/^\s+(\S+)/$1/;
my( $count,%alleles) = ( 1 );
-
foreach my $freq ( split(/\s+/,$line) ) {
+ last if $count >= $num_alleles;
$alleles{$count++} = $freq;
}

0 comments on commit 0b39eab

Please sign in to comment.