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

View of /FigKernelScripts/make_close_strain_data.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (download) (as text) (annotate)
Sun Jan 11 13:43:37 2009 UTC (10 years, 10 months ago) by overbeek
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, myrast_rel40, mgrast_dev_05262011, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2009_07_09, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, HEAD
Changes since 1.13: +29 -4 lines
fixes to making close strain data

########################################################################
# -*- perl -*-
#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


use FIG;
my $fig = new FIG;

# I recommend: make_close_strain_data Directory p 60 0.7 5 1 OrderByGenome GenePrefix for close strains
# for distant use
# I recommend: make_close_strain_data -cluster 2 -insub 1 Directory p 30 0.7 5 1 OrderByGenome GenePrefix
#

$usage = "usage: make_close_strain_data [-cluster N1] [-insub N2] Directory Type IdenCutoff CovCutoff IdenDiff NeighDiff OrderByGenome Gene_prefix [nostarts] [noSNPs] [noRedoBLAST]";

my $must_cluster = 0;
my $must_be_in_sub = 0;
my $parms = join(" ",@ARGV);
while ((@ARGV > 0) && ($ARGV[0] =~ /^-/))
{
    my $arg = shift @ARGV;
    if ($arg =~ /-cluster/)
    {
	$must_cluster = shift @ARGV;
    }
    elsif ($arg =~ /-insub/)
    {
	$must_be_in_sub = shift @ARGV;
    }
    else
    {
	die "Unknown option $arg\n";
    }
}

( ($dir    = shift @ARGV) && (-d $dir) && (-s "$dir/genomes") ) 
    || die "$dir should be a directory containing a genomes file";

open( PARMS, ">$dir/parameters") || die "could not open $dir/parameters";
print PARMS  $parms,"\n";
closedir(PARMS);

(
 ($type         = shift @ARGV) &&
 ($iden_cutoff  = shift @ARGV) &&
 ($cov_cutoff   = shift @ARGV) &&
 ($iden_diff    = shift @ARGV) &&
 ($neigh_diff   = shift @ARGV) &&
 ($order_by     = shift @ARGV) &&
 ($prefix       = shift @ARGV)
)
    || die $usage;


$no_redo_blast = "";
foreach $_ (@ARGV)
{
    if    ($_ =~ m/nostarts/io)     { $nostarts      = 1; }
    elsif ($_ =~ m/noSNPs/io)       { $noSNPs        = 1; }
    elsif ($_ =~ m/noRedoBLAST/io)  { $no_redo_blast = "-no_redo_blast"; }
    else  { die "Invalid argument: $_"; }
}


$genomes = join(" ", sort { $a <=> $b } map { $_ =~ /^(\S+)/; $1 } `cat $dir/genomes`);

&FIG::run("sims_all $no_redo_blast $type $iden_cutoff $cov_cutoff $dir/Seqs $dir/Sims $genomes");
&FIG::run("./connections_between -cluster $must_cluster -insub $must_be_in_sub $dir/Sims $iden_diff 2> $dir/stderr | order_sets $order_by > $dir/sets");
system("grep \"^fig\" $dir/stderr > $dir/problems") && warn "grep found no FIDs";

if (! $nostarts)
{
    &FIG::run("check_starts_for_peg_sets $dir/clear $dir/proposed < $dir/sets > /dev/null");
    &FIG::run("changed_starts $dir/proposed $dir/changed.start.annotations > $dir/changed.starts");
}

if (! $noSNPs)
{
    &FIG::run("generate_gene_blocks $dir/Blocks $prefix < $dir/sets");
    &FIG::run("generate_intergenic_blocks $dir/Blocks");
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3