| 48 | def __iter__(self): |
| 49 | return iter(self.x) |
| 50 | def __init__(self, path='generate_data/protein/generate1.txt', alphabet=Uniprot21()): |
| 51 | print('# loading array:', path, file=sys.stderr) |
| 52 | |
| 53 | sequences = self.load(path, alphabet) |
| 54 | # seq_data = [] |
| 55 | # for i in range(len(sequences)): |
| 56 | # x =alphabet.decode(sequences[i].astype('uint8')) |
| 57 | # seq_data.append(x.decode()) |
| 58 | # self.x = seq_data |
| 59 | self.x = [[alphabet.decode(seq.astype('uint8')).decode() for seq in sublist] for sublist in sequences] |
| 60 | print('# decode', len(self.x), 'sequences', file=sys.stderr) |
| 61 | |
| 62 | def load(self, path, alphabet): |
| 63 | data = np.loadtxt(path) |