d7dd4f55e28699bb783563b8bece5bf23f392995 chmalee Wed May 13 11:07:57 2026 -0700 Adds hg.conf myVariantsDataDir for writing ctfiles outside trash/, per-db short/long label rename on hgTrackUi, and a shared removal helper so the hgTrackUi remove button, hgTracks trash icon, and hgCustom checkbox all function the same, refs #33808 diff --git src/hg/inc/myVariants.h src/hg/inc/myVariants.h index 9ccd82e17a3..c7cc409d698 100644 --- src/hg/inc/myVariants.h +++ src/hg/inc/myVariants.h @@ -1,22 +1,23 @@ #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 17 /* number of default columns before any user-added custom columns */ struct myVariants /* An item in a myVariants type track. */ { struct myVariants *next; /* Next in singly linked list. */ unsigned bin; /* Bin for range index */ char *chrom; /* Reference sequence chromosome or scaffold */ unsigned chromStart; /* Start position in chromosome */ unsigned chromEnd; /* End position in chromosome */ 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 */ @@ -118,30 +119,45 @@ * shares. Memoized per-process: callers receive a fresh cloneString that * they own. */ void myVariantsStripHiddenFields(struct slName **pFieldList); /* Remove any field whose name starts with "_hidden_" from the list in place. * Handles bare names ("_hidden_foo") and dotted/qualified names * ("db.table._hidden_foo") by checking the segment after the last '.'. * Used by hgTables for myVariants_shared_* tables so a recipient does not * see columns the owner has hidden. (Custom non-hidden columns are kept, * since they are part of the data the owner intentionally shared.) */ void myVariantsDeleteForDb(char *userName, char *targetDb); /* Delete the user's myVariants items for the given assembly. No-op if the * table doesn't exist. */ +void myVariantsUnlinkCtFile(char *userName, char *targetDb); +/* Delete the on-disk ctfile for this user+assembly if it exists. Uses the + * same path resolution as myVariantsWriteCtFile so it targets either the + * persistent dir (myVariantsDataDir) or the trash fallback. */ + +boolean myVariantsHandleCtRemoval(struct customTrack *ct, struct cart *cart, + char *database); +/* If ct is a myVariants own track: delete the user's rows for the current + * assembly, unlink the persistent ctfile, drop the per-db renamed labels + * and the visibility var. If ct is a myVariants shared track: drop the + * share-acceptance cart var and the visibility var. Returns TRUE when ct + * was a myVariants track and this function fully handled the cart cleanup + * (caller must skip its own per-track cart cleanup so other-assembly + * labels are preserved); FALSE otherwise. */ + char *myVariantsWriteCtFile(char *userName, char *targetDb, struct cart *cart); /* Write a CT file to trash for user's myVariants in targetDb and any shared tracks * found in cart. Return filename or NULL if nothing to write. */ struct slName *myVariantsGetProjects(char *userName); /* Return list of distinct non-empty project values for this user's myVariants table. * Caller must slFreeList the result. Returns NULL if no projects or table doesn't exist. */ struct slName *myVariantsGetCustomFields(char *userName); /* Return list of user-added custom column names for this user's myVariants table. * Skips the first MYVARIANTS_NUM_COLS default columns and filters out _hidden_ prefixed columns. * Caller must slFreeList the result. Returns NULL if no custom fields or table doesn't exist. */ struct slName *myVariantsGetHiddenFields(char *userName); /* Return list of hidden custom column names (with _hidden_ prefix stripped) for this user's