[Bio] / Kmers2 / build_data_directory.pl Repository:
ViewVC logotype

Diff of /Kmers2/build_data_directory.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Mon Jan 7 20:56:35 2013 UTC revision 1.2, Sun Jan 20 14:44:16 2013 UTC
# Line 2  Line 2 
2  use Data::Dumper;  use Data::Dumper;
3  use SeedEnv;  use SeedEnv;
4    
5  my $usage = "usage: build_data_directory Genus DataDir K";  my $usage = "usage: build_data_directory DataDir K";
6  my($genus,$dataD,$k);  my($genus,$dataD,$k);
7  (  (
  ($genus      = shift @ARGV) &&  
8   ($dataD      = shift @ARGV) &&   ($dataD      = shift @ARGV) &&
9   ($k          = shift @ARGV) && ($k =~ /^\d{1,2}$/)   ($k          = shift @ARGV) && ($k =~ /^\d{1,2}$/)
10  )  )
11      || die $usage;      || die $usage;
12  print STDERR "building $dataD for Kmers of size $k\n";  print STDERR "building $dataD for Kmers of size $k\n";
   
13  mkdir($dataD,0777);  mkdir($dataD,0777);
14    
15  # &get_genomes($genus,$dataD);  &build_function_index($dataD);
16  # &build_function_index($dataD);  &build_otu_index($dataD);
 # &build_otu_index($dataD);  
17  &build_reduced_kmers($dataD,$k);  &build_reduced_kmers($dataD,$k);
18  &extend_otu_index($dataD);  &extend_otu_index($dataD);
19  &update_kmers_with_extended_OTUs($dataD);  &update_kmers_with_extended_OTUs($dataD);
20    
 sub get_genomes {  
     my($genus,$dataD) = @_;  
   
     &SeedUtils::run("svr_all_genomes | grep $genus > $dataD/all.genomes");  
 }  
   
21  sub build_function_index {  sub build_function_index {
22      my($dataD) = @_;      my($dataD) = @_;
23    
# Line 134  Line 125 
125      open(RAW,"| sort -T . > $dataD/sorted.kmers") || die "could not open $dataD/sorted.kmers";      open(RAW,"| sort -T . > $dataD/sorted.kmers") || die "could not open $dataD/sorted.kmers";
126      foreach my $g (`cut -f2 $dataD/all.genomes`)      foreach my $g (`cut -f2 $dataD/all.genomes`)
127      {      {
128    #       next if (! $g_to_oI{$g});
129          foreach $_ (`echo '$g' | svr_all_features peg | svr_translations_of`)          foreach $_ (`echo '$g' | svr_all_features peg | svr_translations_of`)
130          {          {
131              if ($_ =~ /^(fig\|\d+\.\d+\.peg\.\d+)\t(\S.*\S)$/)              if ($_ =~ /^(fig\|\d+\.\d+\.peg\.\d+)\t(\S.*\S)$/)
# Line 185  Line 177 
177          $funcs{$fI}++;          $funcs{$fI}++;
178      }      }
179      my @tmp = sort { $funcs{$b} <=> $funcs{$a} } keys(%funcs);      my @tmp = sort { $funcs{$b} <=> $funcs{$a} } keys(%funcs);
180      if ($tmp[0] && ($funcs{$tmp[0]} >= (0.9 * @$set)))      if ($tmp[0] && ($funcs{$tmp[0]} >= (0.8 * @$set)))
181      {      {
182          my $best_fI = $tmp[0];          my $best_fI = $tmp[0];
183          my %otus;          my %otus;
# Line 230  Line 222 
222      }      }
223      if (@called > 0)      if (@called > 0)
224      {      {
225          return join(",",@called);          return join(",",sort { $a <=> $b } @called);
226      }      }
227      return '';      return '';
228  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3