[Bioperl-guts-l] bioperl commit

Stefan Kirov skirov at pub.open-bio.org
Mon May 24 20:53:18 EDT 2004


skirov
Mon May 24 20:53:18 EDT 2004
Update of /home/repository/bioperl/bioperl-live/Bio/Matrix/PSM/IO
In directory pub.open-bio.org:/tmp/cvs-serv29299

Modified Files:
	meme.pm 
Log Message:
critical bug- when instance sequence at the end of the input sequence

bioperl-live/Bio/Matrix/PSM/IO meme.pm,1.10,1.11
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/Matrix/PSM/IO/meme.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- /home/repository/bioperl/bioperl-live/Bio/Matrix/PSM/IO/meme.pm	2004/05/06 12:39:52	1.10
+++ /home/repository/bioperl/bioperl-live/Bio/Matrix/PSM/IO/meme.pm	2004/05/25 00:53:18	1.11
@@ -79,6 +79,7 @@
     $self->{file} = $file;
     $self->{query}= $query;
     $self->{end}  = 0;
+    $self->{_strand}=0; #This we'll need to see if revcom option is used
     $self->_initialize_io(@args) || warn "Did you intend to use STDIN?"; #Read only for now
     #Skip header
     my $line;
@@ -184,6 +185,8 @@
 	if ($line=~ m/\sSite\s/) {
 	    $instances= $self->_parseInstance;
 	}
+#Check if revcom is enabled, not very original check....
+  $self->{_strand}=1 if (($line=~/^Sequence name/) && ($line=~/Strand/));
 	#Here starts the next motif
 	if ( ($line=~/width/) && ($line=~/sites/)) {
 	    chomp($line);
@@ -260,7 +263,6 @@
 	$i++;
 	$line=$self->_readline;
     } until $line =~ /\-{10,}/;
-    
     return (-pA=>\@pA,-pC=>\@pC,-pG=>\@pG,-pT=>\@pT,-id=>$id);
 }
 
@@ -301,7 +303,7 @@
  Title   : _parseInstance
  Usage   :
  Function:  Parses the next sites instances from the meme file
- Throws  :  If the parser cannot find the correct number of columns
+ Throws  :
  Example :  Internal stuff
  Returns :  Bio::Matrix::PSM::InstanceSite object
  Args    :  none
@@ -311,7 +313,6 @@
 sub _parseInstance {
     my $self = shift;
     my $i=0;
-    
     $self->_readline;
     my ($line, at instance);
     while (defined($line=$self->_readline) ) {
@@ -319,17 +320,17 @@
 	chomp($line);
 	my @comp=split(/\s+/,$line);
 	my ($id,$start,$score,$strand,$s1,$s2,$s3);
-	if ( $#comp == 6) { #Revcomp enabled
+	if ( $self->{_strand}) {
 	    ($id,$strand,$start,$score,$s1,$s2,$s3)=@comp;
-	} elsif ( $#comp==5) {
+	} else {
 	    ($id,$start,$score,$s1,$s2,$s3)=@comp;
 	    $strand=1;
 	}
-	else {
-	    my $col=$#comp; 
-	    $self->throw("Cannot parse this matrix instances, probably a format issue: $col columns\n"); 
-	} #Throw if incorrect column number
-	my $seq= $s1.$s2.$s3;
+  	my $seq= $s1.$s2.$s3;
+	if ($seq =~ /[^ACGTacgtNnXx-]/) {
+            my $col=$#comp;
+	    $self->throw("I have not been able to parse the correct instance sequence: $seq, $col columns\n");
+	}
 	my $sid = $self->{id} . '@' . $id;
 	$instance[$i] = new Bio::Matrix::PSM::InstanceSite
 	    (-mid      => $self->{id}, 



More information about the Bioperl-guts-l mailing list