[Bioperl-l] Bio::Variation::SeqDiff, Bio::Variation::VariantI
Heikki Lehvaslaiho
heikki@ebi.ac.uk
Fri, 07 Jun 2002 15:36:05 +0100
Eckhard,
I've cleaned your code a bit (and fixed one one-off error) and put it into
SeqDiff.pm in CVS HEAD (it changes the behaviour of the method so bug fix
release 1.01 will not have it). It will not calculate the mutated DNA
sequence if is has been already set. Is that OK?
-Heikki
Eckhard Lehmann wrote:
> Heikki,
>
> I think the best way is to initiate a private (or public?) method
> "_set_dnamut()" which sets up the dna_mut in the way described. It can
> be called in the current "dna_mut()" method and can be changed
> afterwards by someone else.
> So I don't need to change too much of the existing methods.
>
> The code at the end of this mail works fine for now.
>
> Eckhard
>
> #------------------------------------------------------------------
> sub _set_dnamut {
> my $self = shift;
>
> return 0 unless $self->dna_ori && $self->each_Variant;
>
> $self->dna_mut($self->dna_ori);
> foreach ($self->each_Variant) {
> next unless $_->isMutation;
>
> my ($s, $la, $le);
> #lies the mutation lesser than 25 bases after the start of sequence?
> if ($_->start < 25) {$s = 0; $la = $_->start;}
> else {$s = $_->start - 25; $la = 25;}
>
> #is the mutation an insertion?
> $_->end($_->start) unless $_->allele_ori->seq;
>
> #does the mutation end greater than 25 bases before the end of
> #sequence?
> if (($_->end + 25) > length($self->dna_mut)) {
> $le = length($self->dna_mut) - $_->end;
> } else {$le = 25;}
>
> $_->dnStreamSeq(substr($self->dna_mut, $s, $la));
> $_->upStreamSeq(substr($self->dna_mut, $_->end, $le));
>
> my $s_ori = $_->dnStreamSeq . $_->allele_ori->seq . $_->upStreamSeq;
> my $s_mut = $_->dnStreamSeq . $_->allele_mut->seq . $_->upStreamSeq;
> (my $str = $self->dna_mut) =~ s/$s_ori/$s_mut/;
> $self->dna_mut($str);
> }
> }
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
--
______ _/ _/_____________________________________________________
_/ _/ http://www.ebi.ac.uk/mutations/
_/ _/ _/ Heikki Lehvaslaiho heikki@ebi.ac.uk
_/_/_/_/_/ EMBL Outstation, European Bioinformatics Institute
_/ _/ _/ Wellcome Trust Genome Campus, Hinxton
_/ _/ _/ Cambs. CB10 1SD, United Kingdom
_/ Phone: +44 (0)1223 494 644 FAX: +44 (0)1223 494 468
___ _/_/_/_/_/________________________________________________________