[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.3 - (download) (as text) (annotate)
Tue Mar 29 19:18:40 2005 UTC (15 years, 2 months ago) by overbeek
Branch: MAIN
CVS Tags: merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, efrank-preMakefileToStandardMk, caBIG-00-00-00, merge-bobdev_news-2, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news
Changes since 1.2: +10 -5 lines
fixes to db_xrefs

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,
	       fig  => 7
	     );

while (defined($line = <STDIN>))
{
    chop $line;
    if ($line =~ /(\S+)$/)
    {
	$id = $1;
	if ($id =~ /^fig\|/) 
	{
	    @possible_xrefs = ($id,$fig->feature_aliases($id));
	}
	elsif ($peg = $fig->by_alias($id))
	{
	    @possible_xrefs = ($peg,$fig->feature_aliases($peg));
	}
	else
	{
	    @possible_xrefs =  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