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

View of /FigKernelScripts/db_xrefs_of.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Tue Mar 29 16:06:09 2005 UTC (15 years, 2 months ago) by overbeek
Branch: MAIN
Changes since 1.1: +4 -3 lines
updates to db_xref_of

use FIG;
my $fig = new FIG;

# usage: db_xrefs_of < IDs > ID-Xrefs
#

%tag_order = ( gene => 1,
	       sp   => 2,
	       nr   => 3,
	       uni  => 4,
	       kegg => 5,
	       gi   => 6
	     );

while (defined($line = <STDIN>))
{
    chop $line;
    if ($line =~ /(\S+)$/)
    {
	$id = $1;
	if ($id =~ /^fig\|/) 
	{
	    @possible_xrefs = $fig->feature_aliases($id);
	}
	else
	{
	    @possible_xrefs =  grep { $_ ne $id }
		               map  { $_->[0] }
	    $fig->mapped_prot_ids($id);
	}
	@xrefs =  map { $_->[0] }        
	          grep { ($_->[1] ne "misc") && ($_->[1] ne "gene") } 
	          map { [$_,&type_alias($_)] } 
	          @possible_xrefs;
	print "$line\t",join(",",@xrefs),"\n";
    }
}

sub type_alias {
    my($alias) = @_;

    if (($alias =~ /^([^|]+)\|\S+$/) && defined($tag_order{$1}))
    {
	return $1;
    }
    elsif ($alias =~ /^[NXYZA]P_/)
    {
	return "nr";
    }
    elsif (($alias =~ /^[a-zA-Z]{3,4}$/) || ($alias =~ /^[a-zA-Z]{1,3}\d+$/))
    {
	return "gene";
    }
    return "misc";
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3