6d0767201f8e33546c1174395806ff2948477c84 giardine Fri Mar 16 10:56:37 2012 -0700 Edits to pgSnp detail page format, the coding sequence displays inresponse to redmine #7054. Includes computing frameshifts on size of deletion rather than count of '-', treating multiple substitutions that affect length of sequence as indels, hr between genes, and skipping reference matches. diff --git src/hg/lib/pgSnp.c src/hg/lib/pgSnp.c index a58bc24..e5b07b5 100644 --- src/hg/lib/pgSnp.c +++ src/hg/lib/pgSnp.c @@ -436,66 +436,82 @@ char b[512]; safef(b, sizeof(b), "%s", old); char *bold = replaceString(cod->seq, (cod->regStart - cod->cdStart), (cod->regEnd - cod->cdStart), b); char *nameCopy = cloneString(item->name); char *allele[8]; (void) chopByChar(nameCopy, '/', allele, item->alleleCount); int i; printf("%s:starting positions codon %d cds %d
\n", el->name, cod->firstCodon, (cod->cdStart+1)); for (i=0;ialleleCount;i++) { char a[512]; if (sameString(el->strand, "-")) reverseComplement(allele[i], strlen(allele[i])); safef(a, sizeof(a), "%s", allele[i]); char *rep = replaceString(cod->seq, (cod->regStart - cod->cdStart), (cod->regEnd - cod->cdStart), a); + if (sameString(bold, rep)) + continue; printf("%s > %s
\n", bold, rep); if (item->chromStart == item->chromEnd && !strstr(rep, "-") && (strlen(rep)-7) % 3 != 0) { printf("    frameshift
\n"); } else if (item->chromStart == item->chromEnd && countChars(allele[i], '-') == strlen(allele[i])) { printf("    wildtype
\n"); } else { struct dnaSeq *dnaseq = newDnaSeq(cod->seq, strlen(cod->seq), "orig"); aaSeq *origAa = translateSeq(dnaseq, 0, FALSE); if (!strstr(origAa->dna, "X")) { char *rep2 = replaceString(cod->seq, (cod->regStart - cod->cdStart), (cod->regEnd - cod->cdStart), allele[i]); dnaseq = newDnaSeq(rep2, strlen(rep2), "rep2"); aaSeq *repAa = translateSeq(dnaseq, 0, FALSE); //freeDnaSeq(&dnaseq); - if (!strstr(repAa->dna, "X") && isNotEmpty(repAa->dna)) + if (!strstr(rep2, "-") && strlen(allele[i]) != (item->chromEnd - item->chromStart)) + { //indel + int diff = abs((item->chromEnd - item->chromStart) - strlen(allele[i])); + if (diff % 3 == 0) + printf("    in-frame indel
\n"); + else + printf("    frameshift indel
\n"); + } + else if (!strstr(rep2, "-") && isNotEmpty(repAa->dna)) { printf("    %s > %s
\n", origAa->dna, repAa->dna); if (differentString(origAa->dna, repAa->dna)) aaProperties(origAa->dna, repAa->dna); } - else if ((countChars(rep2, '-')) % 3 != 0) + else if (strstr(rep2, "-") && (item->chromEnd - item->chromStart) % 3 != 0) { printf("    frameshift
\n"); } + else if (strstr(rep2, "-") && (item->chromEnd - item->chromStart) % 3 == 0) + { + printf("    in-frame deletion
\n"); + } } } } + /* print a hr between gene models */ + printf("
\n"); } bedFreeList(&list); } char *aaPolarity (char *aa) /* return the polarity of the amino acid */ { if (sameString(aa, "A") || sameString(aa, "G") || sameString(aa, "I") || sameString(aa, "L") || sameString(aa, "M") || sameString(aa, "F") || sameString(aa, "P") || sameString(aa, "W") ||