/* doSamT02 prints out the UCSC SAM-T02 Protein Structure Analysis and Prediction sub-section */
#include "common.h"
#include "hdb.h"
#include "pbTracks.h"
char *getSgdId(char *protId, char *database)
/* Get SGD gene ID from a Swiss-Prot ID */
{
struct sqlConnection *conn2 = hAllocConn(database);
char condStr[256];
char *sgdId;
sprintf(condStr, "proteinId='%s'", protId);
sgdId = sqlGetField(database, "sgdGene", "name", condStr);
hFreeConn(&conn2);
return(sgdId);
}
void doSamT02(char *proteinId, char *database)
/* display the UCSC SAM-T02 Protein Structure Analysis and Prediction section */
{
char *itemName = NULL;
char query2[256];
struct sqlResult *sr2;
char **row2;
struct sqlConnection *conn, *conn2 = hAllocConn(database);
char condStr[256];
char *chp;
char *samSubDir;
char *samHttpStr0 = NULL; /* SAM server*/
char *samHttpStr = NULL; /* UCSC GB site */
int homologCount;
char *homologID;
char *SCOPdomain;
char *chain;
char *bestEValStr = NULL;
float eValue, bestEVal;
char goodSCOPdomain[40];
int first = 1;
/* return if this genome does not have SAM protein analysis results */
/* defensive logic to guard against the situation that the binary program is pushed, but the data tables are not */
conn = sqlConnect(database);
if (!(sqlTableExists(conn, "samSubdir") && sqlTableExists(conn, "protHomolog")))
{
return;
}
sqlDisconnect(&conn);
if (!sameWord(database, "sacCer1"))
{
return;
}
itemName = proteinId;
if (sameWord(database, "sacCer1"))
{
samHttpStr0 = strdup("http://www.soe.ucsc.edu/research/compbio/yeast-protein-predictions");
samHttpStr = strdup("../goldenPath/sacCer1/sam");
/* SAM analysis of SGD proteins uses SGD ID, not Swiss-Prot AC */
itemName = getSgdId(proteinId, database);
}
if (itemName == NULL) return;
sprintf(condStr, "proteinId='%s'", itemName);
samSubDir = sqlGetField(database, "samSubdir", "subdir", condStr);
if (samSubDir == NULL) return;
hPrintf("UCSC ");
hPrintf("SAM-T02\n");
hPrintf(" Protein Structure Analysis and Prediction on %s", proteinId);
if (!sameWord(proteinId, itemName)) hPrintf(" (aka %s)", itemName);
hPrintf("
\n");
hPrintf(" Multiple Alignment (sequence logo): \n");
hPrintf("%s (pdf)
\n", itemName);
hPrintf(" Secondary Structure Predictions: \n");
hPrintf("%s (pdf)
\n", itemName);
hPrintf(" Close Homologs: \n");
conn2= hAllocConn(database);
sprintf(query2,
"select homologID,eValue,SCOPdomain,chain from %s.protHomolog where proteinID='%s' and evalue <= 0.01 order by evalue;",
database, itemName);
sr2 = sqlMustGetResult(conn2, query2);
row2 = sqlNextRow(sr2);
homologCount = 0;
strcpy(goodSCOPdomain, "dummy");
bestEVal = 100;
while (row2 != NULL)
{
homologID = row2[0];
sscanf(row2[1], "%e", &eValue);
if (first)
{
bestEVal = eValue;
bestEValStr = strdup(row2[1]);
}
SCOPdomain = row2[2];
chp = SCOPdomain+strlen(SCOPdomain)-1;
while (*chp != '.') chp--;
*chp = '\0';
chain = row2[3];
if (eValue <= 1.0e-10)
{
strcpy(goodSCOPdomain, SCOPdomain);
}
else
{
if (strcmp(goodSCOPdomain,SCOPdomain) != 0)
{
goto skip;
}
else
{
if (eValue > 0.1) goto skip;
}
}
if (first)
{
first = 0;
}
else
{
printf(", ");
}
hPrintf("\n= 1)
{
hPrintf("\"TARGET=_blank>%s(chain %s)\n", homologID, chain);
}
else
{
hPrintf("\"TARGET=_blank>%s\n", homologID);
}
homologCount++;
skip:
row2 = sqlNextRow(sr2);
}
sqlFreeResult(&sr2);
hFreeConn(&conn2);
if (homologCount == 0)
{
hPrintf("None\n");
}
hPrintf("
More Details: \n");
hPrintf("%s
\n", itemName);
if (homologCount > 0)
{
hPrintf(" 3D Structure Prediction: \n");
hPrintf("%s (PDB format, gzipped)
\n", itemName);
hPrintf(" 3D Pictures of the Best Model");
hPrintf(" (E Value: %s):
\n", bestEValStr);fflush(stdout);
hPrintf("
"); hPrintf(" | ![]() | \n",
samHttpStr, samSubDir, itemName, itemName);
hPrintf("![]() | \n",
samHttpStr, samSubDir, itemName, itemName);
hPrintf("![]() | \n",
samHttpStr, samSubDir, itemName, itemName);
hPrintf("
"); hPrintf(" | Front | "); hPrintf("Top | "); hPrintf("Side | "); hPrintf("
"); hPrintf(" | 500x500 | \n", samHttpStr, samSubDir, itemName, itemName); hPrintf("500x500 | \n", samHttpStr, samSubDir, itemName, itemName); hPrintf("500x500 | \n", samHttpStr, samSubDir, itemName, itemName); hPrintf("