void maskWithOut(char *outName, struct hash *tbHash, struct hash *bitmapHash) /* Read coordinates from outName and apply them to twoBits in tbHash. */ { struct lineFile *lf = lineFileOpen(outName, TRUE); char *line; int lineSize; /* Make sure we have a .out header. */ if (!lineFileNext(lf, &line, &lineSize)) errAbort("Empty %s", lf->fileName); if (!startsWith(" SW perc perc", line)) { if (!startsWith(" SW perc perc", line)) errAbort("%s doesn't seem to be a RepeatMasker .out file, first " "line seen:\n%s", lf->fileName, line); } lineFileNext(lf, &line, &lineSize); lineFileNext(lf, &line, &lineSize); /* Process line oriented records of .out file. */ while (lineFileNext(lf, &line, &lineSize)) { struct repeatMaskOut rmo; char *words[24]; int wordCount; char *seqName; int start, end; wordCount = chopLine(line, words); if (wordCount < 14) errAbort("Expecting 14 or 15 words line %d of %s", lf->lineIx, lf->fileName); repeatMaskOutStaticLoad(words, &rmo); seqName = rmo.qName; start = rmo.qStart - 1; end = rmo.qEnd; addMasking(tbHash, bitmapHash, seqName, start, end); } bitmapToMaskArray(bitmapHash, tbHash); }
void storeMasked(struct hash *repeatHash, char *faName) /* Look for repeat masked file corresponding to faName. */ { char fileName[512]; struct lineFile *lf; char *line; int lineSize; struct repeatMaskOut rmo; struct hashEl *hel; struct repeatTracker *rt; boolean ok; sprintf(fileName, "%s.out", faName); if (!fileExists(fileName)) { warn("No mask file %s\n", fileName); return; } lf = lineFileOpen(fileName, TRUE); ok = lineFileNext(lf, &line, &lineSize); if (!ok) warn("Empty mask file %s\n", fileName); else { if (!startsWith("There were no", line)) { if (!startsWith(" SW", line)) errAbort("%s isn't a RepeatMasker .out file.", fileName); if (!lineFileNext(lf, &line, &lineSize) || !startsWith("score", line)) errAbort("%s isn't a RepeatMasker .out file.", fileName); lineFileNext(lf, &line, &lineSize); /* Blank line. */ while (lineFileNext(lf, &line, &lineSize)) { char *words[32]; int wordCount; int seqSize; int repSize; wordCount = chopLine(line, words); if (wordCount < 14) errAbort("%s line %d - error in repeat mask .out file\n", fileName, lf->lineIx); repeatMaskOutStaticLoad(words, &rmo); /* If repeat is more than 15% divergent don't worry about it. */ if (rmo.percDiv + rmo.percDel + rmo.percInc <= 15.0) { if ((hel = hashLookup(repeatHash, rmo.qName)) == NULL) errAbort("%s is in %s but not %s, files out of sync?\n", rmo.qName, fileName, faName); rt = hel->val; seqSize = rt->seq->size; if (rmo.qStart <= 0 || rmo.qStart > seqSize || rmo.qEnd <= 0 || rmo.qEnd > seqSize || rmo.qStart > rmo.qEnd) { warn("Repeat mask sequence out of range (%d-%d of %d in %s)\n", rmo.qStart, rmo.qEnd, seqSize, rmo.qName); if (rmo.qStart <= 0) rmo.qStart = 1; if (rmo.qEnd > seqSize) rmo.qEnd = seqSize; } repSize = rmo.qEnd - rmo.qStart + 1; if (repSize > 0) memset(rt->repBytes + rmo.qStart - 1, TRUE, repSize); } } } } lineFileClose(&lf); }