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

Annotation of /FigKernelScripts/reps_for_wc.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : jdavis 1.1 #! /usr/bin/env perl
2 :     use strict;
3 :     use Data::Dumper;
4 :     use Getopt::Long;
5 :     use SeedEnv;
6 :    
7 : jdavis 1.2 my $usage = 'reps_for_wc.pl -n [number of genomes] -l list of PSEED IDs -o output_prefix > List of Rep IDs
8 :     -l list of PSEED ids, 1 per line
9 :     -n number of reps you want
10 :     -o output prefix for alignment and tree files
11 : jdavis 1.1 This program
12 :     1) takes a list of PSEED ids,
13 :     2) extracts a set of universal genes,
14 :     3) builds a concatenated alignment
15 :     4) builds a tree
16 :     5) extrancts n representative tips from the tree';
17 :    
18 :     my ($help, $nreps, $list, $output);
19 :    
20 :     my $rc = GetOptions('h' => \$help,
21 :     'l=s' => \$list,
22 :     'n=i' => \$nreps,
23 :     'o=s' => \$output);
24 :    
25 :     if ((! $rc) || ($help))
26 :     {
27 :     die $usage;
28 :     }
29 :     if (! $list)
30 :     {
31 :     die "Must provide a list of PSEED IDS with -l option\n";
32 :     }
33 :     if (! $nreps)
34 :     {
35 :     die "must provide -n number of representatives desired\n";
36 :     }
37 :     if (! $output)
38 :     {
39 :     die "must provide -o prefix for output files\n";
40 :     }
41 :    
42 :     opendir(DIR,".") || die "could not open current working directory";
43 :     my @files = grep { $_ !~ /^\./ } readdir(DIR);
44 :     foreach (@files)
45 :     {
46 :     if ($_ =~ /$output/)
47 :     {
48 :     die "File prefix, $output has already been used, please choose a different prefix\n";
49 :     }
50 :     }
51 :    
52 :     closedir(GTOS);
53 :    
54 :     &SeedUtils::run("k-class-tree-from-contig-dir -o $output -p $list");
55 : jdavis 1.2 &SeedUtils::run("k-class-representative_n_tree_tips -n $nreps <$output.nwk");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3