コード例 #1
0
ファイル: search.c プロジェクト: elmargb/kentUtils
static void transformToCanonical(struct searchResult *list,
	struct sqlConnection *conn)
/* Transform search results to canonical versions.  */
{
struct dyString *dy = newDyString(1024);
char *cannon = genomeSetting("canonicalTable");
char *isoform = genomeSetting("isoformTable");
struct sqlResult *sr;
char **row;
struct searchResult *el;
for (el = list; el != NULL; el = el->next)
    {
    dyStringClear(dy);
    sqlDyStringPrintf(dy, 
    	"select %s.transcript,%s.chrom,%s.chromStart,%s.chromEnd,%s.protein ",
	cannon, cannon, cannon, cannon, cannon);
    sqlDyStringPrintf(dy,
	"from %s,%s ",
	isoform, cannon);
    sqlDyStringPrintf(dy,
        "where %s.transcript = '%s' ",
	isoform, el->gp.name);
    sqlDyStringPrintf(dy,
        "and %s.clusterId = %s.clusterId",
	isoform, cannon);
    sr = sqlGetResult(conn, dy->string);
    if ((row = sqlNextRow(sr)) != NULL)
	genePosFillFrom5(&el->gp, row);
    sqlFreeResult(&sr);
    }
dyStringFree(&dy);
}
コード例 #2
0
ファイル: knownGene.c プロジェクト: blumroy/kentUtils
static struct genePos *genePosFromQuery(struct sqlConnection *conn, char *query, boolean oneOnly)
/* Get all positions from a query that returns 5 columns. */
{
struct sqlResult *sr;
char **row;
struct genePos *gpList = NULL, *gp;
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    AllocVar(gp);
    genePosFillFrom5(gp, row);
    slAddHead(&gpList, gp);
    if (oneOnly)
        break;
    }
sqlFreeResult(&sr);
return gpList;
}