[Bio] / DrugTargets / DrugTargetsWebDetails.pl Repository:
ViewVC logotype

View of /DrugTargets/DrugTargetsWebDetails.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (download) (as text) (annotate)
Wed Aug 31 15:31:29 2005 UTC (14 years, 9 months ago) by hwang
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +36 -1 lines
Changed files to incorporate fangfang's and kaitlyn's script.
ShowTable.pl
	Shows and edits the tables in the archives

#!/usr/bin/perl
use CGI qw(:standard);
use FIG;

$fig = new FIG;

print "Content-type: text/html; charset=UTF-8\n\n";

print "<form action=ShowDrugTablesForm.cgi method=post>";
print "Organism";
print "<p>";
print "<select size=5 name=organism>";
print "<option value=N315>Staphylococcus aureus subsp. aureus N315</option>";
print "<option value=XX>strep</option>";
print "</select>";
print " AND ";
print "<select multiple name=category>";
print "<option value='antibiotic_inhibitor'>Antibiotic Inhibitor </option>";
print "<option value='cell_surface'> Cell Surface </option>";
print "<option value=essential> Essential </option>";
print "<option value=toxin>Toxin </option>";
print "<option value='virulence-associated'>Virulence associated </option>";
print "</select>";
print "<p>";
print "Show table with these attributes:";
print "<p>";
print "<select multiple size=5 name=showForm>";
print "<option value=geneId> Gene Id</option>";
print "<option value=figId> Fig Id</option>";
print "<option value=className> Genbank Id</option>";
print "<option value=functionalRole> Functional Role</option>";
print "<option value=pdbName> PDB Name</option>";
print "<option value=pdbSeqLen> PDB Sequence Length</option>";
print "<option value=protdist> ProtDist</option>";
print "<option value=consSeq> Conservation of Seqs</option>";
print "<option value=pass> PASS GIF</option>";

print "</select>";

print "<p>";
print "<input type=submit size=25 value=Submit>";
print "</p>";
print "</form>";

print "<TABLE ID=table0 BORDER=1 width=80%>";
print "<TBODY>";
print "<tr>
      <th>Category</th><th>Gene Name</th><th>Gene Id</th>
      <th>Functional Role</th><th nowrap>Peg Id</th><th>GenBank Id</th>
      <th>UniProt Id</th><th>PDB</th>
      <th>PDB Title</th><th>bit: e value</th>
      <th>Peg SeqLen</th><th>PDB SeqLen</th><th>ProtDist</th> 
      <th>Conservation of Seqs</th><th>PASS</th>
      <th>PDB_Ligand_CLiBE</th>
      </tr>\n";

$dataDir = "$FIG_Config::fig/var/DrugTargets";
$dataFile = "$dataDir/drugTargetsWebDetails.txt";

if (!open DRUG_TARGETS, $dataFile) {  
    warn "can't open file $dataFile: $!";
    print "<h1>Cannot open data file</h1>\n";
    print "Cannot open data file $dataFile: $!\n";
    exit 0;                                       
}         

$pdbLigandFile = "$dataDir/pdb_ligand_table_CLiBE.txt";
if (!open PDB_LIGAND, $pdbLigandFile) {
    warn "can't open file $pdbLigandFile: $!";
    print "<h1>Cannot open data file</h1>\n";
    print "Cannot open data file $pdbLigandFile: $!\n";
    exit 0;
}

my @pdbLigandList = <PDB_LIGAND>;

my @drugTargetList = <DRUG_TARGETS>;

#open(OUT, "> hash_table.txt");

# read from pdb_ligand_table_CLiBE.txt and put the (searchPdbID, linkedLigand) pairs into a hashtable 
#  to ease search on searchPdbID and get corresponding PDB_LIGAND_CLiBE attribute
my %pdb_ligand_hash = ();
for (@pdbLigandList) {
    @columns = split(/\t/);
    # (key,value) = (searchPdbID,PDB_Ligand_ID) in the file
    $columns[1] =~ s/<\/a>.*/<\/a>/;
    $pdb_ligand_hash{$columns[0]} = $columns[1];
}

#while( ($key, $value) = each %pdb_ligand_hash) {
#    print OUT "$key => $value\n";
#}
#close OUT;

for (@drugTargetList) {
    @cols       = split(/\t/);
    $searchTerm = $cols[0];	
    $figId      = $cols[1];	
    $category   = $cols[2];
    $pdbName    = $cols[3];
    $tag        = $cols[4];
    $eNo        = $cols[5];
    $pdbTitle   = $cols[6];
    $pegLen     = $cols[7];
    $pdbLen     = $cols[8];
    $protDist   = $cols[9];
    $pass       = $cols[10];
    $cons       = $cols[11];

    if ($cons >= 0.8) {$cons = "<B>$cons</B>";}

    if ($pdbName =~ /none/i) {
	$eNo = $pdbLen = $protDist = "-";
    } else {
	$minLen = ($pdbLen < $pegLen) ? $pdbLen : $pegLen;
	$diff = ($pdbLen - $pegLen);
	if ($diff > -$minLen/2 && $diff < $minLen/2) {
	    $pdbLen = "<B>$pdbLen</B>";
	}
	if ($protDist < 0.3) {
	    $protDist = "<B>$protDist</B>";
	}
	$protDist = "<a href=peg_pdb_align.cgi?peg=$figId&pdb=$pdbName>$protDist</a>";
    }
    $functionOf = $fig->function_of($figId);

    if ($pdbName !~ /NONE/i) {
	$pdbUrl = $pdbName;
	$pdbUrl =~ s/pdb//g;
	$pdbUrl =~ s/\.ent//g;
	$pdbUrl =~ s/\.noc//g;
	$Url = '<a href=http://pdb-test-c01-03.sdsc.edu/pdb/explore.do?structureId=' . $pdbUrl . ' target=_blank>' . $pdbName . '</a>'; 
    } else {
	$Url = $pdbName;
    }
    $figIdUrl = '<a href=http://theseed.uchicago.edu/FIG/protein.cgi?prot=' . $figId . '&user= target=_blank>' . $figId . '</a>';
    
    # get the aliases of this figId
    @aliases = $fig->feature_aliases($figId);
    # filter out the geneID from aliases
    @genes = grep { $_ !~ /.*(\||\_|\:).*/ } @aliases;
    $geneId = join (",", @genes);

    # get the UniProt ID from aliases
    @uniIds = grep {/.*uni.*/} @aliases; 
    # get the uni number and the url
    map { $_ =~ s/uni\|// } @uniIds;
    map { $_ = '<A HREF=http://www.pir.uniprot.org/cgi-bin/upEntry?id=' . $_ . ' target=_blank>uni|' . $_ . '</A>'} @uniIds;


    # get the GeneBank ID(gi) from aliases
    @gids = grep {/.*gi.*/} @aliases;
    # get the gi number and the url
    map { $_ =~ s/gi\|// } @gids;
    map { $_ = '<A HREF=http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?db=protein&val=' . $_ . ' target=_blank>gi|' . $_ . '</A>'} @gids;

    $passLink = $passGif = $pdbName;
    $passLink =~ s/ent/pass/;
    $passGif =~ s/\.ent/_pass_all\.gif/;

    $gif = "http://ci-www.uchicago.edu/~fangfang/PDB-P/$passLink/$passGif";
    $link = ($pass =~ /PASS/i) ? "<a href=\"$gif\">GIF</a>" : $pass;
   
    # get the pdb-ligand information from CLiBE (DrugTargetsData/pdb_ligand_table_CLiBE.txt)
    # just retrieve from the pdb_ligand_hash
    if ($pdbName !~ /NONE/i) {
	# get the pdbID
        $pdbID = $pdbName;
        $pdbID =~ s/pdb//g;
        $pdbID =~ s/\.ent//g;
        $pdbID =~ s/\.noc//g;
	# For each pdbID,
        #  search on the hashtable to find the corresponding Ligand-Receptor_ID 
        #  and put this column into the attribute table

	if (exists $pdb_ligand_hash{$pdbID}) { 
            # get the attribute 
	    $PDB_LIGAND_CLiBE = $pdb_ligand_hash{$pdbID};
	} else { 
            # no this pdbID entry in CLiBE, leave it blank
	    $PDB_LIGAND_CLiBE = "FAIL";
	}
    } else { 
        # the pdbID is empty
	# leave the attribute blank
        $PDB_LIGAND_CLiBE = "FAIL";
    }

    print "<tr>
              <td>$category</td><td>$searchTerm</td><td>$geneId</td>
              <td>$functionOf</td><td>$figIdUrl</td><td>@gids</td>
              <td>@uniIds</td><td>$Url</td>
              <td>$pdbTitle</td><td>$eNo</td>
              <td>$pegLen</td><td>$pdbLen</td>
              <td>$protDist</td>
              <td>$cons</td>
              <td>$link</td>
              <td>$PDB_LIGAND_CLiBE</td>
           </tr>";
}

print "</TABLE>";
print "</BODY>";
print "</HTML>";


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3