Beispiel #1
0
def indexVariants(variants):
    '''build index of variants for ranged retrieval.'''
    index = ncl.NCL()

    for start, end, reference, action, has_wildtype, variantseqs in variants:
        index.add(start, end, (reference, action, has_wildtype, variantseqs))

    return index
Beispiel #2
0
    def buildIndex(self, filename):
        """read and index."""

        idx = {}
        infile = IOTools.openFile(filename, "r")
        for e in GTF.readFromFile(infile):
            if e.contig not in idx: idx[e.contig] = NCL.NCLSimple()
            idx[e.contig].add(e.start, e.end)
        infile.close()
        return idx
Beispiel #3
0
def nclpy_create_on_disk_and_flush(segmenter):
    index = ncl.NCL(filestem="tmp", force=True)
    for id, coords in enumerate(segmenter):
        index.add(coords[0], coords[1], id)
    del index
    return ncl.NCL(filestem="tmp")
Beispiel #4
0
def nclpy_create(segmenter):
    index = ncl.NCL()
    for id, coords in enumerate(segmenter):
        index.add(coords[0], coords[1], id)
    return index
Beispiel #5
0
def ncl_create(segmenter):
    index = ncl.IntervalDB()
    index.fromlist([(coords[0], coords[1], id)
                    for id, coords in enumerate(segmenter)])
    return index