Hi all
Just for fun (really no context) i was wondering how to create regular
expressions that
will never match any string.

/^[^\w\W]/ is one of them am I right? No string can start with a character
that is neither alphanumeric nor  nonalhanumeric.

But why does
/^[^.\n]/ matches .
doesn't that mean the string should begin a character that is not  any
character or not a newline(nothing else should be left).

Could someone enligthen me?
Below is to code I use to check.
thanks
oznur

use strict;
use warnings;

my $string="does it match";

if ($string=~/(^[^\w\W])/){
  print "matches $1\n";
}
else  {
  print "doesn't match \n";
}

if ($string=~/(^[^.\n])/){
   print "matches $1\n";
}
else  {
   print "doesn't match \n";
}

----- Original Message -----
From: "R. Joseph Newton" <[EMAIL PROTECTED]>
To: "Öznur Tastan" <[EMAIL PROTECTED]>
Cc: "'Perl Lists'" <[EMAIL PROTECTED]>
Sent: Wednesday, February 25, 2004 9:09 AM
Subject: Re: how to push a double dimensional array


> Öznur Tastan wrote:
>
>
> > Well actually storing the examples doesn't need the information for the
> > alignment but
> > if you are interested.
> > Pairwise sequence alignment is a widely used terms to visualize the
> > similarity of protein or DNA
> > sequences. So the characters denotes the aminoacids(or nucleotides in
DNAs)
> > and the conservation substitutions or deletions of  give clues about
> > biological meanings actualy predict the evolution at that site of the
> > protein.
> > Substitution scoring matrices which are mostly based on frequency
analysis
> > are used to align the alignments. These are matrices that tell how
similiar
> > one aminoacid to another so to say how it is likely to be replaced by
the
> > other aminoacid. so Aligning L with L will have positive score that you
can
> > get from the scoring matrice entry yet the gaps will be penalized
although
> > mismatches will be penalized.
> > The alignment is obtained by using a dynamic programing appraach,
> > Needleman-Wunch algorithm.
> > The score is the sum of the score of aligning each character.
> >
> > >
> > > I await the conclusion and enlightment as this thread has proven
> > > interesting.  :)
> > >
> > > Thx/Sx
>
> Okay.  This is getting a bit more clear.  Can you always count on being
able to
> express the score as an integer?  If so, this can be pretty
straightforward, but
> there will be a Perl learning curve.  It sounds to me like you really need
a
> class for these alignments.  The meaning of their internal data is very
specific
> to this context.  You could use a hash for any particular alignment, of
course,
> but then you are re-doing the work with each one.  You class could start
out as
> simple as the structs you were seeking earlier.  Perlis very liberal [too
> liberal IMHO] about access to data members of its objects.  So your
package
> could start out as simple as:
>
> package SequenceAlignment;
>
> use strict;
> use warnings;
>
> use Exporter;
>
> my @ISA = Exporter;
>
> sub new {
>    my $class = shift;
>    my ($sequence1, $sequence2, $alignment_score) = @_;
>
>    my $self = {
>       'base sequence'      => $sequence1,
>       comparison sequence' => $sequence2,
>       'alignment score'    => $alignment_score
>    }
>
>    bless $self, $class;
>    return $self;
> }
>
> Even without any methods defined, this at least gives you a framework for
> storing the alignments.  Since you obviously have some fairly specific
> operations relating to them, you will want to create some methods to
manipulate
> the data in context, though.
>
> One great advantage to this approach is that you can pass the reference
returned
> by the constructor above in a very lightweight manner.  When you need
> information from the reference itself, you can access the information
through
> this reference:
>
> my $alignment = SequenceAlignment->new ('AGGGTCATCCTTA', CCTTAGTTAA___',
2);
>         # Sorry if the data above fails any sanity tests
> Quick and dirty access:
> my $base_sequence = $alignment->{'base sequence'}
>
> Object-oriented access;
> my $base_sequence = $alignment->get_base_sequence();
>
> With the second access style shown above, you have the advantage that you
can
> define the get_base_sequence() method so as to take into account any
factors
> relevant to handling this particular form of data.
>
> Joseph
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to