820ebcf85a344a03cf2279b6ceee42a25514f4a3
angie
Mon May 23 09:41:50 2011 -0700
Feature #3711 (VCF haplotype clustering): User can select which variantis used as the center (for center-weighted clustering) by clicking on a
link in its details page.
diff --git src/hg/hgc/vcfClick.c src/hg/hgc/vcfClick.c
index 62d5f33..2fa75f4 100644
--- src/hg/hgc/vcfClick.c
+++ src/hg/hgc/vcfClick.c
@@ -190,34 +190,42 @@
static void pgSnpCodingDetail(struct vcfRecord *rec)
/* Translate rec into pgSnp (with proper chrom name) and call Belinda's
* coding effect predictor from pgSnp details. */
{
if (hTableExists(database, "knownGene"))
{
struct pgSnp *pgs = pgSnpFromVcfRecord(rec);
if (!sameString(rec->chrom, seqName))
// rec->chrom might be missing "chr" prefix:
pgs->chrom = seqName;
printSeqCodDisplay(database, pgs);
}
}
-static void vcfRecordDetails(struct vcfRecord *rec)
-/* Display the contents of a single line of VCF. */
+static void vcfRecordDetails(struct trackDb *tdb, struct vcfRecord *rec)
+/* Display the contents of a single line of VCF, assumed to be from seqName
+ * (using seqName instead of rec->chrom because rec->chrom might lack "chr"). */
{
printf("Name: %s
\n", rec->name);
+if (rec->file->genotypeCount > 0)
+ {
+ char cartVar[512];
+ safef(cartVar, sizeof(cartVar), "%s.centerVariantPos", tdb->track);
+ printf("View haplotypes sorted by variants at this position
\n",
+ hgTracksPathAndSettings(), cartVar, seqName, rec->chromStart);
+ }
printPosOnChrom(seqName, rec->chromStart, rec->chromEnd, NULL, FALSE, rec->name);
printf("Reference allele: %s
\n", rec->ref);
vcfAltAlleleDetails(rec);
if (rec->qual != 0.0)
printf("Call quality: %.1f
\n", rec->qual);
vcfFilterDetails(rec);
vcfInfoDetails(rec);
pgSnpCodingDetail(rec);
vcfGenotypesDetails(rec);
}
void doVcfTabixDetails(struct trackDb *tdb, char *item)
/* Show details of an alignment from a VCF file compressed and indexed by tabix. */
{
#if (defined USE_TABIX && defined KNETFILE_HOOKS)
@@ -239,21 +247,21 @@
{
vcff = vcfTabixFileMayOpen(fileOrUrl, seqName, start, end, vcfMaxErr);
}
errCatchEnd(errCatch);
if (errCatch->gotError)
{
if (isNotEmpty(errCatch->message->string))
warn("%s", errCatch->message->string);
}
errCatchFree(&errCatch);
if (vcff != NULL)
{
struct vcfRecord *rec;
for (rec = vcff->records; rec != NULL; rec = rec->next)
if (rec->chromStart == start && rec->chromEnd == end) // in pgSnp mode, don't get name
- vcfRecordDetails(rec);
+ vcfRecordDetails(tdb, rec);
}
}
#endif // no USE_TABIX