547bba8e3ecc9264b58f713e9a67cb6055d4b3fb tdreszer Wed Apr 20 09:45:55 2011 -0700 Changes so that -accession -test will work. Also made some experimentify errors more prominent. diff --git src/hg/lib/mdb.c src/hg/lib/mdb.c index a5e5440..5b0d6a1 100644 --- src/hg/lib/mdb.c +++ src/hg/lib/mdb.c @@ -2876,48 +2876,49 @@ struct mdbObj *obj = slPopHead(&mdbExpObjs); { // NOTE: This list could expand but we expect only tables and files to be objs in an experiment char *objType = mdbObjFindValue(obj,MDB_OBJ_TYPE); assert(objType != NULL && (sameString(objType,MDB_OBJ_TYPE_TABLE) || sameString(objType,MDB_OBJ_TYPE_FILE))); } boolean updateObj = FALSE; char *val = mdbObjFindValue(obj,MDB_VAR_ENCODE_EXP_ID); if (val != NULL) { foundId = TRUE; // warn==1 will give only 1 exp wide error if no individual errors. NOTE: would be nice if those with expId sorted to beginning, but can't have everything. int thisId = atoi(val); if (expId == ENCODE_EXP_IX_UNDEFINED || thisId != expId) { - updateObj = TRUE; - if (warn > 0) - printf(" %s %s has bad %s=%s.\n",experimentId,obj->obj,MDB_VAR_ENCODE_EXP_ID,val); + updateObj = TRUE; // Always an error! + printf(" ERROR %s %s has bad %s=%s.\n",experimentId,obj->obj,MDB_VAR_ENCODE_EXP_ID,val); } else { char *acc = mdbObjFindValue(obj,MDB_VAR_DCC_ACCESSION); // FIXME: Add code to update accession to encodeExp + if (updateAccession && !createExpIfNecessary && exp->accession == NULL) + { + exp->accession = needMem(16); + safef(exp->accession, 16, "TEMP%06d", exp->ix); // Temporary since this is not an update but we want -test to work. + } if (exp->accession != NULL && (acc == NULL || differentString(acc,exp->accession))) { updateObj = TRUE; - if (warn > 1) // NOTE: Could give more info for each obj as per wrangler's desires - { - if (acc == NULL) + if (acc != NULL) // Always an error + printf(" ERROR %s %s %s set, has wrong %s: %s.\n",experimentId,obj->obj, + MDB_VAR_ENCODE_EXP_ID,MDB_VAR_DCC_ACCESSION,acc); + else if (warn > 1) // NOTE: Could give more info for each obj as per wrangler's desires printf(" %s %s %s set, needs %s.\n",experimentId,obj->obj,MDB_VAR_ENCODE_EXP_ID,MDB_VAR_DCC_ACCESSION); - else - printf(" %s %s %s set, has wrong %s: %s.\n",experimentId,obj->obj, - MDB_VAR_ENCODE_EXP_ID,MDB_VAR_DCC_ACCESSION,exp->accession); - } } else { errors--; // One less error if (warn > 1) // NOTE: Could give more info for each obj as per wrangler's desires printf(" %s %s %s\n",experimentId,obj->obj,(exp->accession != NULL ? exp->accession : "")); } } } else { updateObj = (expId != ENCODE_EXP_IX_UNDEFINED); if ((foundId && warn > 0) || warn > 1) { if (updateObj)