5fc426954da9ceb7dc42b9760858bbd1189760e1 braney Fri Sep 4 13:08:14 2026 -0700 quickLift: lift MAF blocks, and let bigMaf and wigMaf tracks into the hub Most of this was already written. mafSubset does the part that looked hard, which is recomputing every row's start and size when columns are taken away, so what was left was deciding where to cut. quickLiftMafs cuts a block at every chain block boundary. Inside one chain block the two assemblies run in step, so the columns carry over untouched and only the first row's coordinates change. Across a boundary the reference either loses bases or gains them, and either way the block can no longer be one contiguous run on the reference, which is the one thing a MAF block has to be. The reference row is named with the assembly name minus any hub prefix, since that is the name the maf drawing code builds when it goes looking for it. A minus strand chain turns the block over, so every row is turned over with it and the forward start comes from the far end of the run. That path is written but has not been exercised: no minus strand quickLift chain wins in a window I could find. validateOneTdb accepts bigMaf and wigMaf. Plain maf is left out on purpose: those tracks are drawn by mafTrack.c, which has no quickLift path, so offering them would hand back a track read from the wrong assembly. refs #38249 diff --git src/hg/inc/quickLift.h src/hg/inc/quickLift.h index 06c0ef4abd6..073fa33a682 100644 --- src/hg/inc/quickLift.h +++ src/hg/inc/quickLift.h @@ -1,30 +1,31 @@ /* quickLift genome annotations on the fly between assemblies using chain files */ /* Copyright (C) 2023 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #ifndef QUICKLIFT_H #define QUICKLIFT_H #define quickLiftCartName "hubQuickLift" #define quickLiftChainTableConfVariable "quickLiftChainName" #define defaultQuickLiftChainTableName "quickLiftChain" struct psl; struct chain; +struct mafAli; struct quickLiftRegions // store highlight information { struct quickLiftRegions *next; unsigned type; char *chrom; long chromStart; long chromEnd; char *bases; unsigned baseCount; char *oChrom; long oChromStart; long oChromEnd; char *otherBases; @@ -90,30 +91,37 @@ // chains that do the mapping are added to chainHash, which is the form the lift functions // read. Use this when the items cannot be had from a query quickLiftSql knows how to make. struct hash *quickLiftChainHash(char *quickLiftFile, char *chrom, int start, int end); // Load the quickLift chains covering chrom:start-end on the reference and return them in a // hash keyed on the other assembly's sequence names, which is the shape the lift functions // want. Use this when the items were fetched some other way, so quickLiftSql was not the // thing that collected the chains. struct psl *quickLiftPsl(struct hash *chainHash, struct hash **pMapPsls, struct psl *psl); // Map the target side of an alignment from the other assembly onto our current reference. // The query side (the mRNA, EST or protein the alignment is to) is left alone. Returns // NULL if the alignment doesn't map. pMapPsls points at a hash of mapping alignments the // caller keeps across a run of items; point it at a NULL hash to start. +struct mafAli *quickLiftMafs(struct hash *chainHash, struct mafAli *mafList, + char *sourceDb, char *refSrc, int refSrcSize); +// Map MAF blocks from the other assembly onto our current reference. A block is cut at +// every chain block boundary, since a MAF block has to be one contiguous run on its first +// row and the lift does not keep the reference contiguous. refSrc is the name the browser +// expects on the reference row, ".", with no hub prefix. + boolean quickLiftIsOwnChainTrack(struct trackDb *tdb); // TRUE when this is the chain track quickLift builds to show the lift itself. That stanza // carries quickLiftUrl and quickLiftDb like any lifted track, but its data is already in // reference coordinates and must not be lifted a second time. struct chain *quickLiftChain(struct hash *chainHash, struct hash **pMapPsls, struct chain *chain); // Map a chain's target side from the other assembly onto our current reference. A chain is // an alignment between that assembly and some other species, so this composes the two and // leaves a chain between the reference and that species. The query side is left alone. // Returns NULL if the chain doesn't map. The chain handed in is not modified. struct psl *quickLiftPsls(struct hash *chainHash, struct psl *pslList); // Map a list of alignments in the other assembly's coordinates onto our current reference. // Alignments that don't map are dropped.