コード例 #1
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testJoining(struct htmlPage *rootPage)
/* Simulate pressing buttons to get a reasonable join on a
 * couple of uniProt tables. */
{
struct htmlPage *allPage, *page;
char *org = NULL, *db = NULL, *group = "allTables", *track="uniProt";
int expectedCount = tableSize("uniProt", "taxon");

allPage = quickSubmit(rootPage, org, db, group, "uniProt", 
	"uniProt.taxon", "taxonJoin1", NULL, NULL);
if (allPage != NULL)
    {
    if (allPage->forms == NULL)
        {
	errAbort("uniProt page with no form");
	}
    else
	{
	int count = testAllFields(allPage, allPage->forms, org, db,
	    group, track, "uniProt.taxon");
	if (count != expectedCount)
	    qaStatusSoftError(tablesTestList->status, 
		    "Got %d rows in uniProt.taxon, expected %d", count, 
		    expectedCount);
	htmlPageSetVar(allPage, NULL, hgtaOutputType, "selectedFields");
	page = quickSubmit(allPage, org, db, group, track, 
	    "uniProt.taxon", "taxonJoin2", hgtaDoTopSubmit, "submit");
	htmlPageSetVar(page, NULL, "hgta_fs.linked.uniProt.commonName", "on");
	serialSubmit(&page, org, db, group, track, NULL, "taxonJoin3",
	    hgtaDoSelectFieldsMore, "submit");
	if (page != NULL)
	    {
	    htmlPageSetVar(page, NULL, "hgta_fs.check.uniProt.taxon.binomial", "on");
	    htmlPageSetVar(page, NULL, "hgta_fs.check.uniProt.commonName.val", "on");
	    serialSubmit(&page, org, db, group, track, NULL, "taxonJoin4",
		hgtaDoPrintSelectedFields, "submit");
	    if (page != NULL)
		{
		checkExpectedSimpleRows(page, expectedCount);
		verifyJoinedFormat(page->htmlText);
		htmlPageFree(&page);
		}
	    }
	}
    }

htmlPageFree(&allPage);
verbose(1, "Tested joining on uniProt.taxon & commonName\n");
}
コード例 #2
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testOneField(struct htmlPage *tablePage, struct htmlForm *mainForm,
     char *org, char *db, char *group, char *track, char *table, 
     int expectedRows)
/* Get one field and make sure the count agrees with expected. */
/* mainForm not used */
{
struct htmlPage *outPage;
struct htmlForm *form;
struct htmlFormVar *var;
int attempts = 0;
int rowCount = 0;

if (tablePage->forms == NULL) 
     errAbort("testOneField: Missing form (tablePage)");

htmlPageSetVar(tablePage, NULL, hgtaOutputType, "selectedFields");

outPage = quickSubmit(tablePage, org, db, group, track, table,
    "selFieldsPage", hgtaDoTopSubmit, "submit");
while (outPage == NULL && attempts < MAX_ATTEMPTS)
    {
    printf("testOneField: trying again to get selFieldsPage\n");
    outPage = quickSubmit(tablePage, org, db, group, track, table,
        "selFieldsPage", hgtaDoTopSubmit, "submit");
    attempts++;
    }

if (outPage == NULL) 
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOneField - couldn't get outPage.");
    return;
    }

if (outPage->forms == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOneField - missing form.");
    htmlPageFree(&outPage);
    return;
}

form = outPage->forms;
rowCount = 0;
var = findPrefixedVar(form->vars, "hgta_fs.check.");
if (var == NULL)
    errAbort("No hgta_fs.check. vars in form");
htmlPageSetVar(outPage, NULL, var->name, "on");
serialSubmit(&outPage, org, db, group, track, table, "oneField",
    hgtaDoPrintSelectedFields, "submit");
// check that outPage != NULL
checkExpectedSimpleRows(outPage, expectedRows);
htmlPageFree(&outPage);
}
コード例 #3
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testIdentifier(struct htmlPage *rootPage)
/* Do simple check on identifiers. Relies on
 * 8355	Xenopus laevis being stable taxon (and not being filtered out
 * by testFilter). */
{
char *org = NULL, *db = NULL, *group = "allTables", *track="uniProt",
	*table = "uniProt.taxon";
struct htmlPage *page;
page = quickSubmit(rootPage, org, db, group, "uniProt", 
	table, "taxonId1", hgtaDoPasteIdentifiers, "submit");
if (page != NULL)
    {
    htmlPageSetVar(page, NULL, hgtaPastedIdentifiers, "8355");
    serialSubmit(&page, org, db, group, track, table, "taxonId2",
    	hgtaDoPastedIdentifiers, "submit");
    if (page != NULL)
        {
	htmlPageSetVar(page, NULL, hgtaOutputType, "selectedFields");
	serialSubmit(&page, org, db, group, track, table, "taxonId3",
	    hgtaDoTopSubmit, "submit");
	if (page != NULL)
	    {
	    htmlPageSetVar(page, NULL, "hgta_fs.check.uniProt.taxon.binomial",
	    	"on");
	    serialSubmit(&page, org, db, group, track, table, "taxonId4",
		hgtaDoPrintSelectedFields, "submit");
	    if (page != NULL)
		{
		if (!stringIn("Xenopus laevis", page->htmlText))
		    {
		    qaStatusSoftError(tablesTestList->status, 
			 "Can't find Xenopus laevis in uniProt.taxon #8355");
		    }
		checkExpectedSimpleRows(page, 1);
		}
	    htmlPageFree(&page);
	    }
	}
    }
verbose(1, "Tested identifier on uniProt.taxon\n");
}
コード例 #4
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testOutCustomTrack(struct htmlPage *tablePage, struct htmlForm *mainForm,
     char *org, char *db, char *group, char *track, char *table)
/* Get as customTrack and make sure nothing explodes. */
/* mainForm not used */
{
struct htmlPage *outPage;
int attempts = 0;
struct htmlFormVar *groupVar;

if (tablePage->forms == NULL) 
    errAbort("testOutCustomTrack: Missing form (tablePage)");

htmlPageSetVar(tablePage, NULL, hgtaOutputType, "customTrack");
outPage = quickSubmit(tablePage, org, db, group, track, table,
    "customTrackUi", hgtaDoTopSubmit, "submit");
while (outPage == NULL && attempts < MAX_ATTEMPTS)
    {
    printf("testOutCustomTrack: trying again to get customTrackUi\n");
    outPage = quickSubmit(tablePage, org, db, group, track, table,
        "customTrackUi", hgtaDoTopSubmit, "submit");
    attempts++;
    }
if (outPage == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOutCustomTrack - couldn't get outPage.");
    return;
    }

serialSubmit(&outPage, org, db, group, track, table, "outCustom", hgtaDoGetCustomTrackTb, "submit");
if (outPage == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOutCustomTrack - serialSubmit returned null page.");
    return;
    }
if (outPage->forms == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in custom track - no form produced.");
    htmlPageFree(&outPage);
    return;
    }
groupVar = htmlFormVarGet(outPage->forms, hgtaGroup);
if (!slNameInList(groupVar->values, "user"))
    {
    qaStatusSoftError(tablesTestList->status, 
	"No custom track group after custom track submission");
    }
htmlPageFree(&outPage);
}
コード例 #5
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testFilter(struct htmlPage *rootPage)
/* Simulate pressing buttons to get a reasonable filter on
 * uniProt taxon. */
{
char *org = NULL, *db = NULL, *group = "allTables", *track="uniProt",
	*table = "uniProt.taxon";
struct htmlPage *page;
page = quickSubmit(rootPage, org, db, group, "uniProt", 
	table, "taxonFilter1", hgtaDoFilterPage, "submit");
if (page != NULL)
    {
    struct htmlFormVar *var = htmlFormVarGet(page->forms, 
    	"hgta_fil.v.uniProt.taxon.binomial.pat");
    if (var == NULL)
        internalErr();
    htmlPageSetVar(page, NULL, "hgta_fil.v.uniProt.taxon.binomial.pat",
        "Xenopus*");
    serialSubmit(&page, org, db, group, track, table, "taxonFilter2",
    	hgtaDoFilterSubmit, "submit");
    if (page != NULL)
        {
	htmlPageSetVar(page, NULL, hgtaOutputType, "selectedFields");
	serialSubmit(&page, org, db, group, track, table, "taxonFilter3",
	    hgtaDoTopSubmit, "submit");
	if (page != NULL)
	    {
	    htmlPageSetVar(page, NULL, "hgta_fs.check.uniProt.taxon.binomial",
	    	"on");
	    serialSubmit(&page, org, db, group, track, table, "taxonFilter4",
		hgtaDoPrintSelectedFields, "submit");
	    if (page != NULL)
		checkXenopus(page->htmlText);
	    htmlPageFree(&page);
	    }
	}
    }
verbose(1, "Tested filter on uniProt.taxon\n");
}
コード例 #6
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testOutBed(struct htmlPage *tablePage, struct htmlForm *mainForm,
     char *org, char *db, char *group, char *track, char *table, 
     int expectedRows)
/* Get as bed and make sure count agrees with expected. */
/* mainForm not used */
{
struct htmlPage *outPage;
int attempts = 0;

if (tablePage->forms == NULL) 
     errAbort("testOutBed: Missing form (tablePage)");

htmlPageSetVar(tablePage, NULL, hgtaOutputType, "bed");

outPage = quickSubmit(tablePage, org, db, group, track, table,
    "bedUiPage", hgtaDoTopSubmit, "submit");
while (outPage == NULL && attempts < MAX_ATTEMPTS)
    {
    printf("testOutBed: trying again to get bedUiPage\n");
    outPage = quickSubmit(tablePage, org, db, group, track, table,
       "bedUiPage", hgtaDoTopSubmit, "submit");
    attempts++;
    }
if (outPage == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOneBed - couldn't get outPage.");
    return;
    }
if (outPage->forms == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
           "Error in testOneBed - missing form.");
    htmlPageFree(&outPage);
    return;
    }

serialSubmit(&outPage, org, db, group, track, table, "outBed", hgtaDoGetBed, "submit");
// check that outPage != NULL
checkExpectedSimpleRows(outPage, expectedRows);
htmlPageFree(&outPage);
}
コード例 #7
0
void testDbFilters(struct htmlPage *dbPage, char *org, char *db, 
	char *accColumn, struct slName *geneList)
/* Test filter that returns just geneList. */
{
struct slName *gene;
int rowCount;
char accFilter[256];

/* Start out with filter page. */
struct htmlPage *page = quickSubmit(dbPage, NULL, org, db, accColumn, NULL,
	"accOneFilterPage", advFilterVarName, "on");
verbose(1, "testFilters %s %s\n", org, db);
if (page == NULL)
    return;

/* Set up to filter exactly one gene. */
safef(accFilter, sizeof(accFilter), "near.as.%s.wild", accColumn);
    {
    htmlPageSetVar(page, NULL, accFilter, geneList->name);
    htmlPageSetVar(page, NULL, searchVarName, geneList->name);
    serialSubmit(&page, NULL, org, db, accColumn, geneList->name,
	    "accOneFilterSubmit", "Submit", "on");
    if (page == NULL)
	return;

    /* Make sure really got one gene. */
    rowCount = nearCountUniqAccRows(page);
    if (rowCount != 1)
	{
	qaStatusSoftError(nearTestList->status, 
	    "Acc exact filter returned %d items", rowCount);
	}
    }

/* Set up filter for all genes in list. */
    {
    struct dyString *dy = newDyString(0);
    int geneCount = slCount(geneList);
    for (gene = geneList; gene != NULL; gene = gene->next)
	dyStringPrintf(dy, "%s ", gene->name);
    htmlPageSetVar(page, NULL, accFilter, dy->string);
    htmlPageSetVar(page, NULL, countVarName, "all");  /* despite 3 genes requested, must see all if many dupes */
    serialSubmit(&page, NULL, org, db, accColumn, dy->string,
	    "accMultiFilterSubmit", "Submit", "on");
    dyStringFree(&dy);
    if (page == NULL)
	return;
    rowCount = nearCountUniqAccRows(page);
    if (rowCount != geneCount)
	{
	qaStatusSoftError(nearTestList->status, 
	    "Acc multi filter expecting %d, got %d items", geneCount, rowCount);
	}
    }

/* Set up filter for wildcard in list. */
    {
    struct dyString *dy = newDyString(0);
    char len = strlen(geneList->name);
    dyStringAppendN(dy, geneList->name, len-1);
    dyStringAppendC(dy, '*');
    htmlPageSetVar(page, NULL, accFilter, dy->string);
    serialSubmit(&page, NULL, org, db, accColumn, dy->string,
	    "accWildFilterSubmit", "Submit", "on");
    dyStringFree(&dy);
    if (page == NULL)
	return;
    rowCount = nearCountRows(page);
    if (rowCount < 1)
	{
	qaStatusSoftError(nearTestList->status, 
	    "Acc wild filter no match");
	}
    }


/* Clear out advanced filters. */
    {
    htmlPageFree(&page);
    page = quickSubmit(dbPage, NULL, org, db, NULL, NULL,
	"advFilterClear", advFilterClearVarName, "on");
    }
htmlPageFree(&page);
}
コード例 #8
0
ファイル: hgTablesTest.c プロジェクト: elmargb/kentUtils
void testOutSequence(struct htmlPage *tablePage, struct htmlForm *mainForm,
     char *org, char *db, char *group, char *track, char *table, 
     int expectedRows)
/* Get as sequence and make sure count agrees with expected. */
/* mainForm not used */
{
struct htmlPage *outPage;
int attempts = 0;
struct htmlFormVar *typeVar;

if (tablePage->forms == NULL) 
    errAbort("testOutSequence: Missing form (tablePage)");

htmlPageSetVar(tablePage, NULL, hgtaOutputType, "sequence");
outPage = quickSubmit(tablePage, org, db, group, track, table,
    "seqUi1", hgtaDoTopSubmit, "submit");
while (outPage == NULL && attempts < MAX_ATTEMPTS) 
    {
    printf("testOutSequence: trying again to get seqUi1\n");
    outPage = quickSubmit(tablePage, org, db, group, track, table,
        "seqUi1", hgtaDoTopSubmit, "submit");
    attempts++;
    }
if (outPage == NULL) 
    {
    qaStatusSoftError(tablesTestList->status,
        "Error in testOutSequence - couldn't get outPage");
    return;
    }
if (outPage->forms == NULL)
    {
    qaStatusSoftError(tablesTestList->status,
        "Error in testOutSequence - missing form");
    htmlPageFree(&outPage);
    return;
    }

/* Since some genomic sequence things are huge, this will
 * only test in case where it's a gene prediction. */
typeVar = htmlFormVarGet(outPage->forms, hgtaGeneSeqType);
if (typeVar != NULL)
    {
    struct htmlPage *seqPage;
    static char *types[] = {"protein", "mRNA"};
    int i;
    for (i=0; i<ArraySize(types); ++i)
        {
        char *type = types[i];
        if (slNameInList(typeVar->values, type))
             {
	     struct htmlPage *page;
	     char testName[128];
	     htmlPageSetVar(outPage, NULL, hgtaGeneSeqType, type);
	     safef(testName, sizeof(testName), "%sSeq", type);
	     page = quickSubmit(outPage, org, db, group, track, table,
	        testName, hgtaDoGenePredSequence, "submit");
	     checkFaOutput(page, expectedRows, TRUE);
	     htmlPageFree(&page);
	     }
         }
    htmlPageSetVar(outPage, NULL, hgtaGeneSeqType, "genomic");
    serialSubmit(&outPage, org, db, group, track, table, "seqUi2", hgtaDoGenePredSequence, "submit");
    // check that outPage != NULL

    /* On genomic page uncheck intron if it's there, then get results * and count them. */
    if (htmlFormVarGet(outPage->forms, "hgSeq.intron") != NULL)
         htmlPageSetVar(outPage, NULL, "hgSeq.intron", NULL);
    seqPage = quickSubmit(outPage, org, db, group, track, table, "genomicSeq", hgtaDoGenomicDna, "submit");
    // check that seqPage != NULL
    checkFaOutput(seqPage, expectedRows, FALSE);
    htmlPageFree(&seqPage);
    }

htmlPageFree(&outPage);
}