9b043c5143cff7efe24ec0f9baf61c71104acc5a angie Thu Aug 20 10:06:41 2020 -0700 Allow SARS-CoV-2 VCF to use GenBank or RefSeq ID instead of our chromified RefSeq ID. (Russ request, no RM) diff --git src/lib/vcf.c src/lib/vcf.c index 511315e..2e1c746 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -915,32 +915,36 @@ char trimmed[alLen+1]; safencpy(trimmed, sizeof(trimmed), alleles[i], alLen - trimmedBases); if (isEmpty(trimmed)) safencpy(trimmed, sizeof(trimmed), "-", 1); alleles[i] = vcfFilePooledStr(vcff, trimmed); } rec->chromEnd -= trimmedBases; } return chromEndOrig; } static boolean chromsMatch(char *chromA, char *chromB) // Return TRUE if chromA and chromB are non-NULL and identical, possibly ignoring // "chr" at the beginning of one but not the other. { +// Allow SARS-CoV-2 VCF to use GenBank or RefSeq ID instead of our chromified RefSeq ID: +static char *sarsCoV2Ids[] = {"NC_045512v2", "MN908947.3", "NC_045512.2"}; if (chromA == NULL || chromB == NULL) return FALSE; +else if (stringIx(chromA, sarsCoV2Ids) >= 0 && stringIx(chromB, sarsCoV2Ids) >= 0) + return TRUE; char *chromAPlus = startsWith("chr", chromA) ? chromA+3 : chromA; char *chromBPlus = startsWith("chr", chromB) ? chromB+3 : chromB; return sameString(chromAPlus, chromBPlus); } static struct vcfRecord *vcfParseData(struct vcfFile *vcff, char *chrom, int start, int end, int maxRecords) // Given a vcfFile into which the header has been parsed, and whose // lineFile is positioned at the beginning of a data row, parse and // return all data rows (in region, if chrom is non-NULL) from lineFile, // up to maxRecords. { if (vcff == NULL) return NULL; int recCount = 0;