[Bio] / FigKernelScripts / splitup.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/splitup.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : gdpusch 1.3 # -*- perl -*-
2 : olson 1.4 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : efrank 1.1
20 :     use FIG;
21 :    
22 : gdpusch 1.3 $usage = "usage: splitup ChunksDir [Sz]";
23 : efrank 1.1
24 : gdpusch 1.3 ($chunksD = shift @ARGV) || die $usage;
25 :    
26 :     if (-d $chunksD) { die "Output directory $chunksD already exists"; }
27 : efrank 1.1
28 :     mkdir($chunksD,0777) || die "could not make $chunksD";
29 :    
30 : overbeek 1.2 $sz = (@ARGV > 0) ? $ARGV[0] : 100000000;
31 : efrank 1.1 $n = 0;
32 :     $done = 0;
33 :     while (! $done )
34 :     {
35 :     open(TMP,">$chunksD/$n") || die "could not make $chunksD/$n";
36 :     $sofar = 0;
37 :     while ((! $done) && ($sofar < $sz) && ($ln = read(STDIN,$s,100000)))
38 :     {
39 :     $done = ($ln < 100000);
40 :     print TMP $s;
41 :     $sofar += $ln;
42 :     }
43 :     close(TMP);
44 :     &FIG::run("cksum $chunksD/$n >> $chunksD/checksums");
45 :     $n++;
46 :     }
47 :    
48 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3