[Bioperl-guts-l] [16927] bioperl-live/trunk/Bio/PrimarySeq.pm: idea of bernd: set id first, then seq, so seq errors can use the id
Mark Allen Jensen
maj at dev.open-bio.org
Tue Mar 23 16:36:53 EDT 2010
Revision: 16927
Author: maj
Date: 2010-03-23 16:36:52 -0400 (Tue, 23 Mar 2010)
Log Message:
-----------
idea of bernd: set id first, then seq, so seq errors can use the id
Modified Paths:
--------------
bioperl-live/trunk/Bio/PrimarySeq.pm
Modified: bioperl-live/trunk/Bio/PrimarySeq.pm
===================================================================
--- bioperl-live/trunk/Bio/PrimarySeq.pm 2010-03-23 04:46:53 UTC (rev 16926)
+++ bioperl-live/trunk/Bio/PrimarySeq.pm 2010-03-23 20:36:52 UTC (rev 16927)
@@ -220,6 +220,12 @@
# when the sequence is set
$alphabet && $self->alphabet($alphabet);
+ # bernd's idea: define ids so that invalid sequence messages
+ # can be more informative...
+ defined $id && $self->display_id($id);
+ $acc && $self->accession_number($acc);
+ defined $pid && $self->primary_id($pid);
+
# if there is an alphabet, and direct is passed in, assume the alphabet
# and sequence is ok
@@ -234,9 +240,6 @@
$self->seq($seq) if defined($seq);
}
- defined $id && $self->display_id($id);
- $acc && $self->accession_number($acc);
- defined $pid && $self->primary_id($pid);
$desc && $self->desc($desc);
$description && $self->description($description);
$is_circular && $self->is_circular($is_circular);
@@ -281,7 +284,7 @@
if(@args) {
if(defined($value) && (! $obj->validate_seq($value))) {
- $obj->throw("Attempting to set the sequence to [$value] ".
+ $obj->throw("Attempting to set the sequence '".$obj->id."' to [$value] ".
"which does not look healthy");
}
# if a sequence was already set we make sure that we re-adjust the
@@ -337,7 +340,7 @@
return 0 unless( defined $seqstr);
if((CORE::length($seqstr) > 0) &&
($seqstr !~ /^([$MATCHPATTERN]+)$/)) {
- $self->warn("seq doesn't validate, mismatch is " .
+ $self->warn("sequence '".$self->id."' doesn't validate, mismatch is " .
join(",",($seqstr =~ /([^$MATCHPATTERN]+)/g)));
return 0;
}
More information about the Bioperl-guts-l
mailing list