G::Tools GOA
Included librariesPackage variablesGeneral documentationMethods
Package variables
No package variables defined.
Included modules
G::Messenger
SelfLoader
SubOpt
Inherit
Exporter
Synopsis
No synopsis!
Description
No description!
Methods
gopac
No description
Code
read_goa
No description
Code
set_goa
No description
Code
Methods description
None available.
Methods code
gopacdescriptionprevnextTop
sub gopac {
    my $gb = shift;
    my $gopac = shift;
    my $n = 0;

    my $id = $gb->{CDS1}->{feature};
    unless (length($gb->{"FEATURE$id"}->{gopac})){
        set_goa($gb);
    }

    foreach my $cds ($gb->cds('all')){
	if ($gb->{$cds}->{gopac} =~ /$gopac/){
	    $gb->{$cds}->{on} = 1;
	    $n ++;
	}else{
	    $gb->{$cds}->{on} = 0;
	}
    }

    return $n;
}
read_goadescriptionprevnextTop
sub read_goa {
    my $goa = {};
    my $path = shift;
    $path ||= '/db/genesys/sprot/gene_association.goa_sptr';
    my $n = 0;
    my %codeorder = (IEA=>1, NAS=>2, ISS=>3, IEP=>3,
		     IMP=>4, IGI=>4, IPI=>4, TAS=>5,
		     IDA=>5);

    open(FILE, $path) || die($!);
    while(<FILE>){
	chomp;
	my (undef, $id, $entry, undef, $go, undef, $evidence, undef, $aspect,
	    undef, undef, undef, undef, $date, undef) = split(/\t/, $_, 15);
	$n ++;
	print STDERR "." if ($n %100000 == 0);

	my $i = 1;
	my $flag = 0;
	while(1){
	    if($goa->{$id}->{$aspect}->{$i}->{GO}){
		if($goa->{$id}->{$aspect}->{$i}->{GO} eq $go){
		    if($codeorder{$goa->{$id}->{$aspect}->{$i}->{evidence}} <
		       $codeorder{$evidence})
		    {
			$goa->{$id}->{$aspect}->{$i}->{GO} = $go;
			$goa->{$id}->{$aspect}->{$i}->{evidence} = $evidence;
			$goa->{$id}->{$aspect}->{$i}->{date} = $date;
			$goa->{$id}->{$aspect}->{$i}->{entry} = $entry;
		    }
		    $flag = 1;
		    last;
		}else{
		    $i ++;
		}
	    }else{
		last;
	    }
	}
	next if ($flag);
	
	$goa->{$id}->{$aspect}->{$i}->{GO} = $go;
	$goa->{$id}->{$aspect}->{$i}->{evidence} = $evidence;
	$goa->{$id}->{$aspect}->{$i}->{date} = $date;
	$goa->{$id}->{$aspect}->{$i}->{entry} = $entry;
    }
    close(FILE);
    
    print STDERR "\n";

    return $goa;
}
set_goadescriptionprevnextTop
sub set_goa {
    my $gb = shift;
    my $path = shift || '';
    my $goa = read_goa($path);
    my %codeorder = (IEA=>1, NAS=>2, ISS=>3, IEP=>3,
		     IMP=>4, IGI=>4, IPI=>4, TAS=>5,
		     IDA=>5);

    print STDERR "loaded GOA...\n";

    if ($gb->filepath() =~ /\.embl$/){
	foreach my $cds ($gb->cds()){
	    my $xref = $gb->{$cds}->{db_xref};
	    my $id;
	    if ($xref =~ /SWISS-PROT\:(.*)/ || $xref =~ /UniProt\/TrEMBL:(.*)/){
		$id = $1;
		
		if ($goa->{$id}){
		    my %goanum = (0=>1);
		    foreach my $aspect (keys %{$goa->{$id}}){
			foreach my $i (keys %{$goa->{$id}->{$aspect}}){
			    $gb->{$cds}->{"GO:$aspect"} .= 
				$goa->{$id}->{$aspect}->{$i}->{GO} . ";";
			    $gb->{$cds}->{"GO:$aspect:evidence"} .=
				$goa->{$id}->{$aspect}->{$i}->{evidence} . ";";
			    $goanum{$codeorder{$goa->{$id}->{$aspect}->{$i}->{evidence}}}++;
			}
		    }
		    $gb->{$cds}->{gopac} = join('', (sort keys %goanum));
		}
	    }
	}
    }
}
General documentation
No general documentation available.