\n", HG_COL_LOCAL_TABLE);
if (showDesc)
printf("%s\n", fileDesc);
//printf(" | %s | \n", snippet);
printf("");
printAddWbr(snippet, 40);
printf(" | \n");
if (pubsDebug)
{
printf("article %s, file %s, seq %s, annotId %s", artId, fileId, seqId, annotId);
}
// print links to locations
if (!isClickedSection && !pubsDebug) {
- struct slName *locs;
// format: hg19/chr1:300-400,mm9/chr1:60006-23234
// split on "," then split on "/"
- locs = charSepToSlNames(locList, ',');
+ //locs = charSepToSlNames(locString, ',');
+
+ char* locArr[1024];
+ int partCount = chopString(locString, ",", locArr, ArraySize(locArr));
printf(" | ");
- if (locs==NULL)
+ if (partCount==0)
printf("No matches");
- for ( ; locs!=NULL; locs = locs->next)
- {
- char* locString = locs->name;
- char* parts[2];
- int partCount;
- partCount = chopString(locString, "/", parts, ArraySize(parts));
- assert(partCount==2);
- char* db = parts[0];
- char* pos = parts[1];
- printf("%s (%s)", cartSidUrlString(cart), db, pos, pos, db);
+
+ else
+ {
+ struct slName *locs;
+ locs = slNameListFromStringArray(locArr, partCount);
+ slUniqify(&locs, slNameCmp, slNameFree);
+ printGbLinks(locs);
printf(" ");
- }
printf(" | \n");
+ slFreeList(&locs);
+ }
+
}
printf("
\n");
}
}
printf("\n");
+
+ if (isClickedSection)
+ {
+ printf(" ");
+ printFilterLink(pslTable, articleId);
+ }
webEndSectionTables();
sqlFreeResult(&sr);
return foundSkippedRows;
}
static void printSeqInfo(struct sqlConnection* conn, char* trackTable,
- char* articleId, char* item, char* seqName, int start, bool fileDesc, bool fasta)
+ char* pslTable, char* articleId, char* item, char* seqName, int start,
+ bool fileDesc, bool fasta)
/* print sequences, split into two sections
* two sections: one for sequences that were clicked, one for all others*/
{
struct hash* clickedSeqs = getSeqIdHash(conn, trackTable, articleId, item, seqName, start);
bool skippedRows;
if (clickedSeqs)
skippedRows = printSeqSection(articleId, "Sequences used to construct this feature", \
- fileDesc, conn, clickedSeqs, 1, fasta);
+ fileDesc, conn, clickedSeqs, 1, fasta, pslTable);
else
skippedRows=1;
if (skippedRows)
printSeqSection(articleId, "Other Sequences in this article", \
- fileDesc, conn, clickedSeqs, 0, fasta);
+ fileDesc, conn, clickedSeqs, 0, fasta, pslTable);
printf(" Copyright 2012 Elsevier B.V. All rights reserved. ");
freeHash(&clickedSeqs);
}
static void printTrackVersion(struct trackDb *tdb, struct sqlConnection* conn, char* item)
{
char versionString[256];
char dateReference[256];
char headerTitle[512];
/* see if hgFixed.trackVersion exists */
boolean trackVersionExists = hTableExists("hgFixed", "trackVersion");
if (trackVersionExists)
{
@@ -481,55 +541,116 @@
static void printPositionAndSize(int start, int end, bool showSize)
{
printf("Position: "
"",
hgTracksPathAndSettings(), database, seqName, start+1, end);
char startBuf[64], endBuf[64];
sprintLongWithCommas(startBuf, start + 1);
sprintLongWithCommas(endBuf, end);
printf("%s:%s-%s \n", seqName, startBuf, endBuf);
long size = end - start;
sprintLongWithCommas(startBuf, size);
if (showSize)
printf("Genomic Size: %s \n", startBuf);
}
+static bioSeq *getSeq(struct sqlConnection *conn, char *table, char *id)
+/* copied from otherOrgs.c */
+{
+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 == 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 = cgiInt("t");
+int end = cgiOptionalInt("t", 0);
char* trackTable = cgiString("g");
+char* aliTable = cgiOptionalString("aliTable");
int fasta = cgiOptionalInt("fasta", 0);
-
pubsDebug = cgiOptionalInt("debug", 0);
struct sqlConnection *conn = hAllocConn(database);
-printTrackVersion(tdb, conn, item);
-if (hashFindVal(tdb->settingsHash, "pubsMarkerTable"))
+char* articleTable = trackDbRequiredSetting(tdb, "pubsArticleTable");
+
+if (stringIn("Psl", trackTable))
+{
+ if (aliTable!=NULL)
+ {
+ pubsSequenceTable = trackDbRequiredSetting(tdb, "pubsSequenceTable");
+ pubsAli(conn, trackTable, pubsSequenceTable, item);
+ return;
+ }
+
+ else
+ {
+ genericHeader(tdb, item);
+ struct psl *psl = getAlignments(conn, trackTable, item);
+ printf("Genomic Alignment with sequence found in publication fulltext");
+ printAlignmentsSimple(psl, start, trackTable, trackTable, item);
+ }
+}
+
+else
+{
+ printTrackVersion(tdb, conn, item);
+ if (trackDbSettingClosestToHome(tdb, "pubsMarkerTable") != NULL)
{
char* markerTable = hashMustFindVal(tdb->settingsHash, "pubsMarkerTable");
- char* articleTable = hashMustFindVal(tdb->settingsHash, "pubsArticleTable");
printPositionAndSize(start, end, 0);
printMarkerSnippets(conn, articleTable, markerTable, item);
}
else
{
printPositionAndSize(start, end, 1);
pubsSequenceTable = hashMustFindVal(tdb->settingsHash, "pubsSequenceTable");
- pubsArticleTable = hashMustFindVal(tdb->settingsHash, "pubsArticleTable");
-
- char* articleId = printArticleInfo(conn, item);
+ char* articleId = printArticleInfo(conn, item, articleTable);
if (articleId!=NULL)
{
bool showDesc;
showDesc = (! endsWith(trackTable, "Elsevier"));
// avoid clutter: Elsevier has only main text
- printSeqInfo(conn, trackTable, articleId, item, seqName, start, showDesc, fasta);
+ char *pslTable = trackDbRequiredSetting(tdb, "pubsPslTrack");
+ printSeqInfo(conn, trackTable, pslTable, articleId, item, seqName, start, showDesc, fasta);
+ }
}
}
printTrackHtml(tdb);
hFreeConn(&conn);
}
|