e70152e44cc66cc599ff6b699eb8adc07f3e656a
kent
Sat May 24 21:09:34 2014 -0700
Adding Copyright NNNN Regents of the University of California to all files I believe with reasonable certainty were developed under UCSC employ or as part of Genome Browser copyright assignment.
diff --git src/hg/hgGene/dnaBindMotif.c src/hg/hgGene/dnaBindMotif.c
index 17cd370..63027fe 100644
--- src/hg/hgGene/dnaBindMotif.c
+++ src/hg/hgGene/dnaBindMotif.c
@@ -1,99 +1,102 @@
/* This shows the section on the binding motif of a
* transcription factor. */
+/* Copyright (C) 2013 The Regents of the University of California
+ * See README in this or parent directory for licensing information. */
+
#include "common.h"
#include "hash.h"
#include "linefile.h"
#include "jksql.h"
#include "dnaMotif.h"
#include "dnaMotifSql.h"
#include "hui.h"
#include "portable.h"
#include "hgGene.h"
static char *orfToGene(struct sqlConnection *conn, char *orf)
/* Return gene name of given orf, or NULL if it
* doesn't exist. */
{
char gene[256];
char query[256];
sqlSafef(query, sizeof(query), "select value from sgdToName where name = '%s'",
orf);
if (sqlQuickQuery(conn, query, gene, sizeof(gene)) == NULL)
return NULL;
return cloneString(gene);
}
static boolean transRegCodeMotifExists(struct section *section,
struct sqlConnection *conn, char *geneId)
/* Return TRUE if tables exists and have our gene. */
{
char *gene;
if (!sqlTableExists(conn, "transRegCodeMotif"))
return FALSE;
if (!sqlTableExists(conn, "sgdToName"))
return FALSE;
gene = orfToGene(conn, geneId);
if (gene == NULL)
return FALSE;
return sqlRowExists(conn, "transRegCodeMotif", "name", gene);
}
struct dnaMotif *dnaMotifLoadNamed(struct sqlConnection *conn,
char *table, char *name)
/* Load motif of given name from table. Return NULL if no such
* motif. */
{
char where[256];
sqlSafefFrag(where, sizeof(where), "name='%s'", name);
return dnaMotifLoadWhere(conn, table, where);
}
struct dnaMotif *transRegMotif(struct sqlConnection *conn, char *geneId)
/* Get motif for gene, NULL if none. */
{
struct dnaMotif *motif = NULL;
char *gene = orfToGene(conn, geneId);
if (gene != NULL)
motif = dnaMotifLoadNamed(conn, "transRegCodeMotif", gene);
return motif;
}
static void transRegCodeMotifPrint(struct section *section,
struct sqlConnection *conn, char *geneId)
/* Print out transcription regulatory code info. */
{
struct dnaMotif *motif = transRegMotif(conn, geneId);
if (motif != NULL)
{
struct tempName pngTn;
dnaMotifMakeProbabalistic(motif);
makeTempName(&pngTn, "logo", ".png");
dnaMotifToLogoPng(motif, 47, 140, NULL, "../trash", pngTn.forCgi);
hPrintf(" ");
hPrintf("", pngTn.forHtml);
hPrintf("\n");
hPrintf("
"); dnaMotifPrintProb(motif, stdout); hPrintf("