Home > Archive > PERL Miscellaneous > June 2007 > Re: Problem with PERL function
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Problem with PERL function
|
|
| michaelzhao 2007-06-28, 7:05 pm |
| On Jun 26, 5:23 pm, jgra...@ti.com wrote:
> use...@DavidFilmer.com writes:
>
>
>
>
> snip example of use Statistics::Frequency;
>
>
> I don't know bioperl either, but it seems like the DNA strings of ATCG
> might be represented as long strings because dna people might like to
> use regexp to search for subsets.
>
> In that case, here are some idioms
> for counting characters in a scalar using tr///,
> and for accessing a subset of a string with substr; (pasted and tested)
> # 0123456789.12345678
> $dna = 'TCTCTCGGGAAGAGATTGA';
> $Tcount = $dna =~ tr/T/T/; # tr returns number of T->T replacements
> $start = 3; # inclusive, based at 0
> $stop = 9; # inclusive
> $len = $stop-$start+1
> $Tcountss = substr($dna,$start,$len) =~ tr/T/T/; # access subset of $dna
> print "dna = '$dna' has $Tcount T's,\n";
> print " but only $Tcountss T's in $start to $stop, inclusive\n",
> printf " for a relative frequency of %f\n", $Tcountss/$len;
>
> -- output is
>
> dna = 'TCTCTCGGGAAGAGATTGA' has 5 T's,
> but only 1 T's in 3 to 9, inclusive
> for a relative frequency of 0.142857
>
> As mentioned before, posting short example datastructures from your code
> shows you are paying attention, and enable more appropriate assistance.
>
> --
> Joel
Wow Joel! Thanks a lot for your help. Your suggestion really hit the
spot. I was able to learn quite a bit from the code you put up and
succesfully modified it to fit my needs.
To everyone else: Thanks for the suggestions and the help! With the
exception of the jerkoff who wrote the first response.
| |
| Tad McClellan 2007-06-28, 10:03 pm |
| michaelzhao <mzhao1@gmail.com> wrote:
> On Jun 26, 5:23 pm, jgra...@ti.com wrote:
Who mentioned it before?
[color=darkred]
[color=darkred]
> To everyone else: Thanks for the suggestions and the help! With the
> exception of the jerkoff who wrote the first response.
Oh. It was the "jerkoff" who mentioned how to get help with your problem.
Calling the regulars names will have a negative effect on your ability
to get quality help here in the future. I suggest you try to refrain
from doing that anymore.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
| |
| Dr.Ruud 2007-06-29, 4:07 am |
| michaelzhao schreef:
> jerkoff
*PLONK*
--
Affijn, Ruud
"Gewoon is een tijger."
| |
| Keith Keller 2007-06-29, 7:03 pm |
| On 2007-06-29, michaelzhao <mzhao1@gmail.com> wrote:
>
> Other people helped me a good deal giving relevant and educational
> discussion and I am grateful to them. So, I don't care if he is a
> regular or if hes a Perl god for that matter. The post he made was
> neither helpful nor educational... besides me learning the "Perl" of
> course. Oh, and next time I'll post a short script.
Your post calling him a jerkoff was neither helpful nor educational, and
apparently not only alienated him, but many other regular posters who
might otherwise have helped you in the future. Your continuing to
defend calling him a jerkoff is likely to alienate even more regular
posters. Is that really the path you wish to pursue?
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
| |
| Tad McClellan 2007-06-30, 8:02 am |
| michaelzhao <mzhao1@gmail.com> wrote:
> Oh, and next time I'll post a short script.
But few will see it.
So long!
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
|
|
|
|
|