[Bioperl-l] Motifs and aligned sequences

Seiji Kumagai skumagai at life.bio.sunysb.edu
Sat Aug 19 03:17:20 UTC 2006


Hi,

How about this?

my $str = q/-G---ATT---AT--ATA/;
my $motif = q/A\-*T\-*T\-*A\-*T\-*A/; 
while ($str =~ /$motif/g) {
     print $+[0], qq/\n/;
}

The above code prints the last base positions of a motif. It is only valid 
for *non-overlapping* motifs. For overlapping motif, you can replace 
/$motif/ with /(?=$motif)/. However, if you do so, you won't be able to 
print the positions of the last bases. In stead, it will print positions 
of the immediately before the first bases in the motif. But, I think you 
can easily find the positions of the last bases if you know that 
position. Finally, you can find the explanation in perlre.



On Sat, 19 Aug 2006, Antoni [iso-8859-1] Fernàndez-Guerra wrote:

> Thanks for you answer Brian, but I've already done it, the problem is that
> if I remove the dashes I will lose the positions on the aligned sequence,
> eg: s/-//g --->> GATTATATA, then if i want to know where is the last
> position of the motif it will be 7 instead of 16. I want to know the
> positions of the dashes too...but now I don't have any good idea, I will
> keep working on it. Thanks again
> Antonio
>
>> A Divendres 18 Agost 2006 23:52, vàreu escriure:
>>> Antonio,
>>>
>>> First remove the dashes from the consensus, s/-//g.
>>>
>>> Brian O.
>>>
>>> On 8/18/06 2:05 PM, "Antonio" <genomewalker at gmail.com> wrote:
>>>> Hello all,
>>>> I am trying to find the solution of this problem, I've tried several
>>>> options but no way. I want to find a motif in an aligned sequence, eg:
>>>> Aligned Sequence: -G---ATT---AT--ATA
>>>> Motif: ATTATA
>>>> So i want to find the motif inside this sequence  and return the last
>>>> position of the motif in the aligned sequence, in this case 16. I don't
>>>> know how I've to play with the '-', any suggestions?
>>>> Thanks in advance!
>>>> Antonio
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
>


More information about the Bioperl-l mailing list