3001eec709205e44c2ed2f1c6f42df510b8a5c37 chmalee Thu Oct 29 14:47:14 2020 -0700 Fix off by one in gnomAD VCF to bed conversion, which resulted in a url link out error, so adding new substitution to trackDb url, refs #25010 diff --git src/hg/utils/vcfToBed/vcfToBed.c src/hg/utils/vcfToBed/vcfToBed.c index dfae97e..d1eeab3 100644 --- src/hg/utils/vcfToBed/vcfToBed.c +++ src/hg/utils/vcfToBed/vcfToBed.c @@ -156,32 +156,32 @@ /* Turn a VCF line into a bed9+ line */ { struct dyString *name = dyStringNew(0); struct dyString *shortenedRef = dyStringNew(0); struct dyString *shortenedAlt = dyStringNew(0); char *line = NULL; char *chopped[9]; // 9 fields in case VCF has genotype fields, keep them separate from info fields int infoCount = slCount(vcff->infoDefs); char *infoTags[infoCount]; while (lineFileNext(vcff->lf, &line, NULL)) { int fieldCount = chopTabs(line, chopped); if (fieldCount < 8) errAbort("ERROR: malformed VCF, missing fields at line: '%d'", vcff->lf->lineIx); char *chrom = fixupChromName(chopped[0]); - int start = atoi(chopped[1]); - int end = start + 1; + int start = atoi(chopped[1]) - 1; + int end = start; char *ref = cloneString(chopped[3]); char *alt = cloneString(chopped[4]); if (strlen(ref) == dnaFilteredSize(ref)) end = start + strlen(ref); fixupLeftPadding(&start, ref, alt); if (!sameString(chopped[2], ".")) dyStringPrintf(name, "%s", chopped[2]); else { shortenRefAltString(shortenedRef, shortenedAlt, ref, alt); dyStringPrintf(name, "%s_%d:%s/%s", chrom,start,shortenedRef->string,shortenedAlt->string); } fprintf(outBed, "%s\t%d\t%d\t%s\t0\t.\t%d\t%d\t0,0,0", chrom,start,end,name->string,start,end); fprintf(outBed, "\t%s\t%s\t%s", ref, alt, chopped[6]); if (extraFieldCount)