[Bio] / FigKernelPackages / FIGV.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIGV.pm

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

revision 1.61, Fri Sep 12 01:47:15 2008 UTC revision 1.62, Thu Sep 18 14:01:45 2008 UTC
# Line 351  Line 351 
351      my $bindings = $self->{_ss_bindings}->{$ssa};      my $bindings = $self->{_ss_bindings}->{$ssa};
352      my $variant = $self->{_ss_variants}->{$ssa};      my $variant = $self->{_ss_variants}->{$ssa};
353    
354  #    warn "Adding virtual genome " . Dumper(\%bindings);      unless ($bindings) {
355            $variant = '*-1';
356        }
357        my @roles = $ss->get_roles();
358        foreach my $role (@roles) {
359            my @pegs = $self->seqs_with_role($role, undef, $newG);
360            $bindings->{$role} = \@pegs;
361        }
362    
363      $ss->add_virtual_genome($self->genus_species(), $newG, $variant, $bindings);      $ss->add_virtual_genome($self->genus_species(), $newG, $variant, $bindings);
364    
365      return $ss;      return $ss;
# Line 1246  Line 1254 
1254      }      }
1255  }  }
1256    
1257    # function not complete
1258    # sub add_feature {
1259    #     my( $self, $user, $genome, $type, $location, $aliases, $sequence, $function ) = @_;
1260    
1261    #     my $fig     = $self->{_fig};
1262    #     my $newG    = $self->{_genome};
1263    #     my $newGdir = $self->{_orgdir};
1264    
1265    #     if ($genome && $genome ne $newG) {
1266    #       return $self->{_fig}->add_feature($user, $genome, $type, $location, $aliases, $sequence);
1267    #     }
1268    
1269    #     # perform sanity checks
1270    #     unless ($user && $genome && $type && $location && $sequence) {
1271    #       print STDERR "SEED error: add_feature failed due to missing parameter\n";
1272    #       return undef;
1273    #     }
1274    #     if ( $genome !~ /^\d+\.\d+$/ )
1275    #     {
1276    #         print STDERR "SEED error: add_feature failed due to bad genome id: $genome\n";
1277    #         return undef;
1278    #     }
1279    
1280    #     if ( $type !~ /^[0-9A-Za-z_]+$/ )
1281    #     {
1282    #         print STDERR "SEED error: add_feature failed due to bad type: $type\n";
1283    #         return undef;
1284    #     }
1285    
1286    #     if ( length ( $location ) > 5000 )
1287    #     {
1288    #         print STDERR "SEED error: add_feature failed because location is over 5000 char:\n";
1289    #         print STDERR "$location\n";
1290    #         return undef;
1291    #     }
1292    
1293    #     my @loc  = split( /,/, $location );
1294    #     my @loc2 = grep { $_->[0] && $_->[1] && $_->[2] }
1295    #                map  { [ $_ =~ m/^(.+)_(\d+)_(\d+)$/ ] }
1296    #                @loc;
1297    
1298    #     if ( (@loc2 == 0) || ( @loc != @loc2 ) )
1299    #     {
1300    #         print STDERR "SEED error: add_feature failed because location is missing or malformed:\n";
1301    #         print STDERR "$location\n";
1302    #         return undef;
1303    #     }
1304    
1305    #     if ( my @bad_names = grep { length( $_->[0] ) > 96 } @loc2 )
1306    #     {
1307    #         print STDERR "SEED error: add_feature failed because location contains a contig name of over 96 char:\n";
1308    #         print STDERR join( ", ", @bad_names ) . "\n";
1309    #         return undef;
1310    #     }
1311    
1312    #     # create type directory if it does not exist
1313    #     unless (-d "$newGdir/Features/$type") {
1314    #       mkdir "$newGdir/Features/$type";
1315    #     }
1316    
1317    #     # create an id
1318    #     my $id = "fig|$genome.$type.";
1319    #     if (-f "$newGdir/Features/$type/tbl") {
1320    #       unless (open(FILE, "<$newGdir/Features/$type/tbl")) {
1321    #           print STDERR "SEED error: could not open tbl file: $@\n";
1322    #           return undef;
1323    #       }
1324    #       my $max = 1;
1325    #       while (<FILE>) {
1326    #           my ($curr_id) = $_ =~ /^fig\|$genome\.$type\.(\d+)/;
1327    #           if ($curr_id && $curr_id > $max) {
1328    #               $max = $curr_id;
1329    #           }
1330    #       }
1331    #       close FILE;
1332    #       $max++;
1333    #       $id .= $max;
1334    #     } else {
1335    #       $id .= "1";
1336    #     }
1337    
1338    #     # append to tbl file
1339    #     unless (open(FILE, ">>$newGdir/Features/$type/tbl")) {
1340    #       print STDERR "SEED error: could not open tbl file: $@\n";
1341    #       return undef;
1342    #     }
1343    #     print FILE "$id\t$location\n";
1344    #     close FILE;
1345    
1346    #     # append to fasta file
1347    #     $sequence =~ s/\n//g;
1348    #     my $formatted_sequence = '';
1349    #     while ( length( $sequence ) > 60 ) {
1350    #       $formatted_sequence .= substr( $sequence, 0, 60 );
1351    #       $formatted_sequence .= "\n";
1352    #       $sequence = substr( $sequence, 60 );
1353    #     }
1354    #     $formatted_sequence .= $sequence;
1355    #     unless (open(FILE, ">>$newGdir/Features/$type/fasta")) {
1356    #       print STDERR "SEED error: could not open fasta file: $@\n";
1357    #       return undef;
1358    #     }
1359    #     print FILE ">$id\n$formatted_sequence\n";
1360    #     close FILE;
1361    
1362    #     # find figfam
1363    #     my $figfam = undef;
1364    
1365    #     # append to found file
1366    #     if ($figfam) {
1367    #       unless (open(FILE, ">>$newGdir/found")) {
1368    #           print STDERR "SEED error: could not open found file: $@\n";
1369    #           return undef;
1370    #       }
1371    #       print FILE "$id\t$figfam\t$function\n";
1372    #       close FILE;
1373    #     }
1374    
1375    #     # append to called_by file
1376    #     unless (open(FILE, ">>$newGdir/called_by")) {
1377    #       print STDERR "SEED error: could not open called_by file: $@\n";
1378    #       return undef;
1379    #     }
1380    #     print FILE "$id\tmanual: $user\n";
1381    #     close FILE;
1382    
1383    #     # assign function
1384    #     if ($function) {
1385    #       $self->assign_function( $id, $user, $function );
1386    #     }
1387    
1388    #     # declare success
1389    #     return 1;
1390    # }
1391    
1392  sub assign_function  sub assign_function
1393  {  {
1394      my($self, $fid, $user, $function, $confidence) = @_;      my($self, $fid, $user, $function, $confidence) = @_;

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3