src/hg/hgc/hgc.c 1.1565

1.1565 2009/08/05 22:58:07 hiram
Avoid Ensembl protein out link when non-coding gene
Index: src/hg/hgc/hgc.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgc/hgc.c,v
retrieving revision 1.1564
retrieving revision 1.1565
diff -b -B -U 4 -r1.1564 -r1.1565
--- src/hg/hgc/hgc.c	5 Aug 2009 19:50:17 -0000	1.1564
+++ src/hg/hgc/hgc.c	5 Aug 2009 22:58:07 -0000	1.1565
@@ -7857,13 +7857,16 @@
             archive, genomeStrEnsembl);
 else
     safef(ensUrl, sizeof(ensUrl), "http://www.ensembl.org/%s", genomeStrEnsembl);
 
+boolean nonCoding = FALSE;
 char query[512];
 safef(query, sizeof(query), "name = \"%s\"", itemName);
 struct genePred *gpList = genePredReaderLoadQuery(conn, "ensGene", query);
 if (gpList && gpList->name2)
     {
+    if (gpList->cdsStart == gpList->cdsEnd)
+	nonCoding = TRUE;
     printf("<B>Ensembl Gene Link: </B>");
     if (sameString(gpList->name2, "noXref"))
        printf("none<BR>\n");
     else
@@ -7975,8 +7978,14 @@
 #endif
     }
 if (hTableExists(database, "ensGtp") && (proteinID == NULL))
     {
+    if (nonCoding)
+	{
+	printf("<B>Ensembl Protein: </B>none (non-coding)<BR>\n");
+	}
+    else
+	{
     /* shortItemName removes version number but sometimes the ensGtp */
     /* table has a transcript with version number so exact match not used */
     safef(cond_str2, sizeof(cond_str2), "transcript like '%s%%'", shortItemName);
     proteinID=sqlGetField(database, "ensGtp","protein",cond_str2);
@@ -7987,8 +7996,9 @@
             ensUrl,proteinID);
         printf("%s</A><BR>\n", proteinID);
 	}
     }
+    }
 freeMem(shortItemName);
 }
 
 void doEnsemblGene(struct trackDb *tdb, char *item, char *itemForUrl)