Mercurial > repos > fubar > microsatbed
comparison seqrequester/src/tests/summarizeTest.pl @ 1:1085e094cf5f draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
author | fubar |
---|---|
date | Sat, 13 Jul 2024 12:39:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:dd71d3167476 | 1:1085e094cf5f |
---|---|
1 #!/usr/bin/env perl | |
2 # | |
3 # Generates a FASTA with sequence of a known length, to test | |
4 # `seqrequester summarize`. | |
5 # | |
6 | |
7 use strict; | |
8 | |
9 my $prefix = shift @ARGV; | |
10 my @lengths; | |
11 my $tLength = 0; | |
12 | |
13 die "usage: $0 output-prefix\n" if ($prefix eq ""); | |
14 | |
15 my $seqidx = "aaaa"; | |
16 my $seqnum = "000000"; | |
17 | |
18 open(F, "> $prefix.fasta"); | |
19 for (my $n=0; $n < 100000; $n++) { | |
20 my $small = rand(1); | |
21 my $lseed = rand(1); | |
22 my $length; | |
23 | |
24 if ($small < 0.0000) { | |
25 $length = int($lseed * 128 * 1048576) + 128 * 1048576; | |
26 } | |
27 elsif ($small < 0.9) { | |
28 $length = int($lseed * 30) + 1; | |
29 } | |
30 else { | |
31 $length = int($lseed * 1024) + 1024; | |
32 } | |
33 | |
34 push @lengths, $length; | |
35 $tLength += $length; | |
36 | |
37 my $rem = $length % 10; | |
38 | |
39 my $seq = "$seqidx$seqnum"; $seqidx++; | |
40 | |
41 print F ">", $n+1, "\n"; | |
42 while ($length > 0) { | |
43 print F $seq; | |
44 $seq++; | |
45 $length -= 5; | |
46 } | |
47 print F "z" x $rem; | |
48 print F "\n"; | |
49 | |
50 } | |
51 close(F); | |
52 | |
53 open(F, "> $prefix.lengths"); | |
54 foreach my $l (@lengths) { | |
55 print F "$l\n"; | |
56 } | |
57 close(F); | |
58 | |
59 print STDERR "Wrote ", scalar(@lengths), " sequences with total length $tLength.\n"; | |
60 | |
61 exit(0); |