comparison data.py @ 4:a609d6dc8047 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/rna_commander/tools/rna_tools/rna_commender commit 7ad344d108076116e702e1c1e91cea73d8fcadc4
author rnateam
date Thu, 28 Jul 2016 05:55:25 -0400
parents 8918de535391
children
comparison
equal deleted inserted replaced
3:ecf125a1ad73 4:a609d6dc8047
1 """Dataset handler.""" 1 """Dataset handler."""
2 2
3 import numpy as np 3 import numpy as np
4 4
5 import pandas as pd 5 import pandas as pd
6
7 from theano import config
8 6
9 __author__ = "Gianluca Corrado" 7 __author__ = "Gianluca Corrado"
10 __copyright__ = "Copyright 2016, Gianluca Corrado" 8 __copyright__ = "Copyright 2016, Gianluca Corrado"
11 __license__ = "MIT" 9 __license__ = "MIT"
12 __maintainer__ = "Gianluca Corrado" 10 __maintainer__ = "Gianluca Corrado"
28 Protein features 26 Protein features
29 27
30 fr : str 28 fr : str
31 The name of the HDF5 file containing features for the RNAs. 29 The name of the HDF5 file containing features for the RNAs.
32 """ 30 """
33 self.Fp = fp.astype(config.floatX) 31 self.Fp = fp.astype('float32')
34 32
35 store = pd.io.pytables.HDFStore(fr) 33 store = pd.io.pytables.HDFStore(fr)
36 self.Fr = store.features.astype(config.floatX) 34 self.Fr = store.features.astype('float32')
37 store.close() 35 store.close()
38 36
39 def load(self): 37 def load(self):
40 """Load dataset in memory.""" 38 """Load dataset in memory."""
41 raise NotImplementedError() 39 raise NotImplementedError()
72 70
73 """ 71 """
74 protein_input_dim = self.Fp.shape[0] 72 protein_input_dim = self.Fp.shape[0]
75 rna_input_dim = self.Fr.shape[0] 73 rna_input_dim = self.Fr.shape[0]
76 num_examples = self.Fp.shape[1] * self.Fr.shape[1] 74 num_examples = self.Fp.shape[1] * self.Fr.shape[1]
77 p = np.zeros((num_examples, protein_input_dim)).astype(config.floatX) 75 p = np.zeros((num_examples, protein_input_dim)).astype('float32')
78 p_names = [] 76 p_names = []
79 r = np.zeros((num_examples, rna_input_dim)).astype(config.floatX) 77 r = np.zeros((num_examples, rna_input_dim)).astype('float32')
80 r_names = [] 78 r_names = []
81 index = 0 79 index = 0
82 for protein in self.Fp.columns: 80 for protein in self.Fp.columns:
83 for rna in self.Fr.columns: 81 for rna in self.Fr.columns:
84 p[index] = self.Fp[protein] 82 p[index] = self.Fp[protein]