void ooSplitFins(char *finTrans, char *ooDir) /* ooSplitFins - Create splitFin files (list of split finished clones). */ { struct hash *splitCloneHash = newHash(8); struct clone *cloneList, *clone; char fileName[512]; int i; struct fileInfo *chromDir = NULL, *ctgDir = NULL, *chrom, *ctg; int splitCount = 0; /* Read in finished clones and put ones with more than * one fragment in hash. */ cloneList = readTrans(finTrans); for (clone = cloneList; clone != NULL; clone = clone->next) if (slCount(clone->fragList) > 1) { hashAdd(splitCloneHash, clone->name, clone); ++splitCount; } printf("Found %d split clones in %s\n", splitCount, finTrans); /* Scan over all contigs in ooDir. */ chromDir = listDirX(ooDir, "*", FALSE); for (chrom = chromDir; chrom != NULL; chrom = chrom->next) { char *chromName = chrom->name; if (chrom->isDir && strlen(chromName) <= 2 && chromName[0] != '.') { printf("Processing %s\n", chromName); sprintf(fileName, "%s/%s", ooDir, chromName); ctgDir = listDirX(fileName, "ctg*", TRUE); for (ctg = ctgDir; ctg != NULL; ctg = ctg->next) { fflush(stdout); if (ctg->isDir) writeRelevantSplits(ctg->name, splitCloneHash); } slFreeList(&ctgDir); } } }
static void gsFillInSequence(char *gsDir, struct agpFrag *agpList, DNA *dna, int dnaSize) /* Fill in DNA array with sequences from 'freeze' */ { struct agpFrag *agp; int subCount; char *sub[64]; char transFile[512], faDir[512]; struct hash *cloneHash = newHash(15), *fragHash = newHash(17); int i; struct clone *clone; /* Read in trans-files to hash */ subCount = chopString(subDirs, ",", sub, ArraySize(sub)); if (subCount >= ArraySize(sub)) errAbort("Too many subDirs, limit 64."); for (i=0; i<subCount; ++i) { sprintf(faDir, "%s/%s/fa", gsDir, sub[i]); sprintf(transFile, "%s/%s/trans", gsDir, sub[i]); readTrans(transFile, faDir, cloneHash, fragHash); } /* Read sequences and copy them to output DNA array. */ printf("Reading source sequences from %s\n", gsDir); for (agp = agpList; agp != NULL; agp = agp->next) { DNA *dest; int size; if ((clone = hashFindVal(cloneHash, agp->frag)) == NULL) errAbort("Couldn't find %s in %s", agp->frag, gsDir); if (clone->dna == NULL) getCloneDna(clone, fragHash); dest = dna + agp->chromStart; size = agp->chromEnd - agp->chromStart; memcpy(dest, clone->dna + agp->fragStart, size); if (agp->strand[0] == '-') reverseComplement(dest, size); } }