static void mapToRefWithMapping(struct hapRegions *hr, struct cDnaAlign *hapAln, struct psl *mapping, struct psl **mappedHaps) /* map an alignment on a haplotype chromosome using one mapping */ { struct psl *m; struct psl *mapped = pslTransMap(pslTransMapNoOpts, hapAln->psl, mapping); while ((m = slPopHead(&mapped)) != NULL) { slAddHead(&mappedHaps, m); if (hr->hapRefMappedFh != NULL) pslTabOut(m, hr->hapRefMappedFh); } }
static struct psl *mapCDnaCDnaAln(struct hapRegions *hr, struct cDnaAlign *refAln, struct psl *mappedHap) /* create cdna to cdna alignments from mappedHap and refAln, return * NULL if can't be mapped */ { struct psl *cDnaCDnaAln = NULL; if (sameString(refAln->psl->tName, mappedHap->tName) && rangeIntersection(refAln->psl->tStart, refAln->psl->tEnd, mappedHap->tStart, mappedHap->tEnd)) { pslSwap(mappedHap, FALSE); cDnaCDnaAln = pslTransMap(pslTransMapNoOpts, refAln->psl, mappedHap); pslSwap(mappedHap, FALSE); if ((hr->hapRefCDnaFh != NULL) && (cDnaCDnaAln != NULL)) cDnaAlignPslOut(cDnaCDnaAln, refAln->alnId, hr->hapRefCDnaFh); } return cDnaCDnaAln; }
static void mapPslPair(struct psl *inPsl, struct mapAln *mapAln, FILE* outPslFh, FILE *mapInfoFh, FILE *mappingPslFh) /* map one pair of query and target PSL */ { struct psl* mappedPsl; if (inPsl->tSize != mapAln->psl->qSize) errAbort("Error: inPsl %s tSize (%d) != mapping alignment %s qSize (%d) (perhaps you need to specify -swapMap?)\n", inPsl->tName, inPsl->tSize, mapAln->psl->qName, mapAln->psl->qSize); mappedPsl = pslTransMap(mapOpts, inPsl, mapAln->psl); /* only output if blocks were actually mapped */ if (mappedPsl != NULL) { if (suffix != NULL) addQNameSuffix(mappedPsl); pslTabOut(mappedPsl, outPslFh); if (mapInfoFh != NULL) writeMapInfo(mapInfoFh, inPsl, mapAln, mappedPsl); if (mappingPslFh != NULL) pslTabOut(mapAln->psl, mappingPslFh); } pslFree(&mappedPsl); }