c90837e6e7b85301490c0f89bfc0ba83255dc0df max Mon Mar 26 15:25:40 2012 -0700 adding elsevier outlinks for sciverse app to hgc publications page diff --git src/hg/hgc/pubs.c src/hg/hgc/pubs.c index aea3be7..5dca585 100644 --- src/hg/hgc/pubs.c +++ src/hg/hgc/pubs.c @@ -22,30 +22,43 @@ "intro", "methods", "results", "discussion", "conclusions", "ack", "refs", "unknown" }; // // whether a checkbox is checked by default, have to correspond to pubsSecNames static int pubsSecChecked[] ={ 1, 1, 1, 1, 1, 1, 1, 0, 0, 1 }; static char* pubsSequenceTable; +static char* mangleUrl(char* url) +/* add publisher specific parameters to url and return new url*/ +{ +if (!stringIn("sciencedirect.com", url)) + return url; + +// cgi param to add the "UCSC matches" sciverse application to elsevier's sciencedirect +char* sdAddParam = "?svAppaddApp=298535"; +char* longUrl = catTwoStrings(url, sdAddParam); +char* newUrl = replaceChars(longUrl, "article", "svapps"); +return newUrl; +} + static void printFilterLink(char* pslTrack, char* articleId) /* print a link to hgTracks with an additional cgi param to activate the single article filter */ { int start = cgiInt("o"); int end = cgiInt("t"); printf("  ", hgTracksPathAndSettings(), database, seqName, start+1, end, articleId, pslTrack); char startBuf[64], endBuf[64]; sprintLongWithCommas(startBuf, start + 1); sprintLongWithCommas(endBuf, end); printf("Show these sequence matches individually on genome browser"); } static char* makeSqlMarkerList(void) /* return list of sections from cgi vars, format like "'abstract','header'" */ @@ -168,34 +181,32 @@ printLimitWarning(conn, markerTable, item, itemLimit, sectionList); printf("

Snippets from Publications:

"); struct sqlResult* sr = queryMarkerRows(conn, markerTable, articleTable, item, itemLimit, sectionList); char **row; while ((row = sqlNextRow(sr)) != NULL) { char* articleId = row[0]; char* url = row[1]; char* title = row[2]; char* authors = row[3]; char* citation = row[4]; char* pmid = row[5]; char* snippets = row[6]; - char* addParam = ""; - if (strstrNoCase(url, "sciencedirect.com")) - addParam = "?svAppaddApp=298535"; // add the "UCSC matches" sciverse application to article view - printf("%s ", url, addParam, title); + url = mangleUrl(url); + printf("%s ", url, title); printf("%s; ", authors); printf("%s ", citation); if (!isEmpty(pmid) && strcmp(pmid, "0")!=0 ) printf(", PMID%s\n", pmid, pmid); printf("
\n"); if (pubsDebug) printf("articleId=%s", articleId); printf("%s

", snippets); printf("


"); } freeMem(sectionList); sqlFreeResult(&sr); } @@ -212,30 +223,32 @@ if ((row = sqlNextRow(sr)) == NULL) { printf("Could not resolve articleId %s, this is an internal error.\n", item); printf("Please send an email to max@soe.ucsc.edu\n"); sqlFreeResult(&sr); return NULL; } articleId = cloneString(row[0]); char* url = row[1]; char* title = row[2]; char* authors = row[3]; char* cit = row[4]; char* abstract = row[5]; char* pmid = row[6]; + + url = mangleUrl(url); if (strlen(abstract)==0) abstract = "(No abstract available for this article. " "Please follow the link to the fulltext above.)"; printf("

%s

\n", authors); printf("%s\n", url, title); printf("

%s", cit); if (strlen(pmid)!=0 && strcmp(pmid, "0")) printf(", PMID%s\n", pmid, pmid); printf("

\n"); printf("

%s

\n", abstract); sqlFreeResult(&sr); return articleId; } @@ -559,46 +572,55 @@ char query[512]; struct sqlResult *sr; char **row; bioSeq *seq = NULL; safef(query, sizeof(query), "select sequence from %s where annotId = '%s'", table, id); sr = sqlGetResult(conn, query); if ((row = sqlNextRow(sr)) != NULL) { AllocVar(seq); seq->name = cloneString(id); seq->dna = cloneString(row[0]); seq->size = strlen(seq->dna); } sqlFreeResult(&sr); + return seq; } void pubsAli(struct sqlConnection *conn, char *pslTable, char *seqTable, char *item) /* this is just a ripoff from htcCdnaAli, similar to markd's transMapAli */ { bioSeq *oSeq = NULL; writeFramesetType(); puts(""); printf("\nLiterature Sequence vs Genomic\n\n\n"); struct psl *psl = getAlignments(conn, pslTable, item); if (psl == NULL) errAbort("Couldn't find alignment at %s:%s", pslTable, item); oSeq = getSeq(conn, seqTable, item); +if (oSeq->size != psl->qSize) +{ + //errAbort("prot alignments not supported yet"); + //oSeq -> size = 3*oSeq -> size; + errAbort("prot alignments not supported yet %s", oSeq->dna); + oSeq = translateSeq(oSeq, 0, FALSE); + errAbort("prot alignments not supported yet %s", oSeq->dna); +} if (oSeq == NULL) errAbort("%s is in pslTable but not in sequence table. Internal error.", item); showSomeAlignment(psl, oSeq, gftDna, 0, oSeq->size, NULL, 0, 0); printf("hihi"); } void doPubsDetails(struct trackDb *tdb, char *item) /* publications custom display */ { int start = cgiInt("o"); int end = cgiOptionalInt("t", 0); char* trackTable = cgiString("g"); char* aliTable = cgiOptionalString("aliTable"); int fasta = cgiOptionalInt("fasta", 0);