7c815153cdd9486e0edf61e9bffbeec1a5fb189e jcasper Wed Sep 11 16:04:23 2019 -0700 A couple more files for the hic composite track changes, refs #22316 diff --git src/hg/lib/hic.c src/hg/lib/hic.c index 1758389..f8b831f 100644 --- src/hg/lib/hic.c +++ src/hg/lib/hic.c @@ -6,69 +6,75 @@ #include "jksql.h" #include "hic.h" #include "hdb.h" #include "trackHub.h" #include "Cstraw.h" #include "hash.h" #include "chromAlias.h" #include "interact.h" char *hicLoadHeader(char *filename, struct hicMeta **header, char *ucscAssembly) /* Create a hicMeta structure for the supplied Hi-C file. If * the return value is non-NULL, it points to a string containing * an error message that explains why the retrieval failed. */ { char *genome; -char **chromosomes, **bpResolutions; -int nChroms, nBpRes; +char **chromosomes, **bpResolutions, **attributes; +int *chromSizes, nChroms, nBpRes, nAttributes; -char *errMsg = CstrawHeader(filename, &genome, &chromosomes, &nChroms, &bpResolutions, &nBpRes, NULL, NULL); +char *errMsg = CstrawHeader(filename, &genome, &chromosomes, &chromSizes, &nChroms, &bpResolutions, &nBpRes, NULL, NULL, &attributes, &nAttributes); if (errMsg != NULL) return errMsg; struct hicMeta *newMeta = NULL; AllocVar(newMeta); newMeta->fileAssembly = genome; newMeta->nRes = nBpRes; newMeta->resolutions = bpResolutions; newMeta->nChroms = nChroms; newMeta->chromNames = chromosomes; +newMeta->chromSizes = chromSizes; newMeta->ucscToAlias = NULL; newMeta->ucscAssembly = cloneString(ucscAssembly); newMeta->filename = cloneString(filename); +newMeta->attributes = attributes; +newMeta->nAttributes = nAttributes; *header = newMeta; if (trackHubDatabase(genome)) return NULL; // add alias hash in case file uses 1 vs chr1, etc. +if (newMeta->ucscAssembly != NULL) + { struct hash *aliasToUcsc = chromAliasMakeLookupTable(newMeta->ucscAssembly); if (aliasToUcsc != NULL) { struct hash *ucscToAlias = newHash(0); int i; for (i=0; ichrom, cloneString(chromosomes[i])); } } newMeta->ucscToAlias = ucscToAlias; hashFree(&aliasToUcsc); } + } return NULL; } struct interact *interactFromHic(char *chrom1, int start1, char *chrom2, int start2, int size, double value) /* Given some data values from an interaction in a hic file, build a corresponding interact structure. */ { struct interact *new = NULL; AllocVar(new); new->chrom = cloneString(chrom1); // start1 is always before start2 on same-chromosome records, so start1 is always the start. // On records that link between chromosomes, just use the coordinates for this chromosome. new->chromStart = start1; if (sameWord(chrom1, chrom2))