コード例 #1
0
ファイル: pslTransMap.c プロジェクト: CRG-Barcelona/libbeato
static void addPslBlock(struct psl* psl, struct block* blk, int* pslMax)
/* add a block to a psl */
{
unsigned newIBlk = psl->blockCount;

assert((blk->qEnd - blk->qStart) == (blk->tEnd - blk->tStart));
if (newIBlk >= *pslMax)
    pslGrow(psl, pslMax);
psl->qStarts[newIBlk] = blk->qStart;
psl->tStarts[newIBlk] = blk->tStart;
psl->blockSizes[newIBlk] = blk->qEnd - blk->qStart;
/* lie about match counts. */
psl->match += psl->blockSizes[newIBlk];
/* count gaps */
if (newIBlk > 0)
    {
    if (psl->qStarts[newIBlk] > pslQEnd(psl, newIBlk-1))
        {
        psl->qNumInsert++;
        psl->qBaseInsert += psl->qStarts[newIBlk] - pslQEnd(psl, newIBlk-1);
        }
    if (psl->tStarts[newIBlk] > pslTEnd(psl, newIBlk-1))
        {
        psl->tNumInsert++;
        psl->tBaseInsert += psl->tStarts[newIBlk] - pslTEnd(psl, newIBlk-1);
        }
    }
psl->blockCount++;
}
コード例 #2
0
static int isBetweenBlocks(struct psl* chainedPsl,
                           struct psl* nextPsl,
                           int insertIdx)
/* does nextPsl fit between two chained PSL blocks */
{
return (pslQEnd(chainedPsl, insertIdx-1) <= pslQStart(nextPsl, 0))
    && (pslTEnd(chainedPsl, insertIdx-1) <= pslTStart(nextPsl, 0))
    && (pslQEnd(nextPsl, nextPsl->blockCount-1) <= pslQStart(chainedPsl, insertIdx))
    && (pslTEnd(nextPsl, nextPsl->blockCount-1) <= pslTStart(chainedPsl, insertIdx));
}
コード例 #3
0
static int findChainPointDownstream(struct psl* chainedPsl,
                                    struct psl* nextPsl)
/* findChainPoint downstream check. */
{
if ((pslQStart(nextPsl, 0) >= pslQEnd(chainedPsl, chainedPsl->blockCount-1))
    && (pslTStart(nextPsl, 0) >= pslTEnd(chainedPsl, chainedPsl->blockCount-1)))
    {
    if ((pslTStart(nextPsl, 0) - pslTEnd(chainedPsl, chainedPsl->blockCount-1)) > maxAdjacentDistance)
        return CHAIN_CAN_NOT;  // too far after
    else
        return chainedPsl->blockCount;
    }
else
    return CHAIN_NOT_HERE; 
}
コード例 #4
0
static int findChainPointUpstream(struct psl* chainedPsl,
                                  struct psl* nextPsl)
/* findChainPoint upstream check. */
{
// check next being query upstream of chain
if ((pslQEnd(nextPsl, nextPsl->blockCount-1) <= pslQStart(chainedPsl, 0))
    && (pslTEnd(nextPsl, nextPsl->blockCount-1) <= pslTStart(chainedPsl, 0)))
    {
    if ((pslTStart(chainedPsl, 0) - pslTEnd(nextPsl, nextPsl->blockCount-1)) > maxAdjacentDistance)
        return CHAIN_CAN_NOT;  // too far before
    else
        return 0;
    }
else
    return CHAIN_NOT_HERE;
}
コード例 #5
0
static unsigned pslTEndStrand(struct psl *psl, int blkIdx, char strand)
/* return target end for the given block, mapped to specified strand,
 * which can be `\0' for `+' */
{
if (normStrand(psl->strand[1]) == normStrand(strand))
    return pslTEnd(psl, blkIdx);
else
    return psl->tSize - pslTStart(psl, blkIdx);
}
コード例 #6
0
ファイル: pslBuild.c プロジェクト: bowhan/kent
static void countIndels(struct psl *psl)
/* update indel counts in psl after adding a block */
{
if (psl->blockCount > 1)
    {
    int iBlk = psl->blockCount - 1;
    if (pslQEnd(psl, iBlk-1) != psl->qStarts[iBlk])
        {
        /* insert in query */
        psl->qNumInsert++;
        psl->qBaseInsert += (psl->qStarts[iBlk] - pslQEnd(psl, iBlk-1));
    }
    if (pslTEnd(psl, iBlk-1) != psl->tStarts[iBlk])
        {
        /* insert in target */
        psl->tNumInsert++;
        psl->tBaseInsert += (psl->tStarts[iBlk] - pslTEnd(psl, iBlk-1));
        }
    }
}
コード例 #7
0
ファイル: bedToPsl.c プロジェクト: elmargb/kentUtils
static void bedToPsl12(struct bed *bed, struct psl *psl)
/* convert a 12-column BED to a psl */
{
int i, qNext = 0;
for (i = 0; i < bed->blockCount; i++)
    {
    psl->tStarts[i] = bed->chromStarts[i] + bed->chromStart;
    if (keepQuery)
        psl->qStarts[i] = psl->tStarts[i];
    else
        psl->qStarts[i] = qNext;
        
    psl->blockSizes[i] = bed->blockSizes[i];
    if (i > 0)
        {
        psl->tNumInsert += 1;
        psl->tBaseInsert += psl->tStarts[i] - pslTEnd(psl, i-1);
        }
    psl->blockCount++;
    qNext += bed->blockSizes[i];
    }
}