d0ed51d077718213c0b843a89fd6f36ac32f1804 braney Fri Sep 4 11:39:28 2026 -0700 quickLift: lift alignments, and let psl and bigPsl tracks into the hub Every type quickLift handled so far is one set of coordinates on one genome, so the lift is a call to remapBlockedBed. An alignment carries coordinates on both sides at once, with a block start on each, so moving the genome side means splitting and trimming blocks while keeping the other side lined up with them. quickLiftPsl does that with pieces that were already in the tree: pick the chain with liftOverChainForRange, the same one the bed path picks, turn it into a mapping alignment with chainToPsl plus pslSwap, then pslTransMap. The mapping alignment is kept per chain, since rebuilding it for every item costs nothing at gene zoom and a great deal zoomed out. Two things pslTransMap does had to be undone. It recounts match and mismatch off the blocks, which would read every lifted alignment as a perfect match and draw every item at full shade, so quickLiftPslCounts puts the original counts back, scaled by how much of the alignment survived. And it leaves a protein alignment in nucleotide space, which the base alignment view rejects, so quickLiftPslBackToProtein returns the query side to protein units when the lift did not split a codon. quickLiftChainHash hands out the chains for a reference range for callers that collected their items some other way. validateOneTdb now accepts psl and bigPsl, and bigPsl joins bigBed and bigWig in the bigDataUrl fill-in. refs #38249 diff --git src/hg/inc/quickLift.h src/hg/inc/quickLift.h index 334e5d38032..0769d75661f 100644 --- src/hg/inc/quickLift.h +++ src/hg/inc/quickLift.h @@ -1,28 +1,30 @@ /* 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 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; unsigned otherBaseCount; @@ -60,30 +62,46 @@ struct genePred *quickLiftGenePreds(struct sqlConnection *conn, char *quickLiftFile, char *table, char *chromName, int winStart, int winEnd, char *extraWhere, struct hash *chainHash); /* Like quickLiftSql, but load genePreds through a genePredReader so the actual set of * (extended) genePred columns in the table is honored rather than assuming 15 columns. * Fill a hash with the chains that were used to map the desired range. */ unsigned quickLiftGetChainId(struct cart *, char *fromDb, char *toDb); /* Return the id from the quickLiftChain table for given assemblies. */ char *quickLiftGetChainPath(struct cart *, char *fromDb, char *toDb); /* Return the path from the quickLiftChain table for given assemblies. */ struct bed *quickLiftBeds(struct bed *bedList, struct hash *chainHash, boolean blocked); // Map a list of bedd in query coordinates to our current reference +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 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. + struct encodePeak *quickLiftPeaks(struct encodePeak *peakList, struct hash *chainHash); // Map a list of encodePeaks in query coordinates to our current reference. These can't go // through quickLiftBeds: the thickStart and thickEnd it assigns overlay signalValue and // pValue in struct encodePeak. boolean quickLiftEnabled(struct cart *cart); /* Return TRUE if feature is available */ struct quickLiftRegions *quickLiftGetRegions(char *ourDb, char *liftDb, char *quickLiftFile, char *chrom, int seqStart, int seqEnd); /* Figure out the highlight regions and cache them. */ char *quickLiftChainTable(); /* Return the name of the quickLiftChain table. */ void quickLiftResolveTable(struct trackDb *tdb, char *trackTable, char **retTable, char **retLiftDb);