void regClusterMakeTableOfTables(char *type, char *input, char *output) /* regClusterMakeTableOfTables - Make up a table of tables for regCluster program. */ { FILE *f = mustOpen(output, "w"); struct slName *in, *inList = readAllLines(input); /* Generally we'll have a bunch of file names that all start and/or end with the same * thing. This loop will isolate out the bits that vary, and then call a type-specific * routine to output the metadata columns from the middle parts. */ int commonPrefix = commonPrefixSize(inList); int commonSuffix = commonSuffixSize(inList); uglyf("regClusterMakeTableOfTables(type=%s, input=%s, output=%s)\n", type, input, output); int scoreIx = scoreColIx - 1; for (in = inList; in != NULL; in = in->next) { verbose(2, "Processing %s\n", in->name); fprintf(f, "%s\t0\t1\t2\t%d\t", in->name, scoreIx); fprintf(f, "%g", calcNormScoreFactor(in->name, scoreIx)); char *s = in->name; int len = strlen(s); char *midString = cloneStringZ(s+commonPrefix, len - commonPrefix - commonSuffix); if (sameString(type, "uw01")) uw01MetaOut(f, midString); else if (sameString(type, "uw02")) uw02MetaOut(f, midString); else if (sameString(type, "ans01")) ans01MetaOut(f, midString); else if (sameString(type, "ans02")) ans02MetaOut(f, midString); else if (sameString(type, "enh01")) enh01MetaOut(f, midString); else if (sameString(type, "awgDnase01")) awgDnase01MetaOut(f, midString); else errAbort("Unknown type '%s' in first command line parameter.", type); freez(&midString); fprintf(f, "\n"); } carefulClose(&f); }
void makeConfigFromFileList(char *input, char *output) /* makeConfigFromFileList - Create config file for hgBedsToBedExps from list of files.. */ { FILE *f = mustOpen(output, "w"); struct slName *in, *inList = readAllLines(input); int commonPrefix = commonPrefixSize(inList); int commonSuffix = commonSuffixSize(inList); for (in = inList; in != NULL; in = in->next) { char *s = in->name; int len = strlen(s); char *midString = cloneStringZ(s+commonPrefix, len - commonPrefix - commonSuffix); char *factor, *cell; camelParseTwo(midString, &cell, &factor); fprintf(f, "%s\t%s\t", factor, cell); fprintf(f, "%s\t", cellAbbreviation(cell)); fprintf(f, "file\t%d\t", scoreCol-1); fprintf(f, "%g\t", calcNormScoreFactor(in->name, scoreCol-1)); fprintf(f, "%s\n", in->name); } carefulClose(&f); }