Example #1
0
def loadChains(path):
    "name says it."

    try:
        EPO = epo.Chain._parse_file(path, True)
    except:
        sys.stderr.write(
            "ERROR: {} does not appear to be a valid chain file. Exiting!\n".
            format(path))
        exit(1)
    ## convert coordinates w.r.t the forward strand (into slices)
    ## compute cummulative intervals
    for i in range(len(EPO)):
        ch, S, T, Q = EPO[i]
        if ch.tStrand == '-':
            ch = ch._replace(tEnd=ch.tSize - ch.tStart,
                             tStart=ch.tSize - ch.tEnd)
        if ch.qStrand == '-':
            ch = ch._replace(qEnd=ch.qSize - ch.qStart,
                             qStart=ch.qSize - ch.qEnd)
        EPO[i] = (ch, epo.cummulative_intervals(S, T),
                  epo.cummulative_intervals(S, Q))
    ##now each element of epo is (chain_header, target_intervals, query_intervals)
    assert all(t[0].tStrand == '+'
               for t in EPO), "all target strands should be +"
    return EPO
Example #2
0
def loadChains(path):
    "name says it."

    EPO = epo.Chain._parse_file(path, True)
    ## convert coordinates w.r.t the forward strand (into slices)
    ## compute cummulative intervals
    for i in range(len(EPO)):
        ch, S, T, Q = EPO[i]
        if ch.tStrand == '-':
            ch = ch._replace(tEnd=ch.tSize - ch.tStart,
                             tStart=ch.tSize - ch.tEnd)
        if ch.qStrand == '-':
            ch = ch._replace(qEnd=ch.qSize - ch.qStart,
                             qStart=ch.qSize - ch.qEnd)
        EPO[i] = (ch, epo.cummulative_intervals(S, T),
                  epo.cummulative_intervals(S, Q))
    ##now each element of epo is (chain_header, target_intervals, query_intervals)
    assert all(map(lambda t: t[0].tStrand == '+',
                   EPO)), "all target strands should be +"
    return EPO
Example #3
0
def loadChains(path):
    "name says it."

    EPO = epo.Chain._parse_file(path, True)
    ## convert coordinates w.r.t the forward strand (into slices)
    ## compute cummulative intervals
    for i in range( len(EPO) ):
        ch, S, T, Q = EPO[i]
        if ch.tStrand == '-':
            ch = ch._replace(tEnd = ch.tSize - ch.tStart,
                    tStart = ch.tSize - ch.tEnd)
        if ch.qStrand == '-':
            ch = ch._replace(qEnd = ch.qSize - ch.qStart,
                    qStart = ch.qSize - ch.qEnd)
        EPO[i] = (ch,
                epo.cummulative_intervals(S, T),
                epo.cummulative_intervals(S, Q)
                )
    ##now each element of epo is (chain_header, target_intervals, query_intervals)
    assert all( map(lambda t: t[0].tStrand == '+', EPO) ), "all target strands should be +"
    return EPO