Example #1
0
def load_kmer_model(filename):
    with h5py.File(filename, "r") as file:
        central_position = file.attrs["central_pos"]
        model_table = file["model"]
        mean = np.zeros(len(model_table))
        sigma = np.zeros(len(model_table))
        k = None
        for line in model_table:
            kmer = line[0].decode("ascii")
            kmer_id = kmer_to_id(kmer)
            mean[kmer_id] = line[1]
            sigma[kmer_id] = line[2]
            k = len(kmer)
        return KmerModel(k, central_position, len(alphabet), mean, sigma)
Example #2
0
        X.append(x)
        Y.append(y)
    return X, Y


################################################################################

posReadsPaths = getReadsInFolder(readsPosFilePath, minSize=0)
negReadsPaths = getReadsInFolder(readsNegFilePath, minSize=0)

index = getAlignedIndex(alignedSquiggles)

ref = Fasta(refFilePath)

# load basecalled sequence and signal
mod = KmerModel.load_from_hdf5(kmerModelFilePath)

################################################################################

pomery = [[[] for j in kmerLen] for i in levels]
overlap = [[[] for j in kmerLen] for i in levels]
goodDash = [[] for i in levels]
badDash = [[] for i in levels]
alignLenRead = [0 for _ in levels]
alignLenFake = [0 for _ in levels]
longestCommonK = [[0 for j in kmerLen] for i in levels]
readCounter = 0

for posRead in posReadsPaths:
    if readCounter == readNum:
        break