void affyTransLiftedToSample(int grouping, char *affyTransIn) /* Top level function to run combine pairs and offset files to give sample. */ { struct affyTransLifted *atl = NULL, *atlList = NULL; struct sample *sampList = NULL, *samp = NULL; struct sample *groupedList = NULL; char *fileRoot = NULL; char buff[10+strlen(affyTransIn)]; FILE *out = NULL; char *fileNameCopy = cloneString(affyTransIn); chopSuffix(fileNameCopy); fprintf(stderr, "."); fflush(stderr); atlList = affyTransLiftedLoadAll(affyTransIn); //warn("Creating samples."); for(atl = atlList; atl != NULL; atl = atl->next) { samp = sampleFromAffyTransLifted(atl, fileNameCopy); if(samp != NULL) slAddHead(&sampList, samp); } //warn("Sorting Samples"); slSort(&sampList, sampleCoordCmp); groupedList = groupByPosition(grouping, sampList); //warn("Saving Samples."); snprintf(buff, sizeof(buff), "%s.sample", affyTransIn); out = mustOpen(buff, "w"); for(samp = groupedList; samp != NULL; samp = samp->next) { sampleTabOut(samp, out); } //warn("Cleaning up."); freez(&fileNameCopy); carefulClose(&out); sampleFreeList(&sampList); sampleFreeList(&groupedList); affyTransLiftedFreeList(&atlList); }
void affyPairsToSample(struct hash *liftHash, int grouping, char *pairsIn) /* Top level function to run combine pairs and offset files to give sample. */ { struct affyPairs *apList = NULL, *ap = NULL; struct sample *sampList = NULL, *samp = NULL; struct sample *groupedList = NULL; char buff[10+strlen(pairsIn)]; FILE *out = NULL; fprintf(stderr, "."); fflush(stderr); //warn("Loading Affy Pairs."); apList = affyPairsLoadAll(pairsIn); //warn("Creating samples."); for(ap = apList; ap != NULL; ap = ap->next) { samp = sampFromAffyPair(ap, liftHash); if(samp != NULL) { slAddHead(&sampList, samp); } } //warn("Sorting Samples"); slSort(&sampList, sampleCoordCmp); groupedList = groupByPosition(grouping, sampList); //warn("Saving Samples."); snprintf(buff, sizeof(buff), "%s.sample", pairsIn); out = mustOpen(buff, "w"); for(samp = groupedList; samp != NULL; samp = samp->next) { sampleTabOut(samp, out); } //warn("Cleaning up."); carefulClose(&out); sampleFreeList(&sampList); sampleFreeList(&groupedList); affyPairsFreeList(&apList); }