void fullCaption(struct sqlConnection *conn, int id)
/* Print information about image. */
{
char *publication, *copyright;
char *caption = NULL;
int imageFile = -1;
struct slInt *imageList;
int imageCount=0;
int oldId = 0;
struct captionElement *captionElements;
int forwardedId = vgForwardedImage(conn, id);

if (forwardedId)
    {
    oldId = id;
    id = forwardedId;
    }

caption = visiGeneCaption(conn, id);
imageFile = visiGeneImageFile(conn, id);

showSource(conn, oldId);
showSource(conn, id);

publication = visiGenePublication(conn,id);
if (publication != NULL)
    {
    char *pubUrl = visiGenePubUrl(conn,id);
    printf("<B>Reference:</B> ");
    if (pubUrl != NULL && pubUrl[0] != 0)
        printf("<A HREF=\"%s\" target=_blank>%s</A>", pubUrl, publication);
    else
	{
        printf("%s", naForEmpty(publication));
	}
    printf("<BR>\n");
    }
printf("<B>Year:</B> %d ", visiGeneYear(conn,id));
printf("<B>Contributors:</B> %s<BR>\n", 
	naForNull(visiGeneContributors(conn,id)));
if (caption != NULL)
    {
    printf("<B>Notes:</B> %s<BR>\n", caption);
    freez(&caption);
    }
imageList = visiGeneImagesForFile(conn, imageFile);
imageCount = slCount(imageList);
captionElements = makePaneCaptionElements(conn, imageList);
printCaptionElements(conn, captionElements, imageList);

copyright = visiGeneCopyright(conn, id);
if (copyright != NULL)
    printf("<B>Copyright:</B> %s<BR>\n", copyright);
showAcknowledgement(conn, oldId);
showAcknowledgement(conn, id);

printf("<BR>\n");
}
Пример #2
0
void cdwFakeManifestFromSubmit(char *submitIdString, char *outDir)
/* cdwFakeManifestFromSubmit - Create a fake submission based on a real one that is in the warehouse. */
{
struct sqlConnection *conn = cdwConnect();
char query[512];
sqlSafef(query, sizeof(query), "select * from cdwSubmit where id=%s", submitIdString);
struct cdwSubmit *submit = cdwSubmitLoadByQuery(conn, query);
if (submit == NULL)
    errAbort("Can't find submission %s", submitIdString);

uglyf("%d files in query\n", submit->newFiles);
sqlSafef(query, sizeof(query), "select * from cdwFile where submitId=%s", submitIdString);
struct cdwFile *ef, *efList = cdwFileLoadByQuery(conn, query);

FILE *maniF = NULL, *valiF = NULL;
for (ef = efList; ef != NULL; ef = ef->next)
    {
    struct cdwValidFile *vf = cdwValidFileFromFileId(conn, ef->id);
    if (vf != NULL)
        {
	/* First time through create out directory and open output files. */
	if (maniF == NULL)
	    {
	    char *fakeVersion = "##validateManifest version 1.7";
	    makeDirsOnPath(outDir);
	    setCurrentDir(outDir);
	    maniF = mustOpen("manifest.txt", "w");
	    printSharedHeader(maniF);
	    fprintf(maniF, "\n");
	    fprintf(maniF, "%s\n", fakeVersion);
	    valiF = mustOpen("validated.txt", "w");
	    printSharedHeader(valiF);
	    fprintf(valiF, "\tmd5_sum\tsize\tmodified\tvalid_key\n");
	    fprintf(valiF, "%s\n", fakeVersion);
	    }

	/* Figure out file names */
	char cdwPath[PATH_LEN], rootName[FILENAME_LEN], ext[FILEEXT_LEN];
	safef(cdwPath, sizeof(cdwPath), "%s%s", cdwRootDir, ef->cdwFileName);
	splitPath(ef->cdwFileName, NULL, rootName, ext);
	char localPath[PATH_LEN];
	safef(localPath, sizeof(localPath), "%s%s", rootName, ext);

	/* Create sym-linked file and write to manifest */
	symlink(cdwPath, localPath);
	fprint2(maniF, valiF, "%s", localPath);

	/* Write other columns shared between manifest and validated */
	fprint2(maniF, valiF, "\t%s", vf->format);
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->outputType));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->experiment));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->enrichedIn));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->ucscDb));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->replicate));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->part));
	fprint2(maniF, valiF, "\t%s", naForEmpty(vf->pairedEnd));
	fprintf(maniF, "\n");

	/* Print out remaining fields in validated.txt */
	fprintf(valiF, "\t%s\t%lld\t%lld\n", ef->md5, ef->size, ef->updateTime);
	}
    }
carefulClose(&maniF);
carefulClose(&valiF);
}
static struct slName *getProbeList(struct sqlConnection *conn, int id)
/* Get list of probes with hyperlinks to probe info page. */
{
struct slName *returnList = NULL;
char query[256];
char *sidUrl = cartSidUrlString(cart);
struct dyString *dy = dyStringNew(0);
struct slInt *probeList = NULL, *probe;
int submissionSource = 0;

/* Make up a list of all probes in this image. */
safef(query, sizeof(query),
   "select probe from imageProbe where image=%d", id);
probeList = sqlQuickNumList(conn, query);

safef(query, sizeof(query),
   "select submissionSet.submissionSource from image, submissionSet"
   " where image.submissionSet = submissionSet.id and image.id=%d", id);
submissionSource = sqlQuickNum(conn, query);

for (probe = probeList; probe != NULL; probe = probe->next)
    {
    char *type;

    /* Create hyperlink to probe page around gene name. */
    dyStringClear(dy);
    dyStringPrintf(dy, "<A HREF=\"%s?%s&%s=%d&%s=%d\" target=_parent>",
    	hgVisiGeneCgiName(), sidUrl, hgpDoProbe, probe->val, hgpSs, submissionSource);
    safef(query, sizeof(query), 
    	"select probeType.name from probeType,probe where probe.id = %d "
	"and probe.probeType = probeType.id", 
	probe->val);
    type = sqlQuickString(conn, query);
    dyStringPrintf(dy, "%s", naForEmpty(type));
    if (sameWord(type, "antibody"))
        {
	char *abName;
	safef(query, sizeof(query), 
	   "select antibody.name from probe,antibody "
	   "where probe.id = %d and probe.antibody = antibody.id"
	   , probe->val);
	abName = sqlQuickString(conn, query);
	if (abName != NULL)
	    {
	    dyStringPrintf(dy, " %s", abName);
	    freeMem(abName);
	    }
	}
    else if (sameWord(type, "RNA"))
        {
	safef(query, sizeof(query),
	    "select length(seq) from probe where id=%d", probe->val);
	if (sqlQuickNum(conn, query) > 0)
	    dyStringPrintf(dy, " sequenced");
	else
	    {
	    safef(query, sizeof(query),
		"select length(fPrimer) from probe where id=%d", probe->val);
	    if (sqlQuickNum(conn, query) > 0)
	        dyStringPrintf(dy, " from primers");
	    }
	}
    else if (sameWord(type, "BAC"))
        {
	char *name;
	safef(query, sizeof(query), 
	   "select bac.name from probe,bac "
	   "where probe.id = %d and probe.bac = bac.id"
	   , probe->val);
	name = sqlQuickString(conn, query);
	if (name != NULL)
	    {
	    dyStringPrintf(dy, " %s", name);
	    freeMem(name);
	    }
	}
    dyStringPrintf(dy, "</A>");
    freez(&type);

    /* Add to return list. */
    slNameAddTail(&returnList, dy->string);
    }

slFreeList(&probeList);
slReverse(&returnList);
return returnList;
}