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

Diff of /FigKernelScripts/FFB2_make_subsys_based_families.pl

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

revision 1.1, Mon Nov 16 21:52:22 2009 UTC revision 1.2, Mon Jul 12 19:30:27 2010 UTC
# Line 19  Line 19 
19    
20    
21  use FIG;  use FIG;
22    use strict;
23    
24  my $fig = new FIG;  my $fig = new FIG;
25    
26  # usage: FFB2_make_subsys_based_families > subsys.based.families  # usage: FFB2_make_subsys_based_families > subsys.based.families
27    
28  my $pairsF = "$FIG_Config::temp/peg-func.$$";  my $pairsF = "$FIG_Config::temp/peg-func.$$";
29  open(TMP1,"pegs_in_subsystems | cut -f2,3 | sort -u | function_of |")  #open(TMP1,"pegs_in_subsystems | cut -f2,3 | sort -u | function_of |")
30      || die "could not get pegs";  #    || die "could not get pegs";
 open(TMP2,"| sort -u > $pairsF") || die "could not open $pairsF";  
31    
32  while (defined($_ = <TMP1>))  #
33  {  # TMP1 emits triples role, peg, assigned function
34      chomp;  #
35      my($role,$peg,$func) = split(/\t/,$_);  
36    #open(TMP1, "cut -f2,3 < /scratch/olson/pegs.in.subs | sort -u -S 3G | function_of |");
37    open(TMP2,"| sort -S 3G -u > $pairsF") || die "could not open $pairsF";
38    
39    #mysql> select si.subsystem, si.role, si.protein, f.assigned_function from subsystem_index si LEFT JOIN aux_roles ar ON si.subsystem = ar.subsystem AND si.role = ar.role JOIN subsystem_metadata m ON si.subsystem = m.subsystem JOIN assigned_functions f ON f.prot = si.protein LEFT JOIN deleted_fids df ON si.protein = df.fid WHERE df.fid IS NULL AND ar.role IS NULL and m.class_1 <> '' AND m.class_1 not like 'experimental%' COLLATE latin1_swedish_ci and m.class_1 not like '%delete%' AND si.variant != '0' AND si.variant != '-1' into outfile '/tmp/list6';
40    
41    
42    my $sth = $fig->db_handle->{_dbh}->prepare(qq(SELECT si.role, si.protein, f.assigned_function
43                                                  FROM subsystem_index si
44                                                     LEFT JOIN aux_roles ar ON si.subsystem = ar.subsystem AND si.role = ar.role
45                                                     JOIN subsystem_metadata m ON si.subsystem = m.subsystem
46                                                     JOIN assigned_functions f ON f.prot = si.protein
47                                                     LEFT JOIN deleted_fids df ON si.protein = df.fid
48                                                  WHERE df.fid IS NULL AND
49                                                        ar.role IS NULL AND
50                                                        m.class_1 <> '' AND
51                                                        m.class_1 NOT LIKE 'experimental%' COLLATE latin1_swedish_ci AND
52                                                        m.class_1 NOT LIKE '%delete%' COLLATE latin1_swedish_ci  AND
53                                                        si.variant != '0' AND
54                                                        si.variant != '-1'),
55                                           { mysql_use_result => 1 });
56    
57    $sth->execute();
58    
59    while (my $row = $sth->fetchrow_arrayref())
60    {
61        my($role, $peg, $func) = @$row;
62    
63    #while (<TMP1>)
64    #{
65    #    chomp;
66    #    my($role, $peg, $func) = split(/\t/);
67        next if $peg !~ /\.peg\./;
68      next if ((! $func) || (length($func) < 2));      next if ((! $func) || (length($func) < 2));
69      my @roles = $fig->roles_of_function($func);      my @roles = $fig->roles_of_function($func);
70      my $i;      my $i;
# Line 45  Line 78 
78          }          }
79      }      }
80  }  }
81  close(TMP1);  #$sth->finish();
82    #close(TMP1);
83  close(TMP2);  close(TMP2);
84    
85  my $n = 1;  my $n = 1;
# Line 70  Line 104 
104          $n++;          $n++;
105      }      }
106  }  }
107  unlink($pairsF);  #unlink($pairsF);

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3