ef4a5ad1ea45eda4fde693f56f2106c553e87d93
chmalee
  Wed May 20 15:24:30 2026 -0700
Add cnv type to myVariants, refs #33808

diff --git src/hg/inc/myVariants.h src/hg/inc/myVariants.h
index a111711495b..fb317635c91 100644
--- src/hg/inc/myVariants.h
+++ src/hg/inc/myVariants.h
@@ -1,24 +1,24 @@
 #ifndef MYVARIANTS_H
 #define MYVARIANTS_H
 
 #include "jksql.h"
 #include "asParse.h"
 #include "common.h"
 #include "cart.h"
 #include "customTrack.h"
-#define MYVARIANTS_NUM_COLS 20 /* number of default columns before any user-added custom columns */
+#define MYVARIANTS_NUM_COLS 22 /* number of default columns before any user-added custom columns */
 
 /* Cart var prefix that points at the on-disk myVariants ctfile for a given assembly.
  * Kept separate from CT_FILE_VAR_PREFIX so myVariants and regular custom tracks
  * coexist without clobbering each other. */
 #define MYVARIANTS_FILE_VAR_PREFIX "mvCtfile_"
 
 /* Track-name and type identifiers for myVariants custom tracks. */
 #define MYVARIANTS_TYPE "myVariants"
 #define MYVARIANTS_TRACK_PREFIX "myVariants_"
 #define MYVARIANTS_SHARED_TRACK_PREFIX "myVariants_shared_"
 
 boolean isMyVariantsType(char *type);
 /* TRUE if type names the myVariants custom-track type. NULL-safe. */
 
 boolean isMyVariantsTrack(char *trackName);
@@ -38,30 +38,32 @@
     char *name;     /* Name of item - up to 16 chars */
     unsigned score; /* 0-1000.  Higher numbers are darker. */
     char strand[2]; /* + or - for strand */
     unsigned thickStart;    /* Start of thick part */
     unsigned thickEnd;      /* End position of thick part */
     unsigned itemRgb;   /* RGB 8 bits each as in bed */
     unsigned blockCount;    /* Number of blocks */
     int *blockSizes;        /* Comma separated list of block sizes */
     int *chromStarts;       /* Start positions relative to chromStart */
     char *description;  /* Longer item description */
     char *db;           /* database name of this annotation */
     char *ref;          /* reference allele */
     char *alt;          /* alternate allele */
     char *project;      /* project name for grouping variants */
     char *mouseover;    /* short mouseover text for hover display */
+    char *itemType;     /* transcript, snv, or cnv */
+    char *cnvType;      /* gnomAD CNV term; empty for snv/transcript */
     unsigned id;        /* Unique ID for item */
     struct slPair *customFields; /* user-defined custom field name/value pairs */
     };
 
 void myVariantsStaticLoad(char **row, struct myVariants *ret);
 /* Load a row from myVariants table into ret. The contents of ret will be replaced at the next call to this function. */
 
 struct myVariants *myVariantsLoadByQuery(struct sqlConnection *conn, char *query);
 /* Load all myVariants from table that satisfy the query given. Dispose of this with myVariantsFreeList(). */
 
 void myVariantsSaveToDb(struct sqlConnection *conn, struct myVariants *el, char *tableName, int updateSize);
 /* Save myVariants as a row to the table specified by tableName.
  * Uses explicit column names so custom fields in el->customFields are included.
  * If el->name is NULL or empty, fills it in post-INSERT as "Variant N" using
  * the row's auto-increment id; sqlLastAutoId wraps MariaDB's mysql_insert_id,
@@ -86,30 +88,43 @@
 void myVariantsFree(struct myVariants **pEl);
 /* Free a single dynamically allocated myVariants such as created with myVariantsLoad(). */
 
 void myVariantsFreeList(struct myVariants **pList);
 /* Free a list of dynamically allocated myVariants's */
 
 void myVariantsOutput(struct myVariants *el, FILE *f, char sep, char lastSep);
 /* Print out myVariants. Separate fields with sep. Follow last field with lastSep. */
 
 #define myVariantsTabOut(el,f) myVariantsOutput(el,f,'\t','\n');
 #define myVariantsCommaOut(el,f) myVariantsOutput(el,f,',',',');
 
 struct asObject *myVariantsAsObj();
 /* Return asObject describing fields of myVariants */
 
+extern char *myVariantsItemTypes[];
+extern int myVariantsNumItemTypes;
+extern char *myVariantsCnvTypes[];
+extern int myVariantsNumCnvTypes;
+
+char *myVariantsCanonicalItemType(char *s);
+/* Return the matching canonical entry from myVariantsItemTypes (case-insensitive),
+ * or NULL if s is empty or not in the allow-list. */
+
+char *myVariantsCanonicalCnvType(char *s);
+/* Return the matching canonical entry from myVariantsCnvTypes (case-insensitive),
+ * or NULL if s is empty or not in the allow-list. */
+
 char *myVariantsGetDatabaseForUser(char *userName);
 /* Hash the userName and map it to 1..31 inclusive for deciding what
  * database the table should be created in */
 
 char *myVariantsGetTableName(char *userName);
 /* Create the table for this users' myVariants */
 
 char *myVariantsGetDbTable(char *userName);
 /* Return the string db.tableName based on the userName for use in sql statements
  * without specifying the database */
 
 char *myVariantsTableExists(char *userName);
 /* See if we already have a table for this user. If so, return the name
  * of the table (in db.tableName format), else NULL */