d8a1130659866e272cd481848b48c6134fac7e02 kent Mon Sep 2 10:23:35 2019 -0700 Fixing some of the @ and @@ field names. diff --git src/hca/hcat/hcatTabUpdate/hcatTabUpdate.c src/hca/hcat/hcatTabUpdate/hcatTabUpdate.c index 39a548b..a608945 100644 --- src/hca/hcat/hcatTabUpdate/hcatTabUpdate.c +++ src/hca/hcat/hcatTabUpdate/hcatTabUpdate.c @@ -215,32 +215,32 @@ } void addListFieldIfNonempty(char *field, struct slName *list, char *newFields[], char *newVals[], int maxNewCount,int *pCurCount) /* Add field to newFields if list is non-empty, taking care not to go past end. */ { if (list != NULL) { int curCount = *pCurCount; if (curCount >= maxNewCount) errAbort("Too many fields in addListFieldIfNonempty on %s, %d max", field, curCount); char fieldName[256]; char *strippedField = cloneString(field); stripChar(strippedField, '_'); safef(fieldName, sizeof(fieldName), - "@@%s@id@hcat_project_%s@project_id@%s_id@hcat_%s.short_name@id", - field, strippedField, field, strippedField); + "@@%s@id@hcat_project_%s@project_id@%s_id@hcat_%s@short_name@id", + field, field, field, strippedField); newFields[curCount] = cloneString(fieldName); newVals[curCount] = slNameToCsv(list); *pCurCount = curCount+1; freez(&strippedField); } } struct fieldedTable *makeProject(struct fieldedTable *inProject, struct fieldedTable *inSample) /* Make output project table. This is the big one - 35 fields now * probably twice that by the time HCA is done. Fortunately we only need * to deal with some of the fields and it only has one row. */ { char **inFields = inProject->fields; char **inRow = inProject->rowList->row; @@ -261,38 +261,44 @@ char *inName = inFields[inIx]; char *inVal = inRow[inIx]; /* Go through list of input fields we tweak slightly */ if (sameString("taxons", inName)) { // its many-to-many, whoot! inName = "@@species@id@hcat_project_species@project_id@species_id@hcat_species@common_name@id"; inVal = taxonsToSpecies(inVal, scratch); } /* We might modify names of some fields */ char nameBuf[128]; if (sameString("state_reached", inName) || sameString("cur_state", inName)) { - safef(nameBuf, sizeof(nameBuf), "@%s_id@hcat_project_state.state@id", inName); + safef(nameBuf, sizeof(nameBuf), "@%s_id@hcat_projectstate@state@id", inName); inName = cloneString(nameBuf); } - else if (sameString("consent", inName) || sameString("effort", inName)) + else if (sameString("consent", inName)) { - safef(nameBuf, sizeof(nameBuf), "@%s_id@hcat_%s.short_name@id", inName, inName); + safef(nameBuf, sizeof(nameBuf), "@%s_id@hcat_%s@short_name@id", inName, inName); inName = cloneString(nameBuf); } + else if (sameString("effort", inName)) + { + safef(nameBuf, sizeof(nameBuf), "@%s_id@hcat_efforttype@short_name@id", inName); + inName = cloneString(nameBuf); + } + else if (sameString("effort", inName)) /* Output all the ones we haven't dealt with already or will deal with later */ if (!startsWith("contact_", inName) && !sameString("contributors", inName)) { outFields[outFieldCount] = inName; outRow[outFieldCount] = inVal; ++outFieldCount; } } /* Add in contributors as a multi to multi field */ outFields[outFieldCount] = "@@contributors@hcat_project_contributors@id@project_id@contributor_id@hcat_contributor@name@id"; outRow[outFieldCount] = fieldedTableLookupNamedFieldInRow(inProject, "contributors", inRow); /* Add the fields we scan and merge from sample at end */