fcda64e213150b3bd0ade930139e2893e1da42a4 braney Tue Aug 4 12:09:19 2015 -0700 first cut at bigPsl support in the browser. #14241 diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 6b58cb4..4fa7c97 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -235,30 +235,31 @@ #include "gbWarn.h" #include "lsSnpPdbChimera.h" #include "mammalPsg.h" #include "net.h" #include "jsHelper.h" #include "virusClick.h" #include "gwasCatalog.h" #include "parClick.h" #include "mdb.h" #include "yaleGencodeAssoc.h" #include "itemDetailsHtml.h" #include "trackVersion.h" #include "numtsClick.h" #include "geneReviewsClick.h" #include "bigBed.h" +#include "bigPsl.h" static char *rootDir = "hgcData"; #define LINESIZE 70 /* size of lines in comp seq feature */ struct cart *cart; /* User's settings. */ char *seqName; /* Name of sequence we're working on. */ int winStart, winEnd; /* Bounds of sequence. */ char *database; /* Name of mySQL database. */ char *organism; /* Colloquial name of organism. */ char *genome; /* common name, e.g. Mouse, Human */ char *scientificName; /* Scientific name of organism. */ struct hash *trackHash; /* A hash of all tracks - trackDb valued */ @@ -2845,30 +2846,71 @@ } void pslDumpHtml(struct psl *pslList) /* print out psl header and data */ { struct psl* psl; printf("
\n"); printf("#match\tmisMatches\trepMatches\tnCount\tqNumInsert\tqBaseInsert\ttNumInsert\tBaseInsert\tstrand\tqName\tqSize\tqStart\tqEnd\ttName\ttSize\ttStart\ttEnd\tblockCount\tblockSizes\tqStarts\ttStarts\n"); for (psl = pslList; psl != NULL; psl = psl->next) { pslTabOut(psl, stdout); } printf("\n"); } +void genericBigPslClick(struct sqlConnection *conn, struct trackDb *tdb, + char *item, int start, int end) +/* Handle click in big psl track. */ +{ +struct psl* pslList; +char *fileName = bbiNameFromSettingOrTable(tdb, conn, tdb->table); +struct bbiFile *bbi = bigBedFileOpen(fileName); +struct lm *lm = lmInit(0); +int ivStart = start, ivEnd = end; +if (start == end) + { + // item is an insertion; expand the search range from 0 bases to 2 so we catch it: + ivStart = max(0, start-1); + ivEnd++; + } + +struct bigBedInterval *bbList = bigBedIntervalQuery(bbi, seqName, ivStart, ivEnd, 0, lm); +pslList = pslFromBigPsl(seqName, bbList, hChromSize(database, seqName), NULL); + +/* check if there is an alignment available for this sequence. This checks + * both genbank sequences and other sequences in the seq table. If so, + * set it up so they can click through to the alignment. */ +if ( 1) //hGenBankHaveSeq(database, item, NULL)) + { + printf("