[Bio] / Babel / bin / load_MD5DATA2FILE.pl Repository:
ViewVC logotype

Diff of /Babel/bin/load_MD5DATA2FILE.pl

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

revision 1.3, Mon Sep 27 16:43:28 2010 UTC revision 1.4, Thu Oct 7 19:27:00 2010 UTC
# Line 131  Line 131 
131      }      }
132    
133      if ($org) {      if ($org) {
       $org =~ s/'/\\'/g;  
134        $org =~ s/\\//g;        $org =~ s/\\//g;
135          $org =~ s/'/\\'/g;
136        if (exists $org_ids->{$org}) {        if (exists $org_ids->{$org}) {
137          $orgID = $org_ids->{$org};          $orgID = $org_ids->{$org};
138        } else {        } else {
# Line 146  Line 146 
146      }      }
147    
148      if (defined($beg) && defined($end) && $strand && $ctg_id && $ctg_desc && $len) {      if (defined($beg) && defined($end) && $strand && $ctg_id && $ctg_desc && $len) {
       $ctg_id   =~ s/'/\\'/g;  
149        $ctg_id   =~ s/\\//g;        $ctg_id   =~ s/\\//g;
150        $ctg_desc =~ s/'/\\'/g;        $ctg_id   =~ s/'/\\'/g;
151        $ctg_desc =~ s/\\//g;        $ctg_desc =~ s/\\//g;
152          $ctg_desc =~ s/'/\\'/g;
153        if (exists $ctg_ids->{$ctg_id}) {        if (exists $ctg_ids->{$ctg_id}) {
154          $ctgID = $ctg_ids->{$ctg_id}[0];          $ctgID = $ctg_ids->{$ctg_id}[0];
155        } else {        } else {
# Line 163  Line 163 
163      }      }
164    
165      if ($func) {      if ($func) {
       $func =~ s/'/\\'/g;  
166        $func =~ s/\\//g;        $func =~ s/\\//g;
167          $func =~ s/'/\\'/g;
168        if (exists $func_ids->{$func}) {        if (exists $func_ids->{$func}) {
169          $funcID = $func_ids->{$func};          $funcID = $func_ids->{$func};
170        } else {        } else {
# Line 177  Line 177 
177        $func = "\\N";        $func = "\\N";
178      }      }
179    
180      print DATA "$data_num\t$md5\t$id\t$funcID\t$srcID\t$orgID\t\\N\t\\N\n";      print DATA "$data_num\t$md5\t$id\t$funcID\t$srcID\t$orgID\t\\N\n";
181      $data_num += 1;      $data_num += 1;
182      unless ($data_num % 1000000) {      unless ($data_num % 1000000) {
183        if ($verbose) { print STDERR "$data_num:\t$md5 , $id , $func , $org , $source\n"; }        if ($verbose) { print STDERR "$data_num:\t$md5 , $id , $func , $org , $source\n"; }
# Line 190  Line 190 
190    
191  if ($verbose) { print STDERR "\nPrinting table $count_tbl ... \n"; }  if ($verbose) { print STDERR "\nPrinting table $count_tbl ... \n"; }
192  my @counts = ( "ids\t" . scalar(keys %$id_ids), "md5s\t" . scalar(keys %$md5_ids),  my @counts = ( "ids\t" . scalar(keys %$id_ids), "md5s\t" . scalar(keys %$md5_ids),
193                 "organisms\t$org_num", "contigs\t$ctg_num", "functions\t$func_num", "sources\t$src_num" );                 "organisms\t" . ($org_num-1), "contigs" . ($ctg_num-1), "functions" . ($func_num-1), "sources" . ($src_num-1) );
194  open(COUNT, ">${out_dir}$count_tbl") || die "Can't open file ${out_dir}$count_tbl\n";  open(COUNT, ">${out_dir}$count_tbl") || die "Can't open file ${out_dir}$count_tbl\n";
195  print COUNT join("\n", @counts) . "\n";  print COUNT join("\n", @counts) . "\n";
196  close COUNT;  close COUNT;
# Line 198  Line 198 
198  if ($verbose) { print STDERR "\nPrinting table $org_tbl ... \n"; }  if ($verbose) { print STDERR "\nPrinting table $org_tbl ... \n"; }
199  open(ORG, ">${out_dir}$org_tbl") || die "Can't open file ${out_dir}$org_tbl\n";  open(ORG, ">${out_dir}$org_tbl") || die "Can't open file ${out_dir}$org_tbl\n";
200  foreach (sort {$org_ids->{$a} <=> $org_ids->{$b}} keys %$org_ids) {  foreach (sort {$org_ids->{$a} <=> $org_ids->{$b}} keys %$org_ids) {
201    print ORG $org_ids->{$_} . "\t$_" . ("\t\\N" x 12) . "\n";    print ORG $org_ids->{$_} . "\t$_" . ("\t\\N" x 11) . "\n";
202  }  }
203  close ORG;  close ORG;
204    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3