File: sample.pl

package info (click to toggle)
snpeff 5.2.f%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 701,384 kB
  • sloc: java: 62,547; perl: 2,279; sh: 1,185; python: 744; xml: 507; makefile: 50
file content (12 lines) | stat: -rwxr-xr-x 261 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

if($ARGV[0] ne '') {
	$p = $ARGV[0]; 
	die "Argument should be a sampling probability, i.e. a number between 0.0 and 1.0 (default=0.001)" if !(($p >= 0.0) && ($p <= 1.0));
} else {
	$p = 0.001;
}

while( <STDIN> ) {
	print if (rand() <= $p);
}