[Bio] / Sprout / LoaderUtils.pm Repository:
ViewVC logotype

Diff of /Sprout/LoaderUtils.pm

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

revision 1.1, Thu May 28 18:06:58 2009 UTC revision 1.2, Mon Feb 1 20:14:28 2010 UTC
# Line 4  Line 4 
4    
5      use strict;      use strict;
6      use Tracer;      use Tracer;
7        use SeedUtils;
8    
9  =head1 Common DB Load Utilities  =head1 Common DB Load Utilities
10    
# Line 74  Line 75 
75      return $retVal;      return $retVal;
76  }  }
77    
78    =head3 RolesForLoading
79    
80        my ($roles, $errors) = RolesForLoading($function);
81    
82    Split a functional assignment into roles. If the functional assignment
83    seems suspicious, it will be flagged as invalid. A count will be returned
84    of the number of roles that are rejected because they are too long.
85    
86    =over 4
87    
88    =item function
89    
90    Functional assignment to parse.
91    
92    =item RETURN
93    
94    Returns a two-element list. The first is either a reference to a list of
95    roles, or an undefined value (indicating a suspicious functional assignment).
96    The second is the number of roles that are rejected for being too long.
97    
98    =back
99    
100    =cut
101    
102    sub RolesForLoading {
103        # Get the parameters.
104        my ($function) = @_;
105        # Declare the return variables.
106        my ($roles, $errors) = (undef, 0);
107        # Only proceed if there are no suspicious elements in the functional assignment.
108        if (! ($function =~ /\b(?:similarit|blast\b|fasta|identity)|%|E=/i)) {
109            # Initialize the return list.
110            $roles = [];
111            # Split the function into roles.
112            my @roles = roles_of_function($function);
113            # Keep only the good roles.
114            for my $role (@roles) {
115                if (length($role) > 250) {
116                    $errors++;
117                } else {
118                    push @$roles, $role;
119                }
120            }
121        }
122        # Return the results.
123        return ($roles, $errors);
124    }
125    
126    
127    
128  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3