[Bioperl-l] K-mer generating script

Mark A. Jensen maj at fortinbras.us
Sat Dec 20 06:34:01 UTC 2008


Jason -
Have a look at
http://www.bioperl.org/wiki/Category:Scrapbook
could be cool-
MAJ
----- Original Message ----- 
From: "Jason Stajich" <jason at bioperl.org>
To: "Mark A. Jensen" <maj at fortinbras.us>; "Blanchette, Marco" 
<MAB at stowers-institute.org>
Cc: "bioperl list" <bioperl-l at lists.open-bio.org>
Sent: Saturday, December 20, 2008 12:02 AM
Subject: Re: [Bioperl-l] K-mer generating script


> Does someone want to put this on the wiki too?
>
> Maybe we could start a little bit of perl snippets for examples like  these.
>
> -j
> On Dec 19, 2008, at 7:45 PM, Mark A. Jensen wrote:
>
>> A little sloppy, but it recurses and is general---
>>
>> # ex...
>> @combs = doit(3, [ qw( A T G C ) ]);
>> 1;
>> # code
>>
>> sub doit {
>>   my ($n, $sym) = @_;
>>   my $a = [];
>>   doit_guts($n, $sym, $a, '');
>>   return map {$_ || ()} @$a;
>> }
>>
>> sub doit_guts {
>> my ($n, $sym, $store, $str)  = @_;
>> if (!$n) {
>>   return $str;
>> }
>> else {
>>   foreach my $s (@$sym) {
>>     push @$store, doit_guts($n-1, $sym, $store, $str.$s);
>>   }
>> }
>> }
>>
>>
>> ----- Original Message ----- From: "Blanchette, Marco" 
>> <MAB at stowers-institute.org
>> >
>> To: <bioperl-l at lists.open-bio.org>
>> Sent: Friday, December 19, 2008 6:25 PM
>> Subject: [Bioperl-l] K-mer generating script
>>
>>
>>> Dear all,
>>>
>>> Does anyone have a little function that I could use to generate all 
>>> possible k-mer DNA sequences? For instance all possible 3-mer (AAA,  AAT, 
>>> AAC, AAG, etc...). I need something that I could input the  value of k and 
>>> get all possible sequences...
>>>
>>> I know that it's a problem that need to use recursive programming  but I 
>>> can't get my brain around the problem.
>>>
>>> Many thanks
>>>
>>> Marco
>>> --
>>> Marco Blanchette, Ph.D.
>>> Assistant Investigator
>>> Stowers Institute for Medical Research
>>> 1000 East 50th St.
>>>
>>> Kansas City, MO 64110
>>>
>>> Tel: 816-926-4071
>>> Cell: 816-726-8419
>>> Fax: 816-926-2018
>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>
> Jason Stajich
> jason at bioperl.org
>
>
>
> _______________________________________________
> 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