void rsyncEdwExpDataType(char *url, char *userId, char *password, char *outTab) /* rsyncEdwExpDataType - Get experiment and data types from ENCODED via json.. */ { char *jsonText = NULL; if (jsonIn) readInGulp(jsonIn, &jsonText, NULL); else jsonText = getJsonViaHttps(url, userId, password); if (jsonOut) writeGulp(jsonOut, jsonText, strlen(jsonText)); struct jsonElement *jsonRoot = jsonParse(jsonText); char *expListName = "@graph"; struct jsonElement *jsonExpList = jsonMustFindNamedField(jsonRoot, "", expListName); verbose(1, "Got @graph %p\n", jsonExpList); struct slRef *ref, *refList = jsonListVal(jsonExpList, expListName); verbose(1, "Got %d experiments\n", slCount(refList)); FILE *f = mustOpen(outTab, "w"); int realExpCount = 0; for (ref = refList; ref != NULL; ref = ref->next) { struct jsonElement *el = ref->val; char *acc = jsonStringField(el, "accession"); char *dataType = jsonStringField(el, "assay_term_name"); if (dataType != NULL) { fprintf(f, "%s\t%s\t%s\t%s\t%s\n", acc, dataType, jsonOptionalStringField(el, "lab.title", ""), jsonOptionalStringField(el, "biosample_term_name", ""), jsonOptionalStringField(el, "award.rfa", "")); ++realExpCount; } } verbose(1, "Got %d experiments with dataType\n", realExpCount); carefulClose(&f); }
static void writeAutoUpgradeTableResult(char *tableName, char *result) /* Write table upgrade result */ { char path[AUTOUPGRPATHSIZE]; makeResultName(tableName, path); writeGulp(path, result, strlen(result)); }