Poor man's bootstrap
From BioPerl
(see the bioperl-l thread here)
- As Russell often says, sometimes Perl can do the job by itself. However, if you want to bootstrap sequences from an alignment, have a look at Bio::Align::Utilities... --Ed.
Shalabh Sharma asks
I was just wondering, is there any module is bioperl that does subsampling?
from Mark Jensen:
- To subsample lines from a file with replacement:
If you trust rand()...
# open your file into $my_infile, then @lines = <$my_infile>; my $num_samps = 10; my $sample_size_pc = 0.25; my @samples; for (1..$num_samps) { push @samples = [map { int( @lines * rand ) } ( 0..int($sample_size_pc * @lines) ) ]; } # now, do something, fr'instance my @sample_pc; foreach (@samples) { my $pct=0; foreach my $line (@lines[ @$_ ]) { @a = split(/\s+/,$line); $pct += $a[2]; } $pct /= @$_; push @sample_pc, $pct; } # etc...