File: random_feature.pl

package info (click to toggle)
gbrowse 2.56%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,104 kB
  • sloc: perl: 50,765; sh: 227; sql: 62; makefile: 50; ansic: 27
file content (26 lines) | stat: -rwxr-xr-x 548 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

use strict;
use constant FLEN => 4000;
use constant SLEN => 50000;
use constant FNUM => 15;

my $ftype   = shift or "feature";
my $fclass  = shift or "Feature";
my $fprefix = shift or "f";


open STDOUT,"|sort -k4,4n" or die;

for (1..FNUM) {
  my $start  = int(rand(SLEN));
  my $end    = $start + int(rand(FLEN));
  $end       = SLEN if $end > SLEN;
  my $strand = rand(1) > 0.5 ? '+' : '-';
  my $name   = sprintf("$fprefix%02d",$_);
  print <<END;
ctgA	example	$ftype	$start	$end	.	$strand	.	$fclass $name
END
}

close STDOUT;