[Bioperl-l] Padded position in Consensus sequence
Jayaprakash Rudraraju
prakash at ece.arizona.edu
Thu Aug 14 15:11:01 EDT 2003
Hi Jamie,
Just tested it. Works great. Thanks for the reply and nice to know that
you are just few blocks away from here. I work as a programmer in Arizona
Respiratory Center at the University Medical Center. I don't use modules
in perl, except when I have to deal with excel spreadsheets.
Our lab is not involved in any software research projects, so I never
found it useful to use bio-perl modules. But, I will read the module
documention for Bio::LocatableSeq to also look for other functions, which
might be useful in future.
Thanks,
Prakash.
11:34am, IP packets from Jamie Hatfield delivered:
> The Bio::LocatableSeq object is good at doing what you're looking for.
>
> #!/usr/local/bin/perl -w
> use Bio::LocatableSeq;
> my $consensus = "AGG*TGAC**TA***AGTCCT*T";
>
> ## gaps are represented using '-' instead of '*' in this object.
> ## either way, though, we need a count of the number of gaps.
> ## if your seq already had '-' representing gaps, then
> ## my $gaps = ($consensus =~ s/-/-/g);
> ## would still work.
> my $gaps = ($consensus =~ s/\*/-/g);
> my $seq = new Bio::LocatableSeq(-seq => $consensus,
> -id => "consensus",
> -start => 1,
> -end => length($consensus)-$gaps);
>
> print map { "$_\t" . $seq->column_from_residue_number($_) . "\n" }
> ($seq->start..$seq->end);
>
> On Thu, 2003-08-14 at 11:18, Jayaprakash Rudraraju wrote:
> >
> > Hi,
> >
> > I have written a small subroutine to as part of the program to tag primers
> > in Consed. The following subroutine gives padded position on the consensus
> > sequence, given its position on reference sequence.
> >
> > #!perl -w
> > my $consensus = "AGG*TGAC**TA***AGTCCT*T";
> > print map { "$_\t". padded_position($_) ."\n"} (1..16);
> >
> > sub padded_position {
> > my ($unpad, $pads) = (@_, 0);
> > $pads++ until $unpad == substr($consensus, 0, $unpad+$pads) =~ tr/ACGT//;
> > $unpad+$pads;
> > }
> >
> > can you suggest me some more efficient or elegant solutions. Eventhough I
> > have condensed it as much as I can, I am looking for a simpler logic.
> >
> > Prakash.
> >
> > --
> > My favorite animal is steak.
> > -- Fran Lebowitz (1950 - )
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at portal.open-bio.org
> > http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
--
"Whatever women do they must do twice as well as men to be thought
half as good. Fortunately, this is not difficult."
-- Charlotte Whitton
More information about the Bioperl-l
mailing list