I surely have learnt a lot in this thread. I still do not understand what the window size is good for. If you do all combinations within a window and then combine across all windows you get the same as if you were doing all combinations straight away. Or does a specific letter always have the same level within a window?
Anyways, putting all of the above together (and ignoring the window issue), you get the following code creating 864 combinations:
use strict; use warnings; my %level = ( A=>3, T=>2, G=>2, C=>1 ); my $string = "ATATGCGCAT"; my $n = 1; $n *= $level{$_} for( split '', $string ); print "Number of combinations: $n\n"; $string =~ s/(.)/$1."{".join(",",1..$level{$1})."}"/ge; print "~$_\n" while(< $string >);
In reply to Re: How can one get all possible combinations of a string without changing positions & using window size?
by hdb
in thread How can one get all possible combinations of a string without changing positions & using window size?
by supriyoch_2008
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |