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

View of /FigKernelScripts/sort_by_annotator.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Thu Jun 30 15:45:24 2011 UTC (8 years, 4 months ago) by disz
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2014_0729, mgrast_release_3_1_2, mgrast_release_3_1_1, rast_rel_2011_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_10262011, HEAD
Changes since 1.1: +0 -1 lines
Fixed bad links

use File::stat;
use Data::Dumper;
use FileHandle;
use strict;
use FIG;
#use Time::localtime;
use Time::Local;

#
# be sure to source the config for the SEED you want to check these annotations against.
# 

if (scalar @ARGV != 1) {
	 die "Usage: sort_by_anotator seed\n";
 }

my %annos;
my $seed = shift;
my $fig = new FIG;

    local $/ = "//\n";

    my ($fid, $anno_time, $who, $anno_text, $anno_who, $fn);

    while (my $ann = <>)
    {
        chomp $ann;
        if ((($fid, $anno_time, $who, $anno_text, undef, $anno_who, $fn) =
             ($ann =~ /^(fig\|\d+\.\d+\.peg\.\d+)\n(\d+)\n(\S+)\n(Set(\s+(FIG|master))?\s+function\s+to[ \t]*\n(.*))/s)) )
        {
		chop($fn);
		my $genome = $fig->genome_of($fid);
		$genome = $fig->genus_species($genome). ": " . make_genome_link($genome, $seed);
		if (length($fn) > 30) {
			$fn = substr($fn, 0, 27) . "...";
		}
		push (@{$annos{$who}{$genome}}, make_link($fid, $seed).": ". $fn."<br>\n");
		#push (@{$annos{$who}{$genome}}, "<dt>".make_link($fid).": ". $fn."</dt>\n");
	}
    }

    if (keys (%annos)) {
	print "<dl>\n";
	for my $key (sort keys(%annos)) {
	  print "<dt><h2>BY: $key</h2></dt>\n";
	  for my $g (sort keys(%{$annos{$key}})) {
		  #print "<dt><h3>$g</h3><dt>\n";
		  print "<dt>$g<dt>\n";
		  print join("\n", @{$annos{$key}{$g}});
		  print "<br>\n";
	  }
	}
	print "</dl>\n";
    } else {
	    print "None\n";
    }


sub make_link {
	  my ($id, $seed) = @_;

	  return "<a href='http://$seed.theseed.org/linkin.cgi?id=$id' target='_blank'>$id</a>";
}

sub make_genome_link {
	  my ($id, $seed) = @_;

	  return "<a href='http://$seed.theseed.org/linkin.cgi?genome=$id' target='_blank'>$id</a>";
  }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3