MCPcopy Create free account
hub / github.com/PKU-YuanGroup/TaxDiff / load

Method load

data_reader/decoder.py:62–90  ·  view source on GitHub ↗
(self, path, alphabet)

Source from the content-addressed store, hash-verified

60 print('# decode', len(self.x), 'sequences', file=sys.stderr)
61
62 def load(self, path, alphabet):
63 data = np.loadtxt(path)
64 data = data - np.ones(data.shape)
65 # sequence = []
66 # star = 0
67 # for i in range(data.shape[0]):
68 # where_zero = np.where(data[i] == -1)
69 # for j in range(np.size(where_zero)):
70 # end = where_zero[0][j]
71 # # sequence length fillter
72 # if end - star > 1:
73 # sequence[i].append(data[i][star:end])
74 # star = where_zero[0][j] + 1
75
76 sequence = [[] for _ in range(data.shape[0])]
77 for i in range(data.shape[0]):
78 star = 0
79 where_zero = np.where(data[i] == -1)[0]
80 for j in range(len(where_zero)):
81 end = where_zero[j]
82 # sequence length filter
83 if end - star > 1:
84 sequence[i].append(data[i][star:end])
85 star = end + 1
86 # Check for a sequence after the last -1
87 if data.shape[1] - star > 1:
88 sequence[i].append(data[i][star:])
89
90 return sequence
91
92def len_select(data):
93 min_length = 10

Callers 2

__init__Method · 0.95
find_modelFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected