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

View of /FigKernelScripts/explore_subsys_pmid.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.5 - (download) (as text) (annotate)
Wed Mar 14 18:13:33 2007 UTC (12 years, 11 months ago) by hwang
Branch: MAIN
CVS Tags: mgrast_dev_08112011, rast_rel_2009_05_18, mgrast_dev_08022011, rast_rel_2014_0912, rast_rel_2008_06_18, myrast_rel40, rast_rel_2008_06_16, mgrast_dev_05262011, rast_rel_2008_12_18, mgrast_dev_04082011, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, mgrast_version_3_2, mgrast_dev_12152011, rast_rel_2008_04_23, mgrast_dev_06072011, rast_rel_2008_09_30, rast_rel_2009_0925, rast_rel_2010_0526, rast_rel_2014_0729, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, rast_rel_2008_10_09, mgrast_dev_04012011, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0923, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_04052011, mgrast_dev_02222011, rast_rel_2009_03_26, mgrast_dev_10262011, rast_rel_2008_11_24, rast_rel_2008_08_07, HEAD
Changes since 1.4: +20 -8 lines
PEG information is no longer stored in the file. Parsing of the file in this script have been changed

use strict;
use Getopt::Long qw(:config no_ignore_case bundling);;
use FIG;

# Kaitlyn Hwang
# There is no database implementation for storing pumed. 
# This script allows the user to read a file, that is tab deliminated. It allows access from 
# - subsystem to functional role peg to pmids
# - subsystem to pmid
# This program can be replaced once a database is implemented.

my %functional_role=();
my %subsystem = ();
my %literature =();
my %fr2pmid=();
my @sub2pmid;

my($file_name, $all,$role,$peg,$pmid,$literature,$role_peg);

my $result = GetOptions(
			"subsystem|s=s" => \$file_name,		
			"all|a=s" => \$all,
			"role|r=s" => \$role,
			"peg|p=s" => \$peg,
			"pmid|i=s" => \$pmid,
			"literature|l=s" => \$literature,
			"role_peg|z=s" => \$role_peg,

if (! $file_name) {
    print "Provide a subsystem name\n";

#Files are in the temp directory because the file used to creat the file
#will be created in the temp directory
my $file_path = "$FIG_Config::temp/$file_name";


if($all) {


if($role_peg) {


if($literature) {

    &get_pmid_to_all_pegs($role, $pmid);

if(($role) && (!$pmid) && (!$role_peg)){

sub set_fr_peg_pmid  {
    open(SUB2PMID, "$file_path") or die "Can't find subsystem $file_path\n";
    @sub2pmid = <SUB2PMID>;

    # Get all the functional roles in the subsystem and put the functional role in a hash. 
    foreach(@sub2pmid) {
	my ($fr, undef, undef) = split(/\t/,$_);
	$functional_role{$fr} = $fr;


    #For each unique functional roles, have two hashes. One where  it 
    #is in this format: subsystem{functional role}{count} = string of pmid
    #For each unique functional roles, Another where it is in  this 
    #format: subsystem{functional role}{pmid} = count numbers
    #count numbers were previously peg numbers. However with the arrival of the attribute
    #database, we don't need to keep track of pegs in the functional role
    foreach my $fr (keys %functional_role ) {
	my $count = 0;
	foreach(@sub2pmid) {
	    my ($fr_file , $pmid_file) = split(/\t/,$_);
	    if ($fr eq $fr_file) {
		$subsystem{$fr_file}{$count++} = $pmid_file;
		#second hash
		my @all_pmid = split(/\s+/,$pmid_file);
		my @pmid_in;
                foreach my $the_pmid (@all_pmid) {
		   push @{$literature{$fr_file}{$the_pmid}}, $count++;

# Set the functional role to hold all the unique pmids
sub set_fr_to_uniq_pmids {
    for my $family (keys %subsystem) {
	my %uniq_pmid =();
	foreach my $peg_in_subsystem (keys %{$subsystem{$family}}) {
	    my $pmid_string = $subsystem{$family}{$peg_in_subsystem};
	    my @pmid = split(/\s+/,$pmid_string);
	    foreach(@pmid) {
		$uniq_pmid{$_} = $_;
	my $keys = join(" ", keys %uniq_pmid);
	$fr2pmid{$family} = $keys;

# Prints everything in the hash. Subsystem name, PEG, PMID
sub print_all_roles_pmid {
      for my $fr (keys %subsystem) {
	for my $peg (keys %{$subsystem{$fr}}) {
	    print "$fr\t$peg\t$subsystem{$fr}{$peg}";

sub print_role_peg {
    my($role,$peg) = @_;
       print "$subsystem{$role}{$peg}";

sub print_literature {
    for my $fr (keys %literature) {
	for my $peg (keys %{$literature{$fr}}) {
	    print "$fr\t$peg\t@{$literature{$fr}{$peg}}\n";

sub get_role_to_all_pmid {
    my ($role) = $_[0];
    print $fr2pmid{$role}; 

sub get_pmid_to_all_pegs {
    my ($role,$pmid) = @_;
    print "$pmid\t@{$literature{$role}{$pmid}}\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3