04c67a0e7bcb65c217598e5e44084bf4c5c0674d angie Tue Mar 5 12:16:10 2013 -0800 Feature #6152 (Variant Annotation Integrator): first cut of annoFormatVep whichproduces output in the format of Ensembl's Variant Effect Predictor (VEP), along with modifications to soTerm, gpFx and annoGratorGpVar to enable VEP-like output. diff --git src/hg/lib/variant.c src/hg/lib/variant.c index a9e8425..8cc7a52 100644 --- src/hg/lib/variant.c +++ src/hg/lib/variant.c @@ -31,31 +31,31 @@ delRear = end - ex; end = ex; } struct variant *newVariant; AllocVar(newVariant); newVariant->chrom = cloneString(oldVariant->chrom); newVariant->chromStart = start; newVariant->chromEnd = end; newVariant->numAlleles = 1; struct allele *newAllele; AllocVar(newAllele); newVariant->alleles = newAllele; newAllele->variant = newVariant; newAllele->length = allele->length - delRear - delFront; -assert(newAllele->length > 0); +assert(newAllele->length >= 0); newAllele->sequence = cloneString(&allele->sequence[delFront]); newAllele->sequence[newAllele->length] = 0; // cut off delRear part return newAllele; } static char *addDashes(char *input, int count) /* add dashes at the end of a sequence to pad it out so it's length is count */ { char *ret = needMem(count + 1); int inLen = strlen(input); safecpy(ret, count + 1, input); count -= inLen; @@ -91,31 +91,36 @@ errAbort("number of alleles in pgSnp doesn't match number in name"); char *thisAlleleString = nextAlleleString; // advance pointer to next variant string // probably there's some kent routine to do this behind the curtain nextAlleleString = strchr(thisAlleleString, '/'); if (nextAlleleString) // null out '/' and move to next char { *nextAlleleString = 0; nextAlleleString++; } // this check probably not right, could be different per allele int alleleStringLength = strlen(thisAlleleString); - if (alleleStringLength != alleleLength) + if (sameString(thisAlleleString, "-") && alleleLength == 0) + { + alleleStringLength = 0; + thisAlleleString[0] = '\0'; + } + else if (alleleStringLength != alleleLength) { if ( alleleStringLength < alleleLength) { thisAlleleString = addDashes(thisAlleleString, alleleLength); alleleStringLength = alleleLength; } } // we have a new allele! struct allele *allele; AllocVar(allele); slAddHead(&variant->alleles, allele); allele->variant = variant; allele->length = alleleStringLength; toLowerN(thisAlleleString, alleleStringLength);