6f726d2bcdb4fca993c06cf2181dce97b061702d kate Thu Feb 22 08:59:49 2018 -0800 Add support for custom tracks and hub tracks. refs #17512 diff --git src/hg/lib/interact.c src/hg/lib/interact.c index 8795022..214adac 100644 --- src/hg/lib/interact.c +++ src/hg/lib/interact.c @@ -1,29 +1,31 @@ /* interact.c was originally generated by the autoSql program, which also * generated interact.h and interact.sql. This module links the database and * the RAM representation of objects. */ #include "common.h" #include "linefile.h" #include "dystring.h" +#include "asParse.h" #include "jksql.h" #include "interact.h" char *interactCommaSepFieldNames = "chrom,chromStart,chromEnd,name,score,value,exp,color,sourceChrom,sourceStart,sourceEnd,sourceName,targetChrom,targetStart,targetEnd,targetName"; + void interactStaticLoad(char **row, struct interact *ret) /* Load a row from interact table into ret. The contents of ret will * be replaced at the next call to this function. */ { ret->chrom = row[0]; ret->chromStart = sqlUnsigned(row[1]); ret->chromEnd = sqlUnsigned(row[2]); ret->name = row[3]; ret->score = sqlUnsigned(row[4]); ret->value = sqlDouble(row[5]); ret->exp = row[6]; ret->color = sqlUnsigned(row[7]); ret->sourceChrom = row[8]; ret->sourceStart = sqlUnsigned(row[9]); @@ -233,24 +235,55 @@ fprintf(f, "%s", el->targetChrom); if (sep == ',') fputc('"',f); fputc(sep,f); fprintf(f, "%u", el->targetStart); fputc(sep,f); fprintf(f, "%u", el->targetEnd); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->targetName); if (sep == ',') fputc('"',f); fputc(lastSep,f); } /* -------------------------------- End autoSql Generated Code -------------------------------- */ +static char *interactAutoSqlString = +"table interact" +"\"BED5+11 interaction between two regions\"" +" (" +" string chrom; \"Reference sequence chromosome or scaffold\"" +" uint chromStart; \"Start position of lower region\"" +" uint chromEnd; \"End position of upper region. For interchromsomal, set to chromStart+1.\"" +" string name; \"Name or ID of item. Usually name1/name2 or name1/name2/exp or empty\"" +" uint score; \"Score from 0-1000, typically derived from value\"" +" double value; \"Strength of interaction or other data value\"" +" string exp; \"Experiment name for filtering, or empty\"" +" uint color; \"Item color, as itemRgb in bed9. Typically based on value or exp\"" + +" string sourceChrom; \"Chromosome of source region (directional) or lower region\"" +" uint sourceStart; \"Start position of source/lower region\"" +" uint sourceEnd; \"End position of source/lower region\"" +" string sourceName; \"Identifier of source/lower region. Can be used as link to related table.\"" + +" string targetChrom; \"Chromosome of target region (directional) or lower region\"" +" uint targetStart; \"Start position of target/lower region\"" +" uint targetEnd; \"End position of target/lower region\"" +" string targetName; \"Identifier of target/lower region. Can be used as link to related table.\"" +" )" +; + +struct asObject *interactAsObj() +/* Return asObject describing fields of interact object */ +{ +return asParseText(interactAutoSqlString); +} + char *interactOtherChrom(struct interact *inter) /* Get other chromosome from an interaaction. Return NULL if same chromosome */ { if (sameString(inter->sourceChrom, inter->targetChrom)) return NULL; if (inter->chromStart == inter->sourceStart) return cloneString(inter->targetChrom); return cloneString(inter->sourceChrom); }