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

View of /FigKernelScripts/FFB2_merge_and_build_kmers.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Apr 23 20:31:41 2013 UTC (6 years, 6 months ago) by olson
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
Update to figfam processing

########################################################################

use strict;
use FIG;
use IPC::Run qw(start finish);
use Getopt::Long;

my $usage = "usage: FFB2_merge_and_build_kmers [--override fn-override-file] NewReleaseDir ";

my $pseed = "/vol/pseed/FIGdisk/FIG/Data";

my $skip_otu;
my $override_file;

my $rc = GetOptions("override=s" => \$override_file,
		    );

$rc or die $usage;

my($oldD,$newD);

(
 ($newD = shift @ARGV)
)
    || die $usage;

my $in_ssfam = shift;

$ENV{TMPDIR} = $FIG_Config::temp;

my $sort_args = "-T $FIG_Config::temp -S 4G";

if (!-d "$newD/Kmers")
{
    die "$newD/Kmers does not exist\n";
}

mkdir("$newD/Merged",0777) || die "could not make $newD/Merged: $!";

my $load1 = start(["FFB2_load_oligo_index", "$newD/function.index",  "$newD/FRI.db"]);
my $load2 = start(["FFB2_load_oligo_index", "$newD/setI", "$newD/setI.db"]);
my $build = start(["build_prok_nonff_fasta", "$newD"],  ">", "$newD/extra_prok_seqs.fasta");

#
# create merge files and use the -merge to create_binary_kmers
#

my %mergefile;
foreach my $i (7..12)
{
    my $mf = "$newD/KmerBuild/mergefile.$i";
    $mergefile{$i} = $mf;
    open(MF, ">", $mf) or die "Cannot write $mf: $!";

    for my $f (sort <$newD/Kmers/kmers.2.*/$i/good.oligos.gz>)
    {
	print MF "$f\t1\n";
    }
    for my $f (sort <$newD/Kmers/kmers.3.*/$i/good.oligos.gz>)
    {
	print MF "$f\t3\n";
    }
    print MF "$newD/PhyloSigs/$i/good.oligos.gz\t2\n";
    close(MF);
}

foreach my $i (7..12)
{
    my $mf = $mergefile{$i};
    my $dir = "$newD/Merged/$i";
    -d "$dir" || mkdir "$dir";
    &FIG::run("FFB2_create_binary_kmers -l $i -s 4,2,4 -merge $mf - $dir/table.binary");
}

system("FFB2_run_tests $newD");
system("FFB2_compare_tests $oldD $newD");
$build->finish();
&FIG::run("formatdb -p T -i $newD/extra_prok_seqs.fasta");
&FIG::run("compute_fasta_lengths", "$newD/extra_prok_seqs.fasta", "$newD/extra_prok_seqs.fasta.lengths");

$load1->finish();
$load2->finish();

&FIG::run("FFB2_make_FF_index $newD $newD/fam.func.index $newD/FamFuncBlastD");
&FIG::run("FFB2_build_ff_indexes $newD");

&FIG::run("get_coupling_values $newD/families.2c > $newD/coupling.values");



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3