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

Annotation of /FigKernelScripts/db_xrefs_of.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download) (as text)

1 : olson 1.4 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : overbeek 1.1
19 :     use FIG;
20 :     my $fig = new FIG;
21 :    
22 :     # usage: db_xrefs_of < IDs > ID-Xrefs
23 :     #
24 :    
25 :     %tag_order = ( gene => 1,
26 :     sp => 2,
27 :     nr => 3,
28 :     uni => 4,
29 :     kegg => 5,
30 : overbeek 1.3 gi => 6,
31 :     fig => 7
32 : overbeek 1.1 );
33 :    
34 : overbeek 1.2 while (defined($line = <STDIN>))
35 : overbeek 1.1 {
36 : overbeek 1.2 chop $line;
37 :     if ($line =~ /(\S+)$/)
38 : overbeek 1.1 {
39 :     $id = $1;
40 :     if ($id =~ /^fig\|/)
41 :     {
42 : overbeek 1.3 @possible_xrefs = ($id,$fig->feature_aliases($id));
43 :     }
44 :     elsif ($peg = $fig->by_alias($id))
45 :     {
46 :     @possible_xrefs = ($peg,$fig->feature_aliases($peg));
47 : overbeek 1.1 }
48 :     else
49 :     {
50 : overbeek 1.3 @possible_xrefs = map { $_->[0] }
51 :     $fig->mapped_prot_ids($id);
52 : overbeek 1.1 }
53 : overbeek 1.3
54 : overbeek 1.1 @xrefs = map { $_->[0] }
55 :     grep { ($_->[1] ne "misc") && ($_->[1] ne "gene") }
56 :     map { [$_,&type_alias($_)] }
57 :     @possible_xrefs;
58 : overbeek 1.2 print "$line\t",join(",",@xrefs),"\n";
59 : overbeek 1.1 }
60 :     }
61 :    
62 :     sub type_alias {
63 :     my($alias) = @_;
64 :    
65 :     if (($alias =~ /^([^|]+)\|\S+$/) && defined($tag_order{$1}))
66 :     {
67 :     return $1;
68 :     }
69 :     elsif ($alias =~ /^[NXYZA]P_/)
70 :     {
71 :     return "nr";
72 :     }
73 :     elsif (($alias =~ /^[a-zA-Z]{3,4}$/) || ($alias =~ /^[a-zA-Z]{1,3}\d+$/))
74 :     {
75 :     return "gene";
76 :     }
77 :     return "misc";
78 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3