3e24d8718899596a3b1e5d73f97a43569f1c8965 galt Thu Jul 26 14:42:16 2012 -0700 getDNA2 is close to a plain text dump and needs special handling diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c index 8b8a70b..17581b4 100644 --- src/hg/hgc/hgc.c +++ src/hg/hgc/hgc.c @@ -295,30 +295,31 @@ char *genMapDbScript = "http://genomics.med.upenn.edu/perl/genmapdb/byclonesearch.pl?clone="; char *uniprotFormat = "http://www.uniprot.org/uniprot/%s"; /* variables for gv tables */ char *gvPrevCat = NULL; char *gvPrevType = NULL; /* initialized by getCtList() if necessary: */ struct customTrack *theCtList = NULL; /* getDNA stuff actually works when the database doesn't exist! */ boolean dbIsFound = FALSE; /* was cartHtmlStart done? */ static boolean didCartHtmlStart = FALSE; +static boolean plainTextDump = FALSE; /* forwards */ char *getPredMRnaProtSeq(struct genePred *gp); void doAltGraphXDetails(struct trackDb *tdb, char *item); void hgcStart(char *title) /* Print out header of web page with title. Set * error handler to normal html error handler. */ { cartHtmlStart(title); didCartHtmlStart = TRUE; } char* getEntrezNucleotideUrl(char *accession) /* get URL for Entrez browser on a nucleotide. free resulting string */ @@ -4602,30 +4603,35 @@ /* Do second DNA dialog (or just fetch DNA) */ { char *tbl = cgiUsualString("table", ""); char *action = cgiUsualString("submit", ""); int itemCount; char *pos = NULL; char *chrom = NULL; int start = 0; int end = 0; if (sameString(action, EXTENDED_DNA_BUTTON)) { doGetDnaExtended1(); return; } +// This output probably should be just text/plain but +// trying to support the fancy warn handler box requires html. +// But we want to keep it very simple and close to a plain text dump. +plainTextDump = TRUE; +puts("
\n"); pushWarnHandler(htmlVaWarn); hgBotDelay(); puts(""); if (tbl[0] == 0) { itemCount = 1; if ( NULL != (pos = stripCommas(cartOptionalString(cart, "getDnaPos"))) && hgParseChromRange((dbIsFound ? database : NULL), pos, &chrom, &start, &end)) { hgSeqRange(database, chrom, start, end, '?', "dna"); } else { hgSeqRange(database, seqName, cartInt(cart, "l"), cartInt(cart, "r"), '?', "dna"); @@ -4661,31 +4667,34 @@ char *where = NULL; char *item = cgiUsualString("i", ""); char buf[256]; if ((hti->nameField[0] != 0) && (item[0] != 0)) { char *quotedItem = makeQuotedString(item, '\''); safef(buf, sizeof(buf), "%s = %s", hti->nameField, quotedItem); where = buf; freeMem(quotedItem); } itemCount = hgSeqItemsInRange(database, tbl, seqName, start, end, where); } } if (itemCount == 0) printf("\n# No results returned from query.\n\n"); + puts(""); +puts("\n"); +popWarnHandler(); } struct hTableInfo *ctToHti(struct customTrack *ct) /* Create an hTableInfo from a customTrack. */ { struct hTableInfo *hti; AllocVar(hti); hti->rootName = cloneString(ct->tdb->table); hti->isPos = TRUE; hti->isSplit = FALSE; hti->hasBin = FALSE; hti->type = cloneString(ct->tdb->type); int fieldCount = 3; if (sameWord(ct->dbTrackType, "bedDetail")) @@ -25309,31 +25318,31 @@ doGeneReviews(tdb, item); } else if (tdb != NULL) { genericClickHandler(tdb, item, NULL); } else { cartWebStart(cart, database, "%s", track); printf("Sorry, clicking there doesn't do anything yet (%s).", track); } /* End of 1000+ line dispatch on table involving 100+ if/elses. */ if (didCartHtmlStart) cartHtmlEnd(); -else +else if (!plainTextDump) webEnd(); } struct hash *orgDbHash = NULL; void initOrgDbHash() /* Function to initialize a hash of organism names that hash to a database ID. * This is used to show alignments by hashing the organism associated with the * track to the database name where the chromInfo is stored. For example, the * mousBlat track in the human browser would hash to the mm2 database. */ { orgDbHash = hashNew(8); } void cartDoMiddle(struct cart *theCart)