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

View of /FigKernelScripts/reps_for_wc.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Mon Apr 20 19:22:43 2015 UTC (4 years, 7 months ago) by jdavis
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +5 -5 lines
updated usage statement

#! /usr/bin/env perl
use strict;
use Data::Dumper;
use Getopt::Long;
use SeedEnv;

my $usage = 'reps_for_wc.pl -n [number of genomes] -l list of PSEED IDs -o output_prefix > List of Rep IDs
                -l list of  PSEED ids, 1 per line
                -n number of reps you want
                -o output prefix for alignment and tree files
This program 
    1) takes a list of PSEED ids, 
    2) extracts a set of universal genes, 
    3) builds a concatenated alignment
    4) builds a tree
    5) extrancts n representative tips from the tree';

my ($help, $nreps, $list, $output);

my $rc  = GetOptions('h'          => \$help,
		             'l=s'        => \$list,
		             'n=i'        => \$nreps,
		             'o=s'        => \$output);

if ((! $rc) || ($help))
{ 
    die $usage;
}
if (! $list)
{
    die "Must provide a list of PSEED IDS with -l option\n";
}
if (! $nreps)
{
    die "must provide -n number of representatives desired\n";
}
if (! $output)
{
    die "must provide -o prefix for output files\n";
}

opendir(DIR,".") || die "could not open current working directory";
my @files = grep { $_ !~ /^\./ } readdir(DIR);
foreach (@files)
{
    if ($_ =~ /$output/)
    {
        die "File prefix, $output has already been used, please choose a different prefix\n";
    }
}

closedir(GTOS);

&SeedUtils::run("k-class-tree-from-contig-dir -o $output -p $list");
&SeedUtils::run("k-class-representative_n_tree_tips -n $nreps <$output.nwk");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3