├── 20171126-PNNL-AttentiveChrome.pdf ├── LICENSE ├── NIPS poster.pdf ├── OLD-v1LuaTorch ├── 1_data.lua ├── 1_data_eval.lua ├── 2_model.lua ├── 3_loss.lua ├── 4_train.lua ├── 5_test.lua ├── 6_eval.lua ├── 7_viz_alpha.lua ├── 8_viz_beta.lua ├── README.md ├── data │ └── toy │ │ ├── test.csv │ │ ├── train.csv │ │ └── valid.csv ├── doall.lua ├── doall_eval.lua └── util │ ├── LSTM.lua │ ├── ReverseSequence.lua │ └── auRoc.lua ├── README.md └── v2PyTorch ├── .gitignore ├── README.md ├── attentiveChrome_kipoi_tutorial.ipynb ├── data.py ├── data └── Toy │ └── classification │ ├── test.csv │ ├── train.csv │ └── valid.csv ├── evaluate.py ├── kipoiUtil ├── Models │ ├── E003 │ │ └── model.yaml │ ├── E004 │ │ └── model.yaml │ ├── E005 │ │ └── model.yaml │ ├── E006 │ │ └── model.yaml │ ├── E007 │ │ └── model.yaml │ ├── E011 │ │ └── model.yaml │ ├── E012 │ │ └── model.yaml │ ├── E013 │ │ └── model.yaml │ ├── E016 │ │ └── model.yaml │ ├── E024 │ │ └── model.yaml │ ├── E027 │ │ └── model.yaml │ ├── E028 │ │ └── model.yaml │ ├── E037 │ │ └── model.yaml │ ├── E038 │ │ └── model.yaml │ ├── E047 │ │ └── model.yaml │ ├── E050 │ │ └── model.yaml │ ├── E053 │ │ └── model.yaml │ ├── E054 │ │ └── model.yaml │ ├── E055 │ │ └── model.yaml │ ├── E056 │ │ └── model.yaml │ ├── E057 │ │ └── model.yaml │ ├── E058 │ │ └── model.yaml │ ├── E059 │ │ └── model.yaml │ ├── E061 │ │ └── model.yaml │ ├── E062 │ │ └── model.yaml │ ├── E065 │ │ └── model.yaml │ ├── E066 │ │ └── model.yaml │ ├── E070 │ │ └── model.yaml │ ├── E071 │ │ └── model.yaml │ ├── E079 │ │ └── model.yaml │ ├── E082 │ │ └── model.yaml │ ├── E084 │ │ └── model.yaml │ ├── E085 │ │ └── model.yaml │ ├── E087 │ │ └── model.yaml │ ├── E094 │ │ └── model.yaml │ ├── E095 │ │ └── model.yaml │ ├── E096 │ │ └── model.yaml │ ├── E097 │ │ └── model.yaml │ ├── E098 │ │ └── model.yaml │ ├── E100 │ │ └── model.yaml │ ├── E104 │ │ └── model.yaml │ ├── E105 │ │ └── model.yaml │ ├── E106 │ │ └── model.yaml │ ├── E109 │ │ └── model.yaml │ ├── E112 │ │ └── model.yaml │ ├── E113 │ │ └── model.yaml │ ├── E114 │ │ └── model.yaml │ ├── E116 │ │ └── model.yaml │ ├── E117 │ │ └── model.yaml │ ├── E118 │ │ └── model.yaml │ ├── E119 │ │ └── model.yaml │ ├── E120 │ │ └── model.yaml │ ├── E122 │ │ └── model.yaml │ ├── E123 │ │ └── model.yaml │ ├── E127 │ │ └── model.yaml │ └── E128 │ │ └── model.yaml ├── README.md ├── dataloader.py ├── dataloader.yaml ├── json_reader.py ├── model-template.yaml ├── models.py ├── models.tsv └── test_predict.py ├── models.py └── train.py /20171126-PNNL-AttentiveChrome.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QData/AttentiveChrome/ba0dda4bf67aa54b975de9bf8cfe1f49ba19981e/20171126-PNNL-AttentiveChrome.pdf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 QData 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NIPS poster.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QData/AttentiveChrome/ba0dda4bf67aa54b975de9bf8cfe1f49ba19981e/NIPS poster.pdf -------------------------------------------------------------------------------- /OLD-v1LuaTorch/1_data.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env th 2 | 3 | ------------------------------------------------------------------ 4 | -- This script loads the CSV file into a torch structure 5 | -- 6 | -- The input file is of the following format: 7 | -- GeneID, WindowNumber,Feature1, Feature 2,....., GeneExpression 8 | -- 9 | -- All values are numeric 10 | 11 | -- make sure you specify the number of windows for each gene in "local windows" 12 | 13 | -- Ritambhara Singh(rs3zz@virginia.edu) 14 | ------------------------------------------------------------------- 15 | require 'torch' 16 | require 'math' 17 | 18 | -- Read CSV file 19 | 20 | 21 | -- Change file name to "test.csv" from "valid.csv" while testing 22 | inFiles={opt.dataDir .. opt.dataset .. "/" .. "train.csv", opt.dataDir .. opt.dataset .. "/" .. "valid.csv"} 23 | 24 | trainset={} 25 | testset={} 26 | 27 | for f=1,2 do 28 | 29 | local filePath = inFiles[f] -- Input .csv file name 30 | print(filePath) 31 | local windows = 100 -- Specify number of windows per gene 32 | 33 | -- Count number of rows and columns in file 34 | 35 | local i = 0 36 | for line in io.lines(filePath) do 37 | if i == 0 then 38 | COLS = #line:split(',') 39 | end 40 | i = i + 1 41 | end 42 | 43 | --local ROWS = i-1 -- Use minus 1 if header present 44 | local MAXSTRLEN=100 45 | local ROWS = i 46 | local GENES = ROWS / windows 47 | 48 | print("Gene Count:",GENES) 49 | print ("Number of entries:",ROWS) 50 | print("Number of features:",COLS-3) 51 | 52 | 53 | --Read data from CSV to tensor 54 | 55 | local csvFile = io.open(filePath, 'r') 56 | --local header = csvFile:read() -- use if header present 57 | 58 | 59 | local i = 0 60 | local j = 1 61 | local len 62 | 63 | new_data={} 64 | local data={} 65 | local label 66 | local geneID 67 | for line in csvFile:lines('*l') do 68 | i=i+1 69 | local l = line:split(',') 70 | data[i]={} 71 | for key, val in ipairs(l) do 72 | --print(i,key,val) 73 | if key==1 then 74 | geneID=val 75 | elseif key==COLS then 76 | if tonumber(val)==0 then 77 | label=2 78 | else 79 | label=1 80 | end 81 | elseif key>2 and key<=COLS-1 then 82 | data[i][key-2]=val 83 | end 84 | end 85 | if i==windows then 86 | table.insert(new_data,{geneID=geneID,data=torch.DoubleTensor(data),label=label}) 87 | i=0 88 | j=j+1 89 | end 90 | end 91 | print("Read entries!!") 92 | csvFile:close() 93 | 94 | if f==1 then trainset=new_data else testset=new_data end 95 | 96 | end 97 | 98 | -------------------------End of Code ----------------------------------------- 99 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/1_data_eval.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env th 2 | 3 | ------------------------------------------------------------------ 4 | -- This script loads the CSV file into a torch structure 5 | -- 6 | -- The input file is of the following format: 7 | -- GeneID, WindowNumber,Feature1, Feature 2,....., GeneExpression 8 | -- 9 | -- All values are numeric 10 | 11 | -- make sure you specify the number of windows for each gene in "local windows" 12 | 13 | -- Ritambhara Singh (rs3zz@virginia.edu) 14 | ------------------------------------------------------------------- 15 | require 'torch' 16 | require 'math' 17 | 18 | -- Read CSV file 19 | 20 | 21 | -- Change file name to "test.csv" from "valid.csv" while testing 22 | inFiles={opt.dataDir .. opt.dataset .. "/" .. "train.csv", opt.dataDir .. opt.dataset .. "/" .. "test.csv"} 23 | 24 | trainset={} 25 | testset={} 26 | 27 | for f=1,2 do 28 | 29 | local filePath = inFiles[f] -- Input .csv file name 30 | print(filePath) 31 | local windows = 100 -- Specify number of windows per gene 32 | 33 | -- Count number of rows and columns in file 34 | 35 | local i = 0 36 | for line in io.lines(filePath) do 37 | if i == 0 then 38 | COLS = #line:split(',') 39 | end 40 | i = i + 1 41 | end 42 | 43 | --local ROWS = i-1 -- Use minus 1 if header present 44 | local MAXSTRLEN=100 45 | local ROWS = i 46 | local GENES = ROWS / windows 47 | 48 | print("Gene Count:",GENES) 49 | print ("Number of entries:",ROWS) 50 | print("Number of features:",COLS-3) 51 | 52 | 53 | --Read data from CSV to tensor 54 | 55 | local csvFile = io.open(filePath, 'r') 56 | --local header = csvFile:read() -- use if header present 57 | 58 | 59 | local i = 0 60 | local j = 1 61 | local len 62 | 63 | new_data={} 64 | local data={} 65 | local label 66 | local geneID 67 | for line in csvFile:lines('*l') do 68 | i=i+1 69 | local l = line:split(',') 70 | data[i]={} 71 | for key, val in ipairs(l) do 72 | --print(i,key,val) 73 | if key==1 then 74 | geneID=val 75 | elseif key==COLS then 76 | if tonumber(val)==0 then 77 | label=2 78 | else 79 | label=1 80 | end 81 | elseif key>2 and key<=COLS-1 then 82 | data[i][key-2]=val 83 | end 84 | end 85 | if i==windows then 86 | table.insert(new_data,{geneID=geneID,data=torch.DoubleTensor(data),label=label}) 87 | i=0 88 | j=j+1 89 | end 90 | end 91 | print("Read entries!!") 92 | csvFile:close() 93 | 94 | if f==1 then trainset=new_data else testset=new_data end 95 | 96 | end 97 | 98 | -------------------------End of Code ----------------------------------------- 99 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/2_model.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- NN model 3 | 4 | --------------------------------------------------------------------- 5 | require 'torch' -- torch 6 | require 'image' -- for image transforms 7 | require 'nn' -- provides all sorts of trainable modules/layers 8 | require 'math' 9 | require 'torch' 10 | require 'nn' 11 | require './util/LSTM' 12 | require './util/ReverseSequence' 13 | 14 | print '==>AttentiveChrome Classification Model' 15 | print '==> define parameters' 16 | 17 | -- Classification problem 18 | noutputs = 2 19 | 20 | rnn_size = opt.rnn_size 21 | filtsize = opt.cnn_size 22 | poolsize = opt.cnn_pool 23 | 24 | -- input dimensions 25 | nfeats=5 26 | width = 100 27 | ninputs = nfeats*width 28 | 29 | 30 | -- hidden units, filter sizes (for CNN) 31 | nstates = {50,625,125} 32 | padding = math.floor(filtsize/2) 33 | ---------------------------------------------------------------------- 34 | 35 | local function create_lstm(ipsize,rnn_size,len,reverse) 36 | local lstm = nn.Sequential() 37 | 38 | if reverse then lstm:add(nn.ReverseSequence(2,opt.gpu)) end 39 | 40 | local rnn = nn.LSTM(ipsize, rnn_size) 41 | rnn.remember_states = false 42 | 43 | lstm:add(rnn) 44 | lstm:add(nn.Dropout(0.5)) 45 | if opt.model=="rnn" or opt.model=="cnn-rnn" then 46 | lstm:add(nn.Select(2,len)) 47 | end 48 | 49 | if reverse then lstm:add(nn.ReverseSequence(2,opt.gpu)) end 50 | 51 | return lstm 52 | end 53 | 54 | ----------------------------------------------------------------------- 55 | 56 | local function create_attention_rnn(ipsize,rnn_size,len) 57 | 58 | 59 | local RNN = nn.Sequential() 60 | 61 | fwd = create_lstm(ipsize,rnn_size,len,false) 62 | bwd = create_lstm(ipsize,rnn_size,len,true) 63 | 64 | local concat = nn.ConcatTable() 65 | local output_size 66 | 67 | if opt.unidirectional=="true" then 68 | concat:add(fwd) -- ConcatTable for consistency w/ b-lstm 69 | output_size = rnn_size 70 | RNN:add(concat) 71 | RNN:add(nn.JoinTable(2)) 72 | 73 | else 74 | concat:add(fwd) 75 | concat:add(bwd) 76 | output_size = rnn_size*2 77 | RNN:add(concat) 78 | RNN:add(nn.JoinTable(3)) 79 | end 80 | 81 | 82 | 83 | local opsize=output_size 84 | 85 | local u_i = nn.Sequential() 86 | local h_i= nn.Sequential() 87 | 88 | local h_i1= nn.SplitTable(2) 89 | local h_i2=nn.Identity() 90 | 91 | 92 | u_i:add(h_i1) 93 | 94 | local alpha=nn.MapTable() 95 | alpha:add(nn.Linear(opsize,1,false)) 96 | 97 | u_i:add(alpha) 98 | u_i:add(nn.JoinTable(2)) 99 | u_i:add(nn.SoftMax()) 100 | u_i:add(nn.Replicate(opsize,3)) 101 | u_i:add(nn.Select(1,1)) 102 | 103 | h_i:add(h_i2) 104 | h_i:add(nn.Select(1,1)) 105 | 106 | s_i=nn.ConcatTable() 107 | s_i:add(u_i) 108 | s_i:add(h_i) 109 | 110 | 111 | local attention=nn.Sequential() 112 | attention:add(nn.Reshape(len,ipsize)) 113 | attention:add(RNN) 114 | attention:add(h_i2) 115 | attention:add(s_i) 116 | attention:add(nn.CMulTable()) 117 | attention:add(nn.Sum(1)) 118 | 119 | return attention 120 | end 121 | 122 | --------------------------------------------------------------------------- 123 | 124 | 125 | 126 | 127 | 128 | ----------------------------------------------------------------- 129 | 130 | print '==> construct model' 131 | 132 | model = nn.Sequential() 133 | 134 | 135 | if opt.model=="mlp" then 136 | 137 | --Baseline model 138 | 139 | -- a typical MLP 140 | 141 | ninputs=width*nfeats 142 | model:add(nn.Reshape(ninputs)) 143 | 144 | model:add(nn.Linear(ninputs, nstates[3])) 145 | model:add(nn.Dropout(0.5)) 146 | 147 | model:add(nn.ReLU()) 148 | model:add(nn.Linear(nstates[3], nstates[1])) 149 | 150 | model:add(nn.ReLU()) 151 | model:add(nn.Linear(nstates[1], noutputs)) 152 | 153 | elseif opt.model=="cnn" then 154 | 155 | --CNN model 156 | 157 | -- a typical modern convolution network (conv+relu+pool) 158 | 159 | -- stage 1 : filter bank -> squashing -> Max pooling 160 | model:add(nn.TemporalConvolution(nfeats, nstates[1], filtsize)) 161 | model:add(nn.ReLU()) 162 | model:add(nn.TemporalMaxPooling(poolsize)) 163 | 164 | -- stage 2 : standard 2-layer neural network 165 | model:add(nn.View(math.ceil((width-filtsize)/poolsize)*nstates[1])) 166 | model:add(nn.Dropout(0.5)) 167 | model:add(nn.Linear(math.ceil((width-filtsize)/poolsize)*nstates[1], nstates[2])) 168 | 169 | 170 | model:add(nn.ReLU()) 171 | model:add(nn.Linear(nstates[2], nstates[3])) 172 | 173 | model:add(nn.ReLU()) 174 | model:add(nn.Linear(nstates[3], noutputs)) 175 | 176 | elseif opt.model=="rnn" then 177 | 178 | -- RNN model 179 | 180 | local RNN = nn.Sequential() 181 | 182 | fwd = create_lstm(nfeats,rnn_size,width,false) 183 | bwd = create_lstm(nfeats,rnn_size,width,true) 184 | 185 | local concat = nn.ConcatTable() 186 | local output_size 187 | 188 | if opt.unidirectional=="true" then 189 | concat:add(fwd) -- ConcatTable for consistency w/ b-lstm 190 | output_size = rnn_size 191 | else 192 | concat:add(fwd) 193 | concat:add(bwd) 194 | output_size = rnn_size*2 195 | end 196 | 197 | RNN:add(concat) 198 | RNN:add(nn.JoinTable(2)) 199 | 200 | model:add(RNN) 201 | 202 | model:add(nn.Linear(output_size, noutputs)) 203 | 204 | 205 | elseif opt.model=="rnn-attention" then 206 | 207 | -- RNN-Attention model 208 | 209 | model:add(create_attention_rnn(nfeats,rnn_size,width)) 210 | 211 | model:add(nn.Linear(1, noutputs)) 212 | 213 | 214 | elseif opt.model=="rnn-hie-attention" then 215 | 216 | -- RNN-Hierarchical Attention model 217 | 218 | local word=nn.Parallel(3,1) 219 | for i=1,nfeats,1 do 220 | word:add(create_attention_rnn(1,rnn_size,width)) 221 | end 222 | 223 | model:add(word) 224 | model:add(nn.View(nfeats*rnn_size*2)) 225 | model:add(nn.Linear(nfeats*rnn_size*2, noutputs)) 226 | 227 | end 228 | 229 | 230 | function model_resetStates() 231 | 232 | if opt.unidirectional=="true" then 233 | fwd:get(1):resetStates() 234 | else 235 | fwd:get(1):resetStates() 236 | bwd:get(2):resetStates() 237 | end 238 | end 239 | 240 | 241 | 242 | ---------------------------------------------------------------------- 243 | print '==> here is the model:' 244 | print(model) 245 | 246 | ---------------------------------------------------------------------- 247 | 248 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/3_loss.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script defines following loss function : 3 | -- 4 | -- + negative-log likelihood, using log-normalized output units (SoftMax) 5 | 6 | -- 7 | -- Ritambhara Singh 8 | ---------------------------------------------------------------------- 9 | 10 | require 'torch' -- torch 11 | require 'nn' -- provides all sorts of loss functions 12 | 13 | ---------------------------------------------------------------------- 14 | 15 | -- classification problem 16 | 17 | noutputs = 2 18 | 19 | ---------------------------------------------------------------------- 20 | print '==> define loss' 21 | 22 | model:add(nn.LogSoftMax()) 23 | criterion = nn.ClassNLLCriterion() 24 | 25 | ---------------------------------------------------------------------- 26 | print '==> here is the loss function:' 27 | print(criterion) 28 | 29 | --------------------------- End of Code ------------------------------- 30 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/4_train.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script defines training procedure, 3 | -- irrespective of the model/loss functions chosen. 4 | -- 5 | -- It is used to 6 | 7 | -- + define a closure to estimate (a noisy) loss 8 | -- function, as well as its derivatives wrt the parameters of the 9 | -- model to be trained 10 | -- + optimize the function, according to: SGD 11 | -- 12 | -- Ritambhara Singh 13 | ---------------------------------------------------------------------- 14 | 15 | require 'torch' -- torch 16 | require 'xlua' -- xlua provides useful tools, like progress bars 17 | require 'optim' -- an optimization package, for online and batch methods 18 | include('util/auRoc.lua') 19 | require 'nn' 20 | require 'lfs' 21 | ---------------------------------------------------------------------- 22 | 23 | print '==> loading data' 24 | 25 | traindataset={} 26 | function traindataset:size() return opt.trsize end 27 | 28 | for i=1,traindataset:size() do 29 | local input = trainset[i].data; 30 | local output = trainset[i].label; 31 | traindataset[i] = {input, output} 32 | end 33 | 34 | testdataset={} 35 | function testdataset:size() return opt.tssize end 36 | 37 | for i=1,testdataset:size() do 38 | local input = testset[i].data; 39 | local output = testset[i].label; 40 | testdataset[i] = {input, output} 41 | end 42 | ------------------------------------------------------------------------------ 43 | 44 | print '==> defining some tools' 45 | 46 | --classes 47 | 48 | classes = {'1','2'} 49 | 50 | 51 | local AUC = auRoc:new() 52 | local AUC_target=1 53 | 54 | filePath=opt.resultsDir .. opt.dataset 55 | 56 | -- Log results to files 57 | trainLogger = optim.Logger(paths.concat(filePath,opt.model .. '.train.log')) 58 | testLogger = optim.Logger(paths.concat(filePath,opt.model .. '.test.log')) 59 | 60 | -- Retrieve parameters and gradients: 61 | -- this extracts and flattens all the trainable parameters of the mode 62 | -- into a 1-dim vector 63 | 64 | model:type(dtype) 65 | criterion:type(dtype) 66 | 67 | 68 | if model then 69 | parameters,gradParameters = model:getParameters() 70 | end 71 | 72 | ---------------------------------------------------------------------- 73 | print '==> configuring optimizer : SGD' 74 | 75 | 76 | optimState = { 77 | learningRate = opt.learningRate, 78 | weightDecay = opt.weightDecay, 79 | momentum = opt.momentum, 80 | learningRateDecay = 1e-7 81 | } 82 | optimMethod = optim.sgd 83 | 84 | ---------------------------------------------------------------------- 85 | print '==> defining training procedure' 86 | 87 | function train() 88 | 89 | -- epoch tracker 90 | epoch = epoch or 1 91 | 92 | -- local vars 93 | local time = sys.clock() 94 | 95 | -- set model to training mode (for modules that differ in training and testing, like Dropout) 96 | 97 | if opt.model=="rnn" or opt.model=="rnn-attention" then model_resetStates() end 98 | model:training() 99 | 100 | -- training size 101 | trsize=traindataset:size() 102 | 103 | -- shuffle at each epoch 104 | shuffle = torch.randperm(trsize) 105 | 106 | -- do one epoch 107 | print('==> doing epoch on training data:') 108 | 109 | for t=1,trsize,opt.batchSize do 110 | -- disp progress 111 | xlua.progress(t, traindataset:size()) 112 | 113 | if opt.model=="rnn" or opt.model=="rnn-attention" then model_resetStates() end 114 | local input = traindataset[shuffle[t]][1]:type(dtype) 115 | local target = traindataset[shuffle[t]][2] 116 | 117 | -- create closure to evaluate f(X) and df/dX 118 | local feval = function(x) 119 | -- get new parameters 120 | if x ~= parameters then 121 | parameters:copy(x) 122 | end 123 | 124 | -- reset gradients 125 | gradParameters:zero() 126 | 127 | 128 | -- estimate f 129 | input_reshape=torch.reshape(input,opt.batchSize,width,nfeats):type(dtype) 130 | local output = model:forward(input_reshape) 131 | --print(output) 132 | 133 | f = criterion:forward(output,target) 134 | 135 | 136 | -- estimate df/dW 137 | local df_do = criterion:backward(output,target) 138 | 139 | model:backward(input_reshape, df_do) 140 | 141 | -- clip gradients 142 | if opt.grad_clip > 0 then 143 | gradParameters:clamp(-opt.grad_clip, opt.grad_clip) 144 | end 145 | 146 | score=torch.reshape(output,opt.batchSize,2):type(dtype) 147 | 148 | auc_in = score[{{1,score:size(1)},{1,1}}]:reshape(score:size(1)) 149 | for i = 1,auc_in:size(1) do 150 | if target == 2 then AUC_target=-1 else AUC_target=1 end 151 | AUC:add(math.exp(auc_in[i]), AUC_target) 152 | end 153 | 154 | -- return f and df/dX 155 | return f,gradParameters 156 | end 157 | optimMethod(feval, parameters, optimState) 158 | end 159 | 160 | 161 | -- time taken 162 | time = sys.clock() - time 163 | time = time / traindataset:size() 164 | print("\n==> time to learn 1 sample = " .. (time*1000) .. 'ms') 165 | 166 | 167 | --Calculate and print AUC score 168 | local AUROC = AUC:calculateAuc() 169 | print(' + AUROC: '..AUROC) 170 | 171 | -- save/log current net 172 | local modelname = ('model.' .. opt.model .. '.' .. epoch .. '.net') 173 | local filename = paths.concat(filePath, modelname) 174 | os.execute('mkdir -p ' .. sys.dirname(filename)) 175 | print('==> saving model to '..filename) 176 | torch.save(filename, model) 177 | 178 | 179 | trainLogger:add{['AUC Score (train set)'] = AUROC} 180 | 181 | -- next epoch 182 | AUC:zero() 183 | 184 | epoch = epoch + 1 185 | end 186 | 187 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/5_test.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script implements a test procedure, to report accuracy 3 | -- on the test data. 4 | -- 5 | -- Ritambhara Singh 6 | ---------------------------------------------------------------------- 7 | 8 | require 'torch' -- torch 9 | require 'xlua' -- xlua provides useful tools, like progress bars 10 | require 'optim' -- an optimization package, for online and batch methods 11 | include('util/auRoc.lua') 12 | require 'lfs' 13 | require 'nn' 14 | ---------------------------------------------------------------------- 15 | print '==> defining test procedure' 16 | 17 | local AUC = auRoc:new() 18 | local AUC_target=1 19 | 20 | -- test function 21 | function test() 22 | -- local vars 23 | local time = sys.clock() 24 | 25 | -- averaged param use? 26 | if average then 27 | cachedparams = parameters:clone() 28 | parameters:copy(average) 29 | end 30 | 31 | if opt.model=="rnn" or opt.model=="rnn-attention" or opt.model=="rnn-hie-attention" then model_resetStates() end 32 | 33 | -- set model to evaluate mode (for modules that differ in training and testing, like Dropout) 34 | model:evaluate() 35 | 36 | -- test over test data 37 | print('==> testing on test set:') 38 | for t = 1,testdataset:size(),opt.batchSize do 39 | -- disp progress 40 | xlua.progress(t, testdataset:size()) 41 | 42 | -- get new sample 43 | local input = testdataset[t][1]:type(dtype) 44 | local target = testdataset[t][2] 45 | 46 | -- test sample 47 | if opt.model=="rnn" or opt.model=="rnn-attention" or opt.model=="rnn-hie-attention" then model_resetStates() end 48 | input_reshape=torch.reshape(input,opt.batchSize,width,nfeats):type(dtype) 49 | local pred = model:forward(input_reshape) 50 | 51 | score=torch.reshape(pred,opt.batchSize,2):type(dtype) 52 | 53 | auc_in = score[{{1,score:size(1)},{1,1}}]:reshape(score:size(1)) 54 | for i = 1,auc_in:size(1) do 55 | if target == 2 then AUC_target=-1 else AUC_target=1 end 56 | AUC:add(math.exp(auc_in[i]), AUC_target) 57 | end 58 | 59 | 60 | end 61 | 62 | -- timing 63 | time = sys.clock() - time 64 | time = time / testdataset:size() 65 | print("\n==> time to test 1 sample = " .. (time*1000) .. 'ms') 66 | 67 | --print AUC score 68 | local AUROC = AUC:calculateAuc() 69 | print(' + AUROC: '..AUROC) 70 | 71 | 72 | -- update log 73 | testLogger:add{['AUC Score (test set)'] = AUROC} 74 | 75 | 76 | -- averaged param use? 77 | if average then 78 | -- restore parameters 79 | parameters:copy(cachedparams) 80 | end 81 | 82 | -- next iteration: 83 | AUC:zero() 84 | end 85 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/6_eval.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script implements a test procedure, to report accuracy 3 | -- on the test data. 4 | -- 5 | -- Ritambhara Singh 6 | ---------------------------------------------------------------------- 7 | 8 | require 'torch' -- torch 9 | require 'xlua' -- xlua provides useful tools, like progress bars 10 | require 'optim' -- an optimization package, for online and batch methods 11 | include('util/auRoc.lua') 12 | require './util/LSTM' 13 | require './util/ReverseSequence' 14 | require 'lfs' 15 | require 'nn' 16 | ---------------------------------------------------------------------- 17 | print '==> loading data' 18 | 19 | width=100 20 | nfeats=5 21 | 22 | testdataset={} 23 | function testdataset:size() return opt.tssize end 24 | 25 | for i=1,testdataset:size() do 26 | local input = testset[i].data; 27 | local output = testset[i].label; 28 | testdataset[i] = {input, output} 29 | end 30 | 31 | print '==> defining some tools' 32 | 33 | --classes 34 | 35 | classes = {'1','2'} 36 | 37 | filePath=opt.resultsDir .. opt.dataset 38 | 39 | print '==> defining test procedure' 40 | local AUC = auRoc:new() 41 | local AUC_target=1 42 | 43 | -- Log results to files 44 | testLogger = optim.Logger(paths.concat(filePath,opt.model .. '.test-best.log')) 45 | 46 | print '==> loading model' 47 | epoch=opt.epoch 48 | local modelname = ('model.' .. opt.model .. '.' .. opt.epoch .. '.net') 49 | local filename = paths.concat(filePath, modelname) 50 | model = torch.load(filename) 51 | 52 | -- test function 53 | function test() 54 | -- local vars 55 | local time = sys.clock() 56 | 57 | -- averaged param use? 58 | if average then 59 | cachedparams = parameters:clone() 60 | parameters:copy(average) 61 | end 62 | 63 | -- set model to evaluate mode (for modules that differ in training and testing, like Dropout) 64 | model:evaluate() 65 | 66 | -- test over test data 67 | print('==> testing on test set:') 68 | for t = 1,testdataset:size(),opt.batchSize do 69 | -- disp progress 70 | xlua.progress(t, testdataset:size()) 71 | 72 | -- get new sample 73 | local input = testdataset[t][1]:type(dtype) 74 | local target = testdataset[t][2] 75 | 76 | -- test sample 77 | input_reshape=torch.reshape(input,opt.batchSize,width,nfeats):type(dtype) 78 | local pred = model:forward(input_reshape) 79 | 80 | score=torch.reshape(pred,opt.batchSize,2):type(dtype) 81 | 82 | auc_in = score[{{1,score:size(1)},{1,1}}]:reshape(score:size(1)) 83 | for i = 1,auc_in:size(1) do 84 | if target == 2 then AUC_target=-1 else AUC_target=1 end 85 | AUC:add(math.exp(auc_in[i]), AUC_target) 86 | end 87 | 88 | 89 | end 90 | 91 | -- timing 92 | time = sys.clock() - time 93 | time = time / testdataset:size() 94 | print("\n==> time to test 1 sample = " .. (time*1000) .. 'ms') 95 | 96 | --print AUC score 97 | local AUROC = AUC:calculateAuc() 98 | print(' + AUROC: '..AUROC) 99 | 100 | 101 | -- update log 102 | testLogger:add{['AUC Score (test set)'] = AUROC} 103 | 104 | 105 | -- averaged param use? 106 | if average then 107 | -- restore parameters 108 | parameters:copy(cachedparams) 109 | end 110 | 111 | -- next iteration: 112 | AUC:zero() 113 | end 114 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/7_viz_alpha.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script implements a test procedure, to report accuracy 3 | -- on the test data. 4 | -- 5 | -- Ritambhara Singh 6 | ---------------------------------------------------------------------- 7 | 8 | 9 | print '==> loading data' 10 | 11 | width=100 12 | nfeats=5 13 | 14 | testdataset={} 15 | function testdataset:size() return opt.tssize end 16 | 17 | for i=1,testdataset:size() do 18 | local input = testset[i].data; 19 | local output = testset[i].label; 20 | testdataset[i] = {input, output} 21 | end 22 | 23 | print '==> defining some tools' 24 | 25 | --classes 26 | 27 | classes = {'1','2'} 28 | 29 | filePath=opt.resultsDir .. opt.dataset 30 | 31 | 32 | print '==> loading model' 33 | epoch=opt.epoch 34 | local modelname = ('model.' .. opt.model .. '.' .. opt.epoch .. '.net') 35 | local filename = paths.concat(filePath, modelname) 36 | model = torch.load(filename) 37 | 38 | -- removing layers to print out alpha attention layer output 39 | alpha_model=model:clone() 40 | 41 | alpha_model:remove(4) 42 | alpha_model:remove(3) 43 | alpha_model:remove(2) 44 | 45 | m1=alpha_model.modules[1] 46 | 47 | 48 | for i=1,nfeats,1 do 49 | 50 | m2=m1.modules[i] 51 | m2:remove(6) 52 | m2:remove(5) 53 | 54 | m3=m2.modules[4] 55 | m3.modules[2]=nil 56 | m4=m3.modules[1] 57 | m4:remove(6) 58 | m4:remove(5) 59 | m2.modules[4]=nil 60 | m2:add(m4) 61 | end 62 | 63 | print(alpha_model) 64 | 65 | -- test function 66 | function viz_alpha() 67 | -- local vars 68 | -- local time = sys.clock() 69 | 70 | -- averaged param use? 71 | if average then 72 | cachedparams = parameters:clone() 73 | parameters:copy(average) 74 | end 75 | 76 | -- set model to evaluate mode (for modules that differ in training and testing, like Dropout) 77 | model:evaluate() 78 | alpha_model:evaluate() 79 | 80 | -- test over test data 81 | print('==> testing on test set:') 82 | for t = 1,testdataset:size(),opt.batchSize do 83 | -- disp progress 84 | xlua.progress(t, testdataset:size()) 85 | 86 | -- get new sample 87 | local input = testdataset[t][1]:type(dtype) 88 | local target = testdataset[t][2] 89 | 90 | -- test sample 91 | input_reshape=torch.reshape(input,opt.batchSize,width,nfeats):type(dtype) 92 | 93 | 94 | local alpha = alpha_model:forward(input_reshape) 95 | -- print alpha-attention output 96 | print(alpha) 97 | 98 | end 99 | 100 | end 101 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/8_viz_beta.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script implements a test procedure, to report accuracy 3 | -- on the test data. 4 | -- 5 | -- Ritambhara Singh 6 | ---------------------------------------------------------------------- 7 | 8 | print '==> loading data' 9 | 10 | width=100 11 | nfeats=5 12 | 13 | testdataset={} 14 | function testdataset:size() return opt.tssize end 15 | 16 | for i=1,testdataset:size() do 17 | local input = testset[i].data; 18 | local output = testset[i].label; 19 | testdataset[i] = {input, output} 20 | end 21 | 22 | print '==> defining some tools' 23 | 24 | --classes 25 | 26 | classes = {'1','2'} 27 | 28 | filePath=opt.resultsDir .. opt.dataset 29 | 30 | 31 | print '==> loading model' 32 | epoch=opt.epoch 33 | local modelname = ('model.' .. opt.model .. '.' .. opt.epoch .. '.net') 34 | local filename = paths.concat(filePath, modelname) 35 | model = torch.load(filename) 36 | 37 | -- removing layers to print out beta attention layer output 38 | beta_model=model:clone() 39 | 40 | beta_model:remove(4) 41 | beta_model:remove(3) 42 | beta_model:remove(2) 43 | beta_model:add(nn.Reshape(nfeats,opt.rnn_size*2)):type(dtype) 44 | beta_model:add(nn.Mean(2)):type(dtype) 45 | 46 | 47 | 48 | print(beta_model) 49 | 50 | -- test function 51 | function viz_beta() 52 | -- local vars 53 | -- local time = sys.clock() 54 | 55 | -- averaged param use? 56 | if average then 57 | cachedparams = parameters:clone() 58 | parameters:copy(average) 59 | end 60 | 61 | -- set model to evaluate mode (for modules that differ in training and testing, like Dropout) 62 | beta_model:evaluate() 63 | 64 | -- test over test data 65 | print('==> testing on test set:') 66 | for t = 1,testdataset:size(),opt.batchSize do 67 | -- disp progress 68 | xlua.progress(t, testdataset:size()) 69 | 70 | -- get new sample 71 | local input = testdataset[t][1]:type(dtype) 72 | local target = testdataset[t][2] 73 | 74 | -- test sample 75 | input_reshape=torch.reshape(input,opt.batchSize,width,nfeats):type(dtype) 76 | 77 | local beta = beta_model:forward(input_reshape) 78 | -- print beta-attention output 79 | print(beta) 80 | 81 | end 82 | 83 | end 84 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/README.md: -------------------------------------------------------------------------------- 1 | 2 | A toy dataset has been provided inside "code/data" folder. 3 | 4 | After downloading "code/" folder: 5 | 6 | To perform training : 7 | ``` 8 | th doall.lua 9 | ``` 10 | To perform testing/Get visualization output: 11 | ``` 12 | the doall_eval.lua 13 | ``` 14 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/data/toy/test.csv: -------------------------------------------------------------------------------- 1 | 172936,1,0,6,1,2,0,0 2 | 172936,2,0,10,1,0,2,0 3 | 172936,3,0,12,1,0,3,0 4 | 172936,4,0,13,0,2,2,0 5 | 172936,5,0,4,0,4,4,0 6 | 172936,6,0,11,1,2,3,0 7 | 172936,7,1,9,1,2,0,0 8 | 172936,8,5,8,2,0,1,0 9 | 172936,9,2,8,1,6,2,0 10 | 172936,10,5,7,1,4,1,0 11 | 172936,11,2,5,0,2,1,0 12 | 172936,12,0,3,2,0,1,0 13 | 172936,13,2,8,2,2,1,0 14 | 172936,14,1,5,0,2,0,0 15 | 172936,15,2,2,2,2,2,0 16 | 172936,16,4,2,1,4,4,0 17 | 172936,17,2,1,0,6,0,0 18 | 172936,18,3,2,3,2,0,0 19 | 172936,19,0,1,3,0,0,0 20 | 172936,20,2,1,4,2,1,0 21 | 172936,21,2,1,4,2,2,0 22 | 172936,22,2,2,1,8,0,0 23 | 172936,23,1,3,5,12,1,0 24 | 172936,24,0,1,6,18,1,0 25 | 172936,25,0,3,4,20,0,0 26 | 172936,26,3,4,10,38,3,0 27 | 172936,27,3,2,9,60,3,0 28 | 172936,28,1,1,1,52,1,0 29 | 172936,29,0,1,4,88,0,0 30 | 172936,30,0,1,4,204,0,0 31 | 172936,31,1,2,3,272,2,0 32 | 172936,32,4,1,0,302,3,0 33 | 172936,33,4,2,0,336,1,0 34 | 172936,34,3,2,0,258,0,0 35 | 172936,35,4,1,3,288,0,0 36 | 172936,36,3,0,1,218,2,0 37 | 172936,37,1,2,2,84,0,0 38 | 172936,38,2,1,1,28,0,0 39 | 172936,39,2,0,0,20,1,0 40 | 172936,40,0,1,2,60,1,0 41 | 172936,41,0,3,3,124,2,0 42 | 172936,42,1,1,6,104,2,0 43 | 172936,43,2,1,14,70,1,0 44 | 172936,44,2,1,14,58,1,0 45 | 172936,45,4,2,16,46,1,0 46 | 172936,46,1,1,13,46,2,0 47 | 172936,47,3,2,27,38,2,0 48 | 172936,48,8,3,21,62,1,0 49 | 172936,49,9,0,22,88,3,0 50 | 172936,50,7,1,4,118,5,0 51 | 172936,51,8,0,7,98,1,0 52 | 172936,52,2,0,5,108,2,0 53 | 172936,53,2,0,1,238,3,0 54 | 172936,54,5,1,1,294,2,0 55 | 172936,55,3,1,6,304,4,0 56 | 172936,56,7,2,4,212,4,0 57 | 172936,57,3,0,3,158,1,0 58 | 172936,58,2,1,3,134,1,0 59 | 172936,59,7,0,7,134,0,0 60 | 172936,60,1,2,15,82,2,0 61 | 172936,61,6,3,12,50,2,0 62 | 172936,62,6,3,18,26,1,0 63 | 172936,63,6,3,11,14,1,0 64 | 172936,64,2,1,6,16,4,0 65 | 172936,65,5,2,5,12,3,0 66 | 172936,66,4,2,8,6,1,0 67 | 172936,67,4,6,3,2,1,0 68 | 172936,68,1,5,8,2,3,0 69 | 172936,69,2,7,9,4,2,0 70 | 172936,70,4,8,11,6,4,0 71 | 172936,71,3,0,12,6,2,0 72 | 172936,72,4,4,12,10,0,0 73 | 172936,73,2,3,4,2,1,0 74 | 172936,74,3,4,4,4,4,0 75 | 172936,75,2,9,5,0,3,0 76 | 172936,76,2,17,5,0,0,0 77 | 172936,77,2,15,5,2,2,0 78 | 172936,78,2,13,2,0,3,0 79 | 172936,79,3,18,2,0,0,0 80 | 172936,80,2,10,1,2,1,0 81 | 172936,81,1,10,0,4,4,0 82 | 172936,82,3,15,2,2,1,0 83 | 172936,83,1,16,3,6,2,0 84 | 172936,84,3,11,6,4,3,0 85 | 172936,85,0,3,4,0,1,0 86 | 172936,86,4,7,1,2,1,0 87 | 172936,87,3,11,3,0,1,0 88 | 172936,88,3,7,0,2,2,0 89 | 172936,89,3,8,1,0,1,0 90 | 172936,90,1,6,3,0,0,0 91 | 172936,91,1,6,0,2,0,0 92 | 172936,92,0,7,2,0,2,0 93 | 172936,93,2,4,1,2,2,0 94 | 172936,94,3,4,1,0,1,0 95 | 172936,95,1,4,1,2,0,0 96 | 172936,96,1,2,2,2,1,0 97 | 172936,97,3,0,1,0,3,0 98 | 172936,98,3,3,2,2,3,0 99 | 172936,99,0,4,0,0,1,0 100 | 172936,100,0,2,2,0,0,0 101 | 172938,1,2,1,1,6,1,0 102 | 172938,2,2,2,7,2,1,0 103 | 172938,3,2,0,6,2,1,0 104 | 172938,4,0,2,2,6,2,0 105 | 172938,5,0,0,4,4,0,0 106 | 172938,6,1,1,5,2,2,0 107 | 172938,7,0,3,2,2,2,0 108 | 172938,8,1,2,2,6,1,0 109 | 172938,9,1,2,2,4,1,0 110 | 172938,10,1,1,3,0,1,0 111 | 172938,11,0,0,4,0,1,0 112 | 172938,12,1,0,2,0,1,0 113 | 172938,13,1,0,0,0,1,0 114 | 172938,14,1,0,0,0,0,0 115 | 172938,15,1,0,2,0,0,0 116 | 172938,16,3,0,0,0,2,0 117 | 172938,17,1,1,0,0,3,0 118 | 172938,18,4,1,0,2,2,0 119 | 172938,19,5,1,6,2,1,0 120 | 172938,20,1,1,8,2,2,0 121 | 172938,21,1,1,3,0,1,0 122 | 172938,22,0,0,1,2,0,0 123 | 172938,23,4,0,1,0,2,0 124 | 172938,24,9,0,3,0,3,0 125 | 172938,25,5,1,2,0,2,0 126 | 172938,26,7,0,1,4,1,0 127 | 172938,27,8,0,1,2,3,0 128 | 172938,28,4,0,2,0,1,0 129 | 172938,29,1,1,2,0,1,0 130 | 172938,30,5,0,3,4,2,0 131 | 172938,31,4,0,5,4,2,0 132 | 172938,32,5,1,4,0,3,0 133 | 172938,33,1,0,5,2,4,0 134 | 172938,34,2,3,6,0,3,0 135 | 172938,35,2,3,9,4,3,0 136 | 172938,36,1,3,10,0,1,0 137 | 172938,37,5,0,10,0,1,0 138 | 172938,38,4,1,8,0,0,0 139 | 172938,39,4,2,1,0,0,0 140 | 172938,40,3,0,6,2,1,0 141 | 172938,41,2,0,4,4,2,0 142 | 172938,42,2,0,3,2,0,0 143 | 172938,43,3,2,5,2,4,0 144 | 172938,44,2,1,6,6,3,0 145 | 172938,45,1,0,2,2,1,0 146 | 172938,46,5,1,0,0,3,0 147 | 172938,47,7,0,0,6,2,0 148 | 172938,48,5,1,4,6,1,0 149 | 172938,49,5,1,4,0,2,0 150 | 172938,50,3,1,2,2,2,0 151 | 172938,51,2,1,3,8,2,0 152 | 172938,52,2,0,2,2,2,0 153 | 172938,53,1,0,2,0,1,0 154 | 172938,54,1,1,0,2,0,0 155 | 172938,55,3,1,2,4,2,0 156 | 172938,56,3,2,3,0,1,0 157 | 172938,57,2,1,2,4,2,0 158 | 172938,58,2,0,1,0,4,0 159 | 172938,59,1,1,4,2,8,0 160 | 172938,60,3,1,3,2,3,0 161 | 172938,61,1,2,0,0,3,0 162 | 172938,62,4,1,0,0,5,0 163 | 172938,63,2,1,2,2,6,0 164 | 172938,64,0,2,1,0,2,0 165 | 172938,65,1,2,0,0,0,0 166 | 172938,66,0,0,1,0,0,0 167 | 172938,67,1,0,1,0,2,0 168 | 172938,68,1,1,0,0,1,0 169 | 172938,69,2,0,1,4,2,0 170 | 172938,70,0,1,0,0,1,0 171 | 172938,71,0,2,0,2,0,0 172 | 172938,72,1,0,0,2,1,0 173 | 172938,73,0,0,0,2,1,0 174 | 172938,74,2,0,0,2,0,0 175 | 172938,75,2,2,1,2,0,0 176 | 172938,76,0,1,2,0,1,0 177 | 172938,77,1,0,2,4,0,0 178 | 172938,78,0,0,2,2,0,0 179 | 172938,79,1,1,1,0,1,0 180 | 172938,80,4,0,3,2,2,0 181 | 172938,81,3,1,1,2,2,0 182 | 172938,82,1,1,0,0,0,0 183 | 172938,83,0,0,0,2,1,0 184 | 172938,84,2,3,0,2,2,0 185 | 172938,85,1,2,1,0,1,0 186 | 172938,86,2,0,0,2,0,0 187 | 172938,87,0,2,1,2,0,0 188 | 172938,88,1,1,0,2,0,0 189 | 172938,89,0,1,0,0,1,0 190 | 172938,90,0,0,1,0,1,0 191 | 172938,91,0,1,1,0,1,0 192 | 172938,92,0,0,0,0,1,0 193 | 172938,93,1,1,0,0,1,0 194 | 172938,94,1,1,0,2,0,0 195 | 172938,95,1,0,0,0,0,0 196 | 172938,96,0,0,0,0,0,0 197 | 172938,97,2,0,0,4,0,0 198 | 172938,98,3,0,0,2,1,0 199 | 172938,99,2,0,0,0,0,0 200 | 172938,100,0,0,0,0,2,0 201 | 172939,1,1,0,3,0,1,0 202 | 172939,2,0,0,0,0,1,0 203 | 172939,3,0,0,0,0,1,0 204 | 172939,4,0,0,0,0,0,0 205 | 172939,5,0,0,0,0,0,0 206 | 172939,6,0,0,0,0,0,0 207 | 172939,7,0,0,0,0,0,0 208 | 172939,8,1,0,0,4,0,0 209 | 172939,9,1,0,1,2,3,0 210 | 172939,10,1,2,0,0,2,0 211 | 172939,11,0,0,0,0,1,0 212 | 172939,12,0,0,0,0,0,0 213 | 172939,13,0,0,0,0,0,0 214 | 172939,14,0,0,0,0,0,0 215 | 172939,15,0,0,0,0,0,0 216 | 172939,16,0,0,0,0,0,0 217 | 172939,17,0,0,0,0,0,0 218 | 172939,18,0,0,0,0,0,0 219 | 172939,19,0,0,0,0,0,0 220 | 172939,20,0,0,0,0,0,0 221 | 172939,21,0,0,0,0,1,0 222 | 172939,22,0,0,0,0,0,0 223 | 172939,23,0,0,0,0,0,0 224 | 172939,24,0,0,0,0,0,0 225 | 172939,25,2,1,0,0,0,0 226 | 172939,26,2,1,0,0,0,0 227 | 172939,27,2,1,0,2,0,0 228 | 172939,28,3,0,1,0,2,0 229 | 172939,29,2,0,0,0,1,0 230 | 172939,30,1,1,1,6,2,0 231 | 172939,31,2,1,2,4,0,0 232 | 172939,32,2,1,3,2,3,0 233 | 172939,33,3,3,0,2,5,0 234 | 172939,34,0,1,0,2,2,0 235 | 172939,35,2,1,0,0,0,0 236 | 172939,36,0,2,1,2,0,0 237 | 172939,37,1,0,1,4,1,0 238 | 172939,38,2,0,0,2,1,0 239 | 172939,39,0,1,1,0,1,0 240 | 172939,40,6,1,2,2,1,0 241 | 172939,41,9,0,7,4,4,0 242 | 172939,42,4,1,4,4,2,0 243 | 172939,43,4,2,3,0,1,0 244 | 172939,44,2,1,7,16,1,0 245 | 172939,45,1,1,5,38,2,0 246 | 172939,46,0,0,3,80,2,0 247 | 172939,47,1,0,7,104,1,0 248 | 172939,48,1,1,1,170,3,0 249 | 172939,49,1,0,4,246,1,0 250 | 172939,50,2,0,4,184,0,0 251 | 172939,51,2,0,1,96,0,0 252 | 172939,52,5,0,4,140,1,0 253 | 172939,53,2,0,3,240,3,0 254 | 172939,54,3,1,3,228,1,0 255 | 172939,55,5,1,2,274,0,0 256 | 172939,56,2,0,4,412,1,0 257 | 172939,57,1,1,2,266,1,0 258 | 172939,58,2,2,3,242,2,0 259 | 172939,59,1,2,1,326,4,0 260 | 172939,60,0,2,0,266,1,0 261 | 172939,61,1,1,4,262,1,0 262 | 172939,62,1,0,4,272,3,0 263 | 172939,63,3,0,3,198,1,0 264 | 172939,64,3,0,1,168,3,0 265 | 172939,65,8,2,3,66,2,0 266 | 172939,66,1,1,1,8,0,0 267 | 172939,67,1,0,2,4,2,0 268 | 172939,68,0,0,4,8,2,0 269 | 172939,69,1,0,1,14,0,0 270 | 172939,70,1,2,4,20,5,0 271 | 172939,71,1,4,8,16,1,0 272 | 172939,72,2,3,8,6,2,0 273 | 172939,73,1,3,12,10,0,0 274 | 172939,74,0,7,4,4,1,0 275 | 172939,75,2,2,6,6,1,0 276 | 172939,76,1,2,6,6,1,0 277 | 172939,77,0,1,2,2,0,0 278 | 172939,78,0,1,1,4,1,0 279 | 172939,79,0,0,2,8,3,0 280 | 172939,80,1,0,2,2,1,0 281 | 172939,81,1,1,5,4,0,0 282 | 172939,82,0,1,1,4,0,0 283 | 172939,83,1,1,1,4,0,0 284 | 172939,84,1,1,1,0,0,0 285 | 172939,85,2,0,0,4,0,0 286 | 172939,86,3,3,0,0,1,0 287 | 172939,87,2,3,2,4,0,0 288 | 172939,88,2,0,3,0,0,0 289 | 172939,89,1,1,0,0,1,0 290 | 172939,90,0,3,0,2,0,0 291 | 172939,91,0,1,2,0,1,0 292 | 172939,92,0,0,4,4,1,0 293 | 172939,93,0,0,2,0,0,0 294 | 172939,94,1,1,3,0,1,0 295 | 172939,95,0,2,0,2,2,0 296 | 172939,96,1,0,2,2,0,0 297 | 172939,97,3,2,1,2,3,0 298 | 172939,98,3,4,3,2,4,0 299 | 172939,99,0,1,1,0,2,0 300 | 172939,100,3,2,0,0,1,0 301 | 172940,1,1,2,1,0,2,0 302 | 172940,2,3,6,0,2,1,0 303 | 172940,3,1,8,3,0,3,0 304 | 172940,4,1,4,2,0,4,0 305 | 172940,5,1,5,0,0,0,0 306 | 172940,6,3,2,0,2,2,0 307 | 172940,7,3,2,0,2,1,0 308 | 172940,8,4,3,0,2,0,0 309 | 172940,9,2,4,0,2,1,0 310 | 172940,10,0,1,2,0,2,0 311 | 172940,11,2,2,2,0,7,0 312 | 172940,12,3,1,0,4,11,0 313 | 172940,13,1,2,0,4,5,0 314 | 172940,14,2,2,0,4,6,0 315 | 172940,15,0,5,1,0,4,0 316 | 172940,16,1,3,0,0,0,0 317 | 172940,17,0,0,0,0,0,0 318 | 172940,18,3,1,0,2,2,0 319 | 172940,19,2,2,0,2,1,0 320 | 172940,20,0,0,0,0,1,0 321 | 172940,21,0,0,0,0,1,0 322 | 172940,22,0,1,1,0,2,0 323 | 172940,23,1,1,0,2,1,0 324 | 172940,24,2,3,0,0,1,0 325 | 172940,25,2,3,1,0,1,0 326 | 172940,26,1,0,1,0,1,0 327 | 172940,27,0,1,3,0,0,0 328 | 172940,28,2,2,2,0,0,0 329 | 172940,29,6,0,1,0,2,0 330 | 172940,30,3,3,2,8,0,0 331 | 172940,31,1,0,2,4,2,0 332 | 172940,32,1,0,2,2,1,0 333 | 172940,33,1,3,7,0,3,0 334 | 172940,34,3,1,6,2,2,0 335 | 172940,35,2,2,7,4,0,0 336 | 172940,36,6,2,11,2,0,0 337 | 172940,37,3,1,8,4,3,0 338 | 172940,38,2,2,12,0,3,0 339 | 172940,39,6,2,6,4,1,0 340 | 172940,40,2,0,9,0,1,0 341 | 172940,41,2,2,6,4,1,0 342 | 172940,42,1,1,4,2,3,0 343 | 172940,43,2,0,3,0,4,0 344 | 172940,44,5,1,7,4,0,0 345 | 172940,45,2,1,3,4,0,0 346 | 172940,46,0,0,0,0,0,0 347 | 172940,47,0,0,1,2,0,0 348 | 172940,48,0,0,0,2,0,0 349 | 172940,49,3,0,0,0,2,0 350 | 172940,50,0,0,2,0,4,0 351 | 172940,51,5,2,2,2,2,0 352 | 172940,52,2,0,2,6,2,0 353 | 172940,53,1,2,2,2,3,0 354 | 172940,54,1,0,1,0,2,0 355 | 172940,55,3,1,0,2,3,0 356 | 172940,56,1,3,2,4,4,0 357 | 172940,57,1,0,2,6,2,0 358 | 172940,58,2,1,2,4,2,0 359 | 172940,59,2,1,0,0,4,0 360 | 172940,60,0,1,1,0,1,0 361 | 172940,61,1,3,3,2,0,0 362 | 172940,62,3,4,0,0,3,0 363 | 172940,63,2,0,0,0,1,0 364 | 172940,64,0,4,3,0,1,0 365 | 172940,65,1,1,3,6,1,0 366 | 172940,66,2,0,3,8,2,0 367 | 172940,67,5,2,9,0,3,0 368 | 172940,68,2,2,12,0,5,0 369 | 172940,69,1,3,13,0,1,0 370 | 172940,70,0,4,11,4,0,0 371 | 172940,71,1,3,10,2,0,0 372 | 172940,72,0,2,10,2,0,0 373 | 172940,73,1,1,8,6,0,0 374 | 172940,74,1,1,2,2,0,0 375 | 172940,75,0,3,2,0,1,0 376 | 172940,76,0,2,2,0,2,0 377 | 172940,77,2,1,5,0,0,0 378 | 172940,78,0,2,5,0,1,0 379 | 172940,79,0,3,2,0,1,0 380 | 172940,80,2,2,3,2,2,0 381 | 172940,81,0,0,2,0,1,0 382 | 172940,82,0,0,2,0,0,0 383 | 172940,83,0,0,0,2,2,0 384 | 172940,84,0,0,1,2,1,0 385 | 172940,85,1,0,0,0,0,0 386 | 172940,86,0,1,0,0,0,0 387 | 172940,87,1,0,0,0,0,0 388 | 172940,88,1,1,2,0,0,0 389 | 172940,89,0,1,3,2,2,0 390 | 172940,90,1,1,0,0,1,0 391 | 172940,91,0,0,0,0,0,0 392 | 172940,92,0,0,0,0,0,0 393 | 172940,93,0,0,0,0,0,0 394 | 172940,94,0,0,0,0,0,0 395 | 172940,95,2,1,0,0,2,0 396 | 172940,96,2,2,0,0,2,0 397 | 172940,97,3,1,1,0,1,0 398 | 172940,98,2,2,0,0,2,0 399 | 172940,99,1,3,1,2,1,0 400 | 172940,100,2,0,1,0,3,0 401 | 172943,1,0,1,0,112,0,1 402 | 172943,2,0,1,0,168,0,1 403 | 172943,3,1,2,1,198,2,1 404 | 172943,4,1,2,0,156,2,1 405 | 172943,5,2,0,0,84,1,1 406 | 172943,6,0,0,0,22,1,1 407 | 172943,7,1,1,1,20,0,1 408 | 172943,8,1,0,2,52,0,1 409 | 172943,9,0,1,3,68,0,1 410 | 172943,10,2,0,6,92,0,1 411 | 172943,11,4,1,6,88,0,1 412 | 172943,12,4,0,8,72,2,1 413 | 172943,13,6,0,1,48,1,1 414 | 172943,14,0,0,4,36,0,1 415 | 172943,15,0,2,7,8,0,1 416 | 172943,16,0,0,8,4,0,1 417 | 172943,17,1,0,9,4,0,1 418 | 172943,18,0,1,4,4,0,1 419 | 172943,19,0,0,1,2,0,1 420 | 172943,20,0,0,0,0,1,1 421 | 172943,21,0,0,9,0,2,1 422 | 172943,22,0,1,8,2,1,1 423 | 172943,23,1,0,4,2,0,1 424 | 172943,24,0,0,2,0,0,1 425 | 172943,25,2,0,0,0,1,1 426 | 172943,26,3,0,2,4,3,1 427 | 172943,27,1,0,2,2,1,1 428 | 172943,28,0,0,3,0,2,1 429 | 172943,29,0,2,2,0,1,1 430 | 172943,30,0,2,2,2,0,1 431 | 172943,31,0,2,2,2,0,1 432 | 172943,32,1,2,2,4,1,1 433 | 172943,33,1,0,0,4,0,1 434 | 172943,34,1,2,2,0,1,1 435 | 172943,35,2,2,1,0,0,1 436 | 172943,36,2,6,1,0,0,1 437 | 172943,37,0,3,4,0,0,1 438 | 172943,38,0,2,3,0,0,1 439 | 172943,39,0,0,6,4,0,1 440 | 172943,40,0,0,1,4,0,1 441 | 172943,41,0,0,0,0,0,1 442 | 172943,42,0,0,0,2,1,1 443 | 172943,43,0,0,2,0,0,1 444 | 172943,44,1,1,2,0,0,1 445 | 172943,45,1,1,1,0,0,1 446 | 172943,46,2,1,4,4,1,1 447 | 172943,47,0,0,5,2,1,1 448 | 172943,48,2,1,7,0,2,1 449 | 172943,49,2,0,4,2,1,1 450 | 172943,50,0,0,4,4,0,1 451 | 172943,51,0,0,3,0,0,1 452 | 172943,52,0,0,3,0,1,1 453 | 172943,53,0,0,3,0,1,1 454 | 172943,54,0,0,3,4,0,1 455 | 172943,55,0,0,4,2,0,1 456 | 172943,56,0,0,1,4,1,1 457 | 172943,57,1,2,2,4,0,1 458 | 172943,58,1,1,3,0,1,1 459 | 172943,59,0,3,2,4,2,1 460 | 172943,60,3,0,5,2,0,1 461 | 172943,61,3,0,2,0,0,1 462 | 172943,62,0,1,1,0,0,1 463 | 172943,63,0,0,1,2,0,1 464 | 172943,64,0,0,0,2,1,1 465 | 172943,65,2,0,0,2,1,1 466 | 172943,66,1,1,0,2,1,1 467 | 172943,67,1,0,2,2,0,1 468 | 172943,68,1,0,0,2,0,1 469 | 172943,69,2,0,0,2,1,1 470 | 172943,70,0,1,0,0,0,1 471 | 172943,71,0,0,0,0,0,1 472 | 172943,72,0,0,0,0,0,1 473 | 172943,73,0,0,0,0,0,1 474 | 172943,74,0,0,0,0,0,1 475 | 172943,75,0,0,0,0,0,1 476 | 172943,76,0,2,0,2,2,1 477 | 172943,77,0,1,1,2,0,1 478 | 172943,78,0,3,0,0,2,1 479 | 172943,79,0,0,0,0,0,1 480 | 172943,80,0,0,0,2,0,1 481 | 172943,81,0,2,1,0,1,1 482 | 172943,82,2,5,0,0,1,1 483 | 172943,83,1,1,0,0,3,1 484 | 172943,84,0,1,0,0,2,1 485 | 172943,85,0,0,0,0,0,1 486 | 172943,86,0,0,0,0,2,1 487 | 172943,87,0,0,0,0,2,1 488 | 172943,88,0,0,0,0,0,1 489 | 172943,89,0,0,0,0,0,1 490 | 172943,90,0,1,0,0,1,1 491 | 172943,91,0,1,0,0,0,1 492 | 172943,92,0,1,0,0,0,1 493 | 172943,93,0,2,0,0,0,1 494 | 172943,94,0,2,0,0,0,1 495 | 172943,95,0,1,0,0,4,1 496 | 172943,96,0,0,0,0,3,1 497 | 172943,97,2,3,2,0,2,1 498 | 172943,98,0,4,3,0,4,1 499 | 172943,99,2,3,0,0,1,1 500 | 172943,100,2,3,1,0,1,1 501 | 172954,1,0,0,1,0,1,1 502 | 172954,2,1,0,2,0,1,1 503 | 172954,3,3,0,2,2,2,1 504 | 172954,4,2,2,2,4,0,1 505 | 172954,5,1,0,4,0,2,1 506 | 172954,6,3,2,5,0,4,1 507 | 172954,7,4,0,3,0,2,1 508 | 172954,8,0,0,1,0,0,1 509 | 172954,9,1,0,0,0,0,1 510 | 172954,10,1,2,0,0,1,1 511 | 172954,11,0,0,0,0,0,1 512 | 172954,12,1,1,3,0,0,1 513 | 172954,13,4,2,6,2,1,1 514 | 172954,14,3,2,3,2,2,1 515 | 172954,15,2,2,9,2,1,1 516 | 172954,16,1,3,7,2,2,1 517 | 172954,17,1,1,4,2,1,1 518 | 172954,18,4,1,4,2,0,1 519 | 172954,19,3,1,3,2,1,1 520 | 172954,20,0,1,2,0,1,1 521 | 172954,21,0,0,1,0,0,1 522 | 172954,22,2,0,1,2,0,1 523 | 172954,23,2,0,0,6,2,1 524 | 172954,24,1,2,1,2,1,1 525 | 172954,25,0,1,1,2,2,1 526 | 172954,26,3,1,0,0,1,1 527 | 172954,27,2,0,0,2,0,1 528 | 172954,28,1,1,0,2,0,1 529 | 172954,29,2,1,0,0,0,1 530 | 172954,30,1,0,0,0,0,1 531 | 172954,31,1,1,2,0,1,1 532 | 172954,32,1,2,1,2,0,1 533 | 172954,33,1,3,0,8,2,1 534 | 172954,34,5,2,3,4,2,1 535 | 172954,35,2,1,1,0,0,1 536 | 172954,36,3,2,0,0,1,1 537 | 172954,37,2,1,0,0,0,1 538 | 172954,38,7,1,1,2,2,1 539 | 172954,39,4,0,1,0,1,1 540 | 172954,40,1,0,1,0,0,1 541 | 172954,41,2,1,0,2,0,1 542 | 172954,42,3,1,2,2,1,1 543 | 172954,43,2,1,1,4,0,1 544 | 172954,44,6,1,4,8,0,1 545 | 172954,45,7,0,6,18,0,1 546 | 172954,46,7,0,8,28,1,1 547 | 172954,47,5,1,5,56,0,1 548 | 172954,48,2,1,4,138,0,1 549 | 172954,49,3,0,2,150,2,1 550 | 172954,50,1,0,1,86,2,1 551 | 172954,51,7,0,0,250,4,1 552 | 172954,52,9,1,4,386,6,1 553 | 172954,53,4,3,4,310,2,1 554 | 172954,54,7,3,2,272,2,1 555 | 172954,55,12,5,9,166,0,1 556 | 172954,56,13,1,8,134,1,1 557 | 172954,57,14,1,8,114,2,1 558 | 172954,58,12,1,11,80,7,1 559 | 172954,59,10,3,12,72,2,1 560 | 172954,60,9,1,13,44,4,1 561 | 172954,61,2,1,5,14,2,1 562 | 172954,62,2,1,5,2,1,1 563 | 172954,63,5,1,4,4,1,1 564 | 172954,64,6,1,5,10,1,1 565 | 172954,65,5,0,2,10,2,1 566 | 172954,66,4,2,3,14,1,1 567 | 172954,67,2,1,2,8,0,1 568 | 172954,68,1,0,3,0,0,1 569 | 172954,69,1,0,3,2,1,1 570 | 172954,70,0,1,1,2,2,1 571 | 172954,71,0,0,0,4,0,1 572 | 172954,72,2,3,1,0,0,1 573 | 172954,73,2,3,3,2,0,1 574 | 172954,74,2,2,1,2,0,1 575 | 172954,75,0,1,1,0,0,1 576 | 172954,76,0,2,3,0,0,1 577 | 172954,77,1,0,2,2,0,1 578 | 172954,78,1,0,1,2,0,1 579 | 172954,79,0,4,1,4,0,1 580 | 172954,80,0,2,0,2,2,1 581 | 172954,81,2,2,1,2,3,1 582 | 172954,82,4,1,0,4,0,1 583 | 172954,83,1,1,0,0,3,1 584 | 172954,84,0,4,0,2,0,1 585 | 172954,85,3,12,4,2,0,1 586 | 172954,86,0,4,1,0,0,1 587 | 172954,87,0,2,0,4,1,1 588 | 172954,88,1,0,1,2,1,1 589 | 172954,89,0,1,1,0,0,1 590 | 172954,90,1,3,2,0,0,1 591 | 172954,91,1,3,0,0,3,1 592 | 172954,92,0,3,1,0,1,1 593 | 172954,93,0,2,1,2,0,1 594 | 172954,94,0,0,2,0,0,1 595 | 172954,95,0,0,0,0,0,1 596 | 172954,96,0,0,0,0,0,1 597 | 172954,97,0,0,1,0,0,1 598 | 172954,98,1,2,5,2,1,1 599 | 172954,99,2,3,2,2,0,1 600 | 172954,100,0,3,1,2,0,1 601 | 172955,1,1,1,0,0,0,0 602 | 172955,2,0,2,2,0,2,0 603 | 172955,3,0,0,1,0,1,0 604 | 172955,4,1,1,1,0,1,0 605 | 172955,5,1,1,2,0,0,0 606 | 172955,6,1,1,1,4,4,0 607 | 172955,7,0,2,0,2,4,0 608 | 172955,8,1,2,1,2,1,0 609 | 172955,9,0,0,0,0,0,0 610 | 172955,10,1,1,1,2,0,0 611 | 172955,11,2,5,1,4,0,0 612 | 172955,12,0,4,1,0,0,0 613 | 172955,13,0,2,2,2,0,0 614 | 172955,14,1,0,1,0,1,0 615 | 172955,15,1,0,3,0,1,0 616 | 172955,16,1,0,1,2,0,0 617 | 172955,17,0,0,1,2,1,0 618 | 172955,18,0,2,2,0,2,0 619 | 172955,19,0,1,3,6,3,0 620 | 172955,20,0,0,0,2,2,0 621 | 172955,21,0,0,0,0,0,0 622 | 172955,22,0,0,0,0,0,0 623 | 172955,23,0,1,1,0,1,0 624 | 172955,24,1,1,1,0,5,0 625 | 172955,25,0,1,1,2,2,0 626 | 172955,26,0,1,0,2,1,0 627 | 172955,27,0,0,0,0,0,0 628 | 172955,28,0,0,0,0,0,0 629 | 172955,29,1,2,1,0,4,0 630 | 172955,30,0,2,0,0,3,0 631 | 172955,31,0,2,0,0,2,0 632 | 172955,32,3,1,0,0,2,0 633 | 172955,33,2,1,2,2,3,0 634 | 172955,34,3,0,1,2,1,0 635 | 172955,35,4,1,0,0,2,0 636 | 172955,36,2,0,3,2,0,0 637 | 172955,37,1,0,1,2,3,0 638 | 172955,38,1,4,0,2,2,0 639 | 172955,39,1,2,1,0,0,0 640 | 172955,40,1,0,1,0,1,0 641 | 172955,41,0,1,3,4,1,0 642 | 172955,42,1,0,5,6,0,0 643 | 172955,43,0,0,3,2,0,0 644 | 172955,44,0,0,2,0,0,0 645 | 172955,45,0,2,2,0,1,0 646 | 172955,46,0,2,5,2,1,0 647 | 172955,47,1,1,5,2,1,0 648 | 172955,48,1,1,4,2,1,0 649 | 172955,49,0,0,4,2,1,0 650 | 172955,50,0,0,2,2,0,0 651 | 172955,51,0,0,3,0,2,0 652 | 172955,52,0,0,6,2,2,0 653 | 172955,53,0,0,8,2,2,0 654 | 172955,54,1,1,2,2,2,0 655 | 172955,55,1,2,3,4,1,0 656 | 172955,56,0,3,1,4,0,0 657 | 172955,57,1,2,3,2,2,0 658 | 172955,58,0,0,4,0,4,0 659 | 172955,59,1,1,1,2,4,0 660 | 172955,60,1,1,3,4,0,0 661 | 172955,61,0,1,2,2,0,0 662 | 172955,62,0,0,0,2,0,0 663 | 172955,63,0,2,0,2,2,0 664 | 172955,64,0,2,0,0,1,0 665 | 172955,65,1,0,1,0,1,0 666 | 172955,66,0,0,0,0,0,0 667 | 172955,67,0,0,1,0,1,0 668 | 172955,68,1,1,1,0,2,0 669 | 172955,69,1,2,3,4,1,0 670 | 172955,70,0,3,2,4,3,0 671 | 172955,71,1,1,4,0,2,0 672 | 172955,72,1,0,0,0,0,0 673 | 172955,73,3,0,1,2,0,0 674 | 172955,74,1,1,6,2,1,0 675 | 172955,75,3,1,5,2,1,0 676 | 172955,76,1,0,2,2,1,0 677 | 172955,77,1,0,3,4,1,0 678 | 172955,78,2,1,4,6,1,0 679 | 172955,79,2,3,3,4,1,0 680 | 172955,80,0,2,3,0,1,0 681 | 172955,81,0,1,6,2,1,0 682 | 172955,82,0,1,6,2,2,0 683 | 172955,83,0,0,6,0,0,0 684 | 172955,84,0,1,3,0,0,0 685 | 172955,85,0,2,2,0,1,0 686 | 172955,86,0,1,0,0,0,0 687 | 172955,87,1,1,0,0,0,0 688 | 172955,88,0,0,0,0,0,0 689 | 172955,89,0,0,0,0,0,0 690 | 172955,90,0,0,0,0,0,0 691 | 172955,91,0,0,1,0,2,0 692 | 172955,92,1,1,1,2,3,0 693 | 172955,93,1,1,1,2,3,0 694 | 172955,94,0,2,2,2,1,0 695 | 172955,95,0,0,1,0,0,0 696 | 172955,96,0,0,0,0,0,0 697 | 172955,97,0,0,0,0,0,0 698 | 172955,98,0,0,0,0,1,0 699 | 172955,99,0,0,0,0,0,0 700 | 172955,100,0,0,0,0,1,0 701 | 172967,1,0,0,1,0,2,0 702 | 172967,2,0,0,0,2,0,0 703 | 172967,3,0,0,0,2,1,0 704 | 172967,4,0,0,0,2,0,0 705 | 172967,5,0,0,0,0,0,0 706 | 172967,6,2,0,1,0,1,0 707 | 172967,7,2,0,0,0,1,0 708 | 172967,8,1,0,1,0,0,0 709 | 172967,9,1,0,0,2,0,0 710 | 172967,10,0,0,1,0,0,0 711 | 172967,11,0,0,1,0,0,0 712 | 172967,12,0,0,0,0,0,0 713 | 172967,13,0,0,0,0,0,0 714 | 172967,14,1,0,1,0,0,0 715 | 172967,15,0,1,0,0,1,0 716 | 172967,16,2,0,1,0,2,0 717 | 172967,17,2,0,1,0,0,0 718 | 172967,18,0,2,2,2,0,0 719 | 172967,19,1,1,6,2,1,0 720 | 172967,20,5,2,4,2,2,0 721 | 172967,21,2,0,2,2,3,0 722 | 172967,22,4,1,7,2,2,0 723 | 172967,23,2,1,4,4,2,0 724 | 172967,24,0,3,4,4,4,0 725 | 172967,25,0,1,2,2,1,0 726 | 172967,26,1,1,1,0,0,0 727 | 172967,27,0,0,1,0,1,0 728 | 172967,28,2,1,1,0,4,0 729 | 172967,29,0,1,2,2,0,0 730 | 172967,30,0,0,0,0,0,0 731 | 172967,31,2,2,0,0,0,0 732 | 172967,32,2,1,0,0,0,0 733 | 172967,33,0,1,0,0,1,0 734 | 172967,34,3,1,1,0,1,0 735 | 172967,35,1,1,2,2,2,0 736 | 172967,36,0,3,3,4,2,0 737 | 172967,37,4,0,1,0,1,0 738 | 172967,38,4,0,2,2,2,0 739 | 172967,39,3,1,1,2,2,0 740 | 172967,40,1,2,1,2,0,0 741 | 172967,41,0,1,0,0,1,0 742 | 172967,42,1,1,0,0,2,0 743 | 172967,43,1,2,0,0,1,0 744 | 172967,44,0,0,1,0,0,0 745 | 172967,45,0,1,1,0,0,0 746 | 172967,46,1,0,1,0,0,0 747 | 172967,47,1,1,1,0,0,0 748 | 172967,48,0,0,1,0,1,0 749 | 172967,49,0,0,2,2,1,0 750 | 172967,50,0,0,0,0,3,0 751 | 172967,51,0,1,0,0,0,0 752 | 172967,52,1,0,0,0,0,0 753 | 172967,53,1,0,0,0,0,0 754 | 172967,54,0,0,1,0,1,0 755 | 172967,55,0,0,2,0,1,0 756 | 172967,56,1,2,1,4,0,0 757 | 172967,57,0,0,0,0,0,0 758 | 172967,58,0,2,0,0,0,0 759 | 172967,59,0,4,0,6,1,0 760 | 172967,60,0,1,0,4,2,0 761 | 172967,61,0,0,0,2,0,0 762 | 172967,62,1,0,0,0,1,0 763 | 172967,63,5,0,0,2,5,0 764 | 172967,64,4,1,0,2,1,0 765 | 172967,65,4,4,0,2,1,0 766 | 172967,66,0,1,1,4,2,0 767 | 172967,67,1,0,0,6,1,0 768 | 172967,68,3,0,0,0,1,0 769 | 172967,69,2,0,0,0,1,0 770 | 172967,70,1,0,1,0,1,0 771 | 172967,71,0,0,0,0,1,0 772 | 172967,72,0,1,0,0,0,0 773 | 172967,73,2,1,0,0,0,0 774 | 172967,74,0,0,0,8,0,0 775 | 172967,75,1,0,2,2,0,0 776 | 172967,76,1,0,1,2,0,0 777 | 172967,77,2,0,1,0,1,0 778 | 172967,78,1,0,1,0,0,0 779 | 172967,79,0,0,2,0,0,0 780 | 172967,80,2,0,4,0,0,0 781 | 172967,81,1,0,3,0,1,0 782 | 172967,82,2,0,6,2,0,0 783 | 172967,83,1,1,4,0,0,0 784 | 172967,84,1,2,4,0,0,0 785 | 172967,85,2,0,7,0,0,0 786 | 172967,86,3,2,9,0,1,0 787 | 172967,87,1,2,10,2,1,0 788 | 172967,88,2,1,13,4,2,0 789 | 172967,89,3,1,14,2,4,0 790 | 172967,90,2,3,6,4,5,0 791 | 172967,91,2,1,6,2,1,0 792 | 172967,92,0,0,2,0,0,0 793 | 172967,93,0,1,1,0,0,0 794 | 172967,94,0,0,0,2,0,0 795 | 172967,95,0,0,0,2,1,0 796 | 172967,96,0,0,0,4,1,0 797 | 172967,97,0,0,0,0,0,0 798 | 172967,98,0,1,1,2,0,0 799 | 172967,99,0,0,0,2,0,0 800 | 172967,100,0,0,0,0,0,0 801 | 172969,1,0,0,1,0,2,0 802 | 172969,2,0,0,0,2,1,0 803 | 172969,3,1,0,1,2,2,0 804 | 172969,4,3,2,0,4,6,0 805 | 172969,5,0,1,1,2,0,0 806 | 172969,6,6,2,3,2,1,0 807 | 172969,7,3,3,1,8,14,0 808 | 172969,8,0,0,0,2,3,0 809 | 172969,9,2,5,2,0,11,0 810 | 172969,10,3,5,1,4,6,0 811 | 172969,11,2,0,0,2,10,0 812 | 172969,12,5,1,0,4,9,0 813 | 172969,13,2,1,1,2,6,0 814 | 172969,14,1,2,0,4,4,0 815 | 172969,15,1,1,1,0,6,0 816 | 172969,16,3,5,2,2,10,0 817 | 172969,17,3,1,1,2,3,0 818 | 172969,18,5,4,0,2,7,0 819 | 172969,19,6,5,1,8,16,0 820 | 172969,20,1,1,0,2,1,0 821 | 172969,21,2,3,0,0,7,0 822 | 172969,22,6,1,0,2,6,0 823 | 172969,23,4,4,0,0,9,0 824 | 172969,24,1,2,0,2,9,0 825 | 172969,25,0,2,0,4,3,0 826 | 172969,26,3,1,0,2,4,0 827 | 172969,27,7,0,2,0,1,0 828 | 172969,28,6,5,1,2,25,0 829 | 172969,29,5,3,1,2,24,0 830 | 172969,30,2,2,0,0,3,0 831 | 172969,31,2,2,0,2,1,0 832 | 172969,32,5,4,0,0,4,0 833 | 172969,33,3,2,0,0,0,0 834 | 172969,34,2,1,0,4,2,0 835 | 172969,35,2,2,1,4,9,0 836 | 172969,36,0,3,2,0,5,0 837 | 172969,37,0,0,0,0,1,0 838 | 172969,38,2,3,1,0,9,0 839 | 172969,39,7,1,0,4,6,0 840 | 172969,40,13,2,3,0,20,0 841 | 172969,41,3,4,4,2,8,0 842 | 172969,42,9,4,1,4,15,0 843 | 172969,43,8,4,2,0,14,0 844 | 172969,44,5,5,2,2,9,0 845 | 172969,45,2,2,0,2,4,0 846 | 172969,46,1,0,1,2,0,0 847 | 172969,47,3,1,2,0,2,0 848 | 172969,48,2,6,2,0,11,0 849 | 172969,49,4,6,2,0,8,0 850 | 172969,50,2,0,0,0,1,0 851 | 172969,51,6,0,5,0,5,0 852 | 172969,52,16,2,2,0,12,0 853 | 172969,53,22,4,4,0,11,0 854 | 172969,54,16,4,4,6,1,0 855 | 172969,55,17,1,1,0,6,0 856 | 172969,56,8,3,1,0,5,0 857 | 172969,57,18,4,1,2,8,0 858 | 172969,58,10,0,1,2,4,0 859 | 172969,59,11,2,1,4,9,0 860 | 172969,60,6,1,0,4,6,0 861 | 172969,61,14,5,0,0,12,0 862 | 172969,62,10,4,0,0,14,0 863 | 172969,63,13,6,0,0,10,0 864 | 172969,64,21,4,4,0,21,0 865 | 172969,65,9,2,5,2,29,0 866 | 172969,66,21,1,2,2,15,0 867 | 172969,67,28,4,7,2,29,0 868 | 172969,68,22,6,4,6,17,0 869 | 172969,69,11,2,1,6,12,0 870 | 172969,70,10,3,3,2,11,0 871 | 172969,71,3,2,4,0,6,0 872 | 172969,72,4,0,0,0,1,0 873 | 172969,73,31,1,3,4,13,0 874 | 172969,74,17,5,4,2,7,0 875 | 172969,75,11,1,0,0,2,0 876 | 172969,76,7,0,0,2,3,0 877 | 172969,77,5,0,0,2,4,0 878 | 172969,78,10,0,0,0,6,0 879 | 172969,79,34,4,3,0,7,0 880 | 172969,80,51,6,4,2,22,0 881 | 172969,81,44,7,3,0,19,0 882 | 172969,82,20,7,2,2,14,0 883 | 172969,83,24,4,2,4,10,0 884 | 172969,84,27,1,2,14,10,0 885 | 172969,85,73,17,8,24,55,0 886 | 172969,86,98,16,12,28,68,0 887 | 172969,87,130,6,7,28,27,0 888 | 172969,88,192,6,8,34,27,0 889 | 172969,89,162,8,18,24,27,0 890 | 172969,90,166,7,17,38,35,0 891 | 172969,91,192,11,14,32,30,0 892 | 172969,92,140,3,13,20,16,0 893 | 172969,93,120,4,10,12,19,0 894 | 172969,94,66,2,7,14,13,0 895 | 172969,95,72,13,7,14,20,0 896 | 172969,96,74,30,5,48,60,0 897 | 172969,97,73,37,7,58,111,0 898 | 172969,98,31,7,1,18,30,0 899 | 172969,99,48,42,4,46,93,0 900 | 172969,100,35,44,12,72,104,0 901 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/doall.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------- 2 | -- This script performs training and testing on 3 | -- AttentiveChrome model on a gene expression 4 | -- classification problem. 5 | -- Ritambhara Singh 6 | ---------------------------------------------------------------------- 7 | require 'torch' 8 | 9 | --------------------------------------------------------------------- 10 | print '==> processing options' 11 | 12 | local set = function() 13 | cmd = torch.CmdLine() 14 | cmd:text() 15 | cmd:text('AttentiveChrome Pipeline options') 16 | cmd:text() 17 | cmd:text('Options:') 18 | 19 | --GPU 20 | cmd:option('-gpu', -1, 'set >=0 (GPU number) to run with CUDA on GPU') 21 | 22 | -- global: 23 | cmd:option('-seed', 1, 'fixed input seed for repeatable experiments') 24 | cmd:option('-threads', 2, 'number of threads') 25 | cmd:option('--epochs', 10, 'number of epochs') 26 | 27 | --data: 28 | cmd:option('-dataDir', "data/", 'The data home location') 29 | cmd:option('-dataset', "toy/", 'Dataset name, corresponds to the folder name in dataDir') 30 | cmd:option('-resultsDir', "results/", 'The data home location') 31 | cmd:option('-name', "", 'Optionally, give a name for this model') 32 | cmd:option('-trsize', "10", 'Training set size (number of genes)') 33 | cmd:option('-tssize', "10", 'Test set size (number of genes)') 34 | 35 | --model: 36 | cmd:option('-nonlinearity', 'relu', 'type of nonlinearity function to use: tanh | relu | prelu') 37 | cmd:option('-loss', 'nll', 'type of loss function to minimize: nll') 38 | cmd:option('-model', 'rnn-hie-attention', 'type of models : mlp|cnn|rnn|rnn-attention|rnn-hie-attention') 39 | 40 | cmd:option('-cnn_size', 10, 'Window size of mlp or convolution kernel sizes of conv') 41 | cmd:option('-cnn_pool', 5 , 'sizes of pooling windows') 42 | cmd:option('-rnn_size', 32, 'hidden layer size for RNN') 43 | cmd:option('-unidirectional', 'false', 'for selecting uni/bi-directional LSTM') 44 | 45 | 46 | -- training: 47 | cmd:option('-save', 'results', 'subdirectory to save/log experiments in') 48 | cmd:option('-plot', false, 'live plot') 49 | cmd:option('-learningRate', 1e-3, 'learning rate at t=0') 50 | cmd:option('-batchSize', 1, 'mini-batch size (1 = pure stochastic), currently the model does not support >1') 51 | cmd:option('-weightDecay', 0, 'weight decay (SGD only)') 52 | cmd:option('-momentum', 0, 'momentum (SGD only)') 53 | cmd:option('-grad_clip',5, 'threshold for clipping gradients') 54 | 55 | 56 | cmd:text() 57 | opt = cmd:parse(arg or {}) 58 | end 59 | 60 | set() 61 | 62 | if opt.gpu >= 0 then 63 | collectgarbage() 64 | require 'cutorch' 65 | require 'cunn' 66 | cutorch.setDevice(opt.gpu + 1) 67 | dtype = 'torch.CudaTensor' 68 | itype = 'cuda()' 69 | print(string.format('Running with CUDA on GPU %d', opt.gpu+1)) 70 | else 71 | dtype = 'torch.FloatTensor' 72 | itype = 'float()' 73 | print 'Running in CPU mode' 74 | end 75 | 76 | torch.setnumthreads(opt.threads) 77 | torch.manualSeed(opt.seed) 78 | 79 | ---------------------------------------------------------------------- 80 | print '==> executing all' 81 | dofile '1_data.lua' 82 | dofile '2_model.lua' 83 | dofile '3_loss.lua' 84 | dofile '4_train.lua' 85 | dofile '5_test.lua' 86 | 87 | ---------------------------------------------------------------------- 88 | print '==> training!' 89 | local i = 1 90 | 91 | while i processing options' 13 | 14 | local set = function() 15 | cmd = torch.CmdLine() 16 | cmd:text() 17 | cmd:text('AttentiveChrome Pipeline options') 18 | cmd:text() 19 | cmd:text('Options:') 20 | 21 | --GPU 22 | cmd:option('-gpu', -1, 'set >=0 (GPU number) to run with CUDA on GPU') 23 | 24 | -- global: 25 | cmd:option('-seed', 1, 'fixed input seed for repeatable experiments') 26 | cmd:option('-threads', 2, 'number of threads') 27 | cmd:option('-epoch', 1, 'epoch of the best trained model') 28 | --data: 29 | cmd:option('-dataDir', "data/", 'The data home location') 30 | cmd:option('-dataset', "toy/", 'Dataset name, corresponds to the folder name in dataDir') 31 | cmd:option('-resultsDir', "results/", 'The data home location') 32 | cmd:option('-name', "", 'Optionally, give a name for this model') 33 | cmd:option('-tssize', "9", 'Test set size (number of genes)') 34 | 35 | --model: 36 | cmd:option('-model', 'rnn-hie-attention', 'type of models : mlp|cnn|rnn|rnn-attention|rnn-hie-attention') 37 | cmd:option('-rnn_size', 32, 'hidden layer size for RNN') 38 | 39 | cmd:option('-batchSize', 1, 'mini-batch size (1 = pure stochastic), currently the model does not support >1') 40 | cmd:text() 41 | opt = cmd:parse(arg or {}) 42 | end 43 | 44 | set() 45 | 46 | if opt.gpu >= 0 then 47 | collectgarbage() 48 | require 'cutorch' 49 | require 'cunn' 50 | cutorch.setDevice(opt.gpu + 1) 51 | dtype = 'torch.CudaTensor' 52 | itype = 'cuda()' 53 | print(string.format('Running with CUDA on GPU %d', opt.gpu+1)) 54 | else 55 | dtype = 'torch.FloatTensor' 56 | itype = 'float()' 57 | print 'Running in CPU mode' 58 | end 59 | 60 | torch.setnumthreads(opt.threads) 61 | torch.manualSeed(opt.seed) 62 | 63 | ---------------------------------------------------------------------- 64 | print '==> executing all' 65 | dofile '1_data_eval.lua' 66 | --perform testing: 67 | dofile '6_eval.lua' 68 | 69 | if opt.model=="rnn-hie-attention" then 70 | --perform alpha-attention visualization 71 | dofile '7_viz_alpha.lua' 72 | --perform beta-attention visualization 73 | dofile '8_viz_beta.lua' 74 | end 75 | ---------------------------------------------------------------------- 76 | print '==> evaluating!' 77 | test() 78 | 79 | if opt.model=="rnn-hie-attention" then 80 | print '==> printing alpha attention map!' 81 | viz_alpha() 82 | 83 | print '==> printing beta attention map!' 84 | viz_beta() 85 | end 86 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/util/LSTM.lua: -------------------------------------------------------------------------------- 1 | require 'torch' 2 | require 'nn' 3 | 4 | 5 | local layer, parent = torch.class('nn.LSTM', 'nn.Module') 6 | 7 | -- Implemented from https://github.com/jcjohnson/torch-rnn 8 | 9 | function layer:__init(input_dim, hidden_dim) 10 | parent.__init(self) 11 | 12 | local D, H = input_dim, hidden_dim 13 | self.input_dim, self.hidden_dim = D, H 14 | 15 | self.weight = torch.Tensor(D + H, 4 * H) 16 | self.gradWeight = torch.Tensor(D + H, 4 * H):zero() 17 | self.bias = torch.Tensor(4 * H) 18 | self.gradBias = torch.Tensor(4 * H):zero() 19 | self:reset() 20 | 21 | self.cell = torch.Tensor() -- This will be (N, T, H) 22 | self.gates = torch.Tensor() -- This will be (N, T, 4H) 23 | self.buffer1 = torch.Tensor() -- This will be (N, H) 24 | self.buffer2 = torch.Tensor() -- This will be (N, H) 25 | self.buffer3 = torch.Tensor() -- This will be (1, 4H) 26 | self.grad_a_buffer = torch.Tensor() -- This will be (N, 4H) 27 | 28 | self.h0 = torch.Tensor() 29 | self.c0 = torch.Tensor() 30 | self.remember_states = false 31 | 32 | self.grad_c0 = torch.Tensor() 33 | self.grad_h0 = torch.Tensor() 34 | self.grad_x = torch.Tensor() 35 | self.gradInput = {self.grad_c0, self.grad_h0, self.grad_x} 36 | end 37 | 38 | 39 | function layer:reset(std) 40 | if not std then 41 | std = 1.0 / math.sqrt(self.hidden_dim + self.input_dim) 42 | end 43 | self.bias:zero() 44 | self.bias[{{self.hidden_dim + 1, 2 * self.hidden_dim}}]:fill(1) 45 | self.weight:normal(0, std) 46 | return self 47 | end 48 | 49 | 50 | function layer:resetStates() 51 | self.h0 = self.h0.new() 52 | self.c0 = self.c0.new() 53 | end 54 | 55 | 56 | local function check_dims(x, dims) 57 | --print(x) 58 | --print(dims) 59 | assert(x:dim() == #dims) 60 | for i, d in ipairs(dims) do 61 | assert(x:size(i) == d) 62 | end 63 | end 64 | 65 | 66 | function layer:_unpack_input(input) 67 | local c0, h0, x = nil, nil, nil 68 | if torch.type(input) == 'table' and #input == 3 then 69 | c0, h0, x = unpack(input) 70 | elseif torch.type(input) == 'table' and #input == 2 then 71 | h0, x = unpack(input) 72 | elseif torch.isTensor(input) then 73 | x = input 74 | else 75 | assert(false, 'invalid input') 76 | end 77 | return c0, h0, x 78 | end 79 | 80 | 81 | function layer:_get_sizes(input, gradOutput) 82 | local c0, h0, x = self:_unpack_input(input) 83 | local N, T = x:size(1), x:size(2) 84 | local H, D = self.hidden_dim, self.input_dim 85 | check_dims(x, {N, T, D}) 86 | if h0 then 87 | check_dims(h0, {N, H}) 88 | end 89 | if c0 then 90 | check_dims(c0, {N, H}) 91 | end 92 | if gradOutput then 93 | check_dims(gradOutput, {N, T, H}) 94 | end 95 | return N, T, D, H 96 | end 97 | 98 | 99 | --[[ 100 | Input: 101 | - c0: Initial cell state, (N, H) 102 | - h0: Initial hidden state, (N, H) 103 | - x: Input sequence, (N, T, D) 104 | Output: 105 | - h: Sequence of hidden states, (N, T, H) 106 | --]] 107 | function layer:updateOutput(input) 108 | self.recompute_backward = true 109 | local c0, h0, x = self:_unpack_input(input) 110 | local N, T, D, H = self:_get_sizes(input) 111 | 112 | self._return_grad_c0 = (c0 ~= nil) 113 | self._return_grad_h0 = (h0 ~= nil) 114 | if not c0 then 115 | c0 = self.c0 116 | if c0:nElement() == 0 or not self.remember_states then 117 | c0:resize(N, H):zero() 118 | elseif self.remember_states then 119 | local prev_N, prev_T = self.cell:size(1), self.cell:size(2) 120 | assert(prev_N == N, 'batch sizes must be constant to remember states') 121 | c0:copy(self.cell[{{}, prev_T}]) 122 | end 123 | end 124 | if not h0 then 125 | h0 = self.h0 126 | if h0:nElement() == 0 or not self.remember_states then 127 | h0:resize(N, H):zero() 128 | elseif self.remember_states then 129 | local prev_N, prev_T = self.output:size(1), self.output:size(2) 130 | assert(prev_N == N, 'batch sizes must be the same to remember states') 131 | h0:copy(self.output[{{}, prev_T}]) 132 | end 133 | end 134 | 135 | local bias_expand = self.bias:view(1, 4 * H):expand(N, 4 * H) 136 | local Wx = self.weight[{{1, D}}] 137 | local Wh = self.weight[{{D + 1, D + H}}] 138 | 139 | local h, c = self.output, self.cell 140 | h:resize(N, T, H):zero() 141 | c:resize(N, T, H):zero() 142 | local prev_h, prev_c = h0, c0 143 | self.gates:resize(N, T, 4 * H):zero() 144 | for t = 1, T do 145 | local cur_x = x[{{}, t}] 146 | local next_h = h[{{}, t}] 147 | local next_c = c[{{}, t}] 148 | local cur_gates = self.gates[{{}, t}] 149 | cur_gates:addmm(bias_expand, cur_x, Wx) 150 | cur_gates:addmm(prev_h, Wh) 151 | cur_gates[{{}, {1, 3 * H}}]:sigmoid() 152 | cur_gates[{{}, {3 * H + 1, 4 * H}}]:tanh() 153 | local i = cur_gates[{{}, {1, H}}] 154 | local f = cur_gates[{{}, {H + 1, 2 * H}}] 155 | local o = cur_gates[{{}, {2 * H + 1, 3 * H}}] 156 | local g = cur_gates[{{}, {3 * H + 1, 4 * H}}] 157 | next_h:cmul(i, g) 158 | next_c:cmul(f, prev_c):add(next_h) 159 | next_h:tanh(next_c):cmul(o) 160 | prev_h, prev_c = next_h, next_c 161 | end 162 | 163 | return self.output 164 | end 165 | 166 | 167 | function layer:backward(input, gradOutput, scale) 168 | self.recompute_backward = false 169 | scale = scale or 1.0 170 | assert(scale == 1.0, 'must have scale=1') 171 | local c0, h0, x = self:_unpack_input(input) 172 | if not c0 then c0 = self.c0 end 173 | if not h0 then h0 = self.h0 end 174 | 175 | local grad_c0, grad_h0, grad_x = self.grad_c0, self.grad_h0, self.grad_x 176 | local h, c = self.output, self.cell 177 | local grad_h = gradOutput 178 | 179 | local N, T, D, H = self:_get_sizes(input, gradOutput) 180 | local Wx = self.weight[{{1, D}}] 181 | local Wh = self.weight[{{D + 1, D + H}}] 182 | local grad_Wx = self.gradWeight[{{1, D}}] 183 | local grad_Wh = self.gradWeight[{{D + 1, D + H}}] 184 | local grad_b = self.gradBias 185 | 186 | grad_h0:resizeAs(h0):zero() 187 | grad_c0:resizeAs(c0):zero() 188 | grad_x:resizeAs(x):zero() 189 | local grad_next_h = self.buffer1:resizeAs(h0):zero() 190 | local grad_next_c = self.buffer2:resizeAs(c0):zero() 191 | for t = T, 1, -1 do 192 | local next_h, next_c = h[{{}, t}], c[{{}, t}] 193 | local prev_h, prev_c = nil, nil 194 | if t == 1 then 195 | prev_h, prev_c = h0, c0 196 | else 197 | prev_h, prev_c = h[{{}, t - 1}], c[{{}, t - 1}] 198 | end 199 | grad_next_h:add(grad_h[{{}, t}]) 200 | 201 | local i = self.gates[{{}, t, {1, H}}] 202 | local f = self.gates[{{}, t, {H + 1, 2 * H}}] 203 | local o = self.gates[{{}, t, {2 * H + 1, 3 * H}}] 204 | local g = self.gates[{{}, t, {3 * H + 1, 4 * H}}] 205 | 206 | local grad_a = self.grad_a_buffer:resize(N, 4 * H):zero() 207 | local grad_ai = grad_a[{{}, {1, H}}] 208 | local grad_af = grad_a[{{}, {H + 1, 2 * H}}] 209 | local grad_ao = grad_a[{{}, {2 * H + 1, 3 * H}}] 210 | local grad_ag = grad_a[{{}, {3 * H + 1, 4 * H}}] 211 | 212 | -- We will use grad_ai, grad_af, and grad_ao as temporary buffers 213 | -- to to compute grad_next_c. We will need tanh_next_c (stored in grad_ai) 214 | -- to compute grad_ao; the other values can be overwritten after we compute 215 | -- grad_next_c 216 | local tanh_next_c = grad_ai:tanh(next_c) 217 | local tanh_next_c2 = grad_af:cmul(tanh_next_c, tanh_next_c) 218 | local my_grad_next_c = grad_ao 219 | my_grad_next_c:fill(1):add(-1, tanh_next_c2):cmul(o):cmul(grad_next_h) 220 | grad_next_c:add(my_grad_next_c) 221 | 222 | -- We need tanh_next_c (currently in grad_ai) to compute grad_ao; after 223 | -- that we can overwrite it. 224 | grad_ao:fill(1):add(-1, o):cmul(o):cmul(tanh_next_c):cmul(grad_next_h) 225 | 226 | -- Use grad_ai as a temporary buffer for computing grad_ag 227 | local g2 = grad_ai:cmul(g, g) 228 | grad_ag:fill(1):add(-1, g2):cmul(i):cmul(grad_next_c) 229 | 230 | -- We don't need any temporary storage for these so do them last 231 | grad_ai:fill(1):add(-1, i):cmul(i):cmul(g):cmul(grad_next_c) 232 | grad_af:fill(1):add(-1, f):cmul(f):cmul(prev_c):cmul(grad_next_c) 233 | 234 | grad_x[{{}, t}]:mm(grad_a, Wx:t()) 235 | grad_Wx:addmm(scale, x[{{}, t}]:t(), grad_a) 236 | grad_Wh:addmm(scale, prev_h:t(), grad_a) 237 | local grad_a_sum = self.buffer3:resize(1, 4 * H):sum(grad_a, 1) 238 | grad_b:add(scale, grad_a_sum) 239 | 240 | grad_next_h:mm(grad_a, Wh:t()) 241 | grad_next_c:cmul(f) 242 | end 243 | grad_h0:copy(grad_next_h) 244 | grad_c0:copy(grad_next_c) 245 | 246 | if self._return_grad_c0 and self._return_grad_h0 then 247 | self.gradInput = {self.grad_c0, self.grad_h0, self.grad_x} 248 | elseif self._return_grad_h0 then 249 | self.gradInput = {self.grad_h0, self.grad_x} 250 | else 251 | self.gradInput = self.grad_x 252 | end 253 | 254 | return self.gradInput 255 | end 256 | 257 | 258 | function layer:clearState() 259 | self.cell:set() 260 | self.gates:set() 261 | self.buffer1:set() 262 | self.buffer2:set() 263 | self.buffer3:set() 264 | self.grad_a_buffer:set() 265 | 266 | self.grad_c0:set() 267 | self.grad_h0:set() 268 | self.grad_x:set() 269 | self.output:set() 270 | end 271 | 272 | 273 | function layer:updateGradInput(input, gradOutput) 274 | if self.recompute_backward then 275 | self:backward(input, gradOutput, 1.0) 276 | end 277 | return self.gradInput 278 | end 279 | 280 | 281 | function layer:accGradParameters(input, gradOutput, scale) 282 | if self.recompute_backward then 283 | self:backward(input, gradOutput, scale) 284 | end 285 | end 286 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/util/ReverseSequence.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------ 2 | -- Adapted from github.com/jcjohnson/torch-rnn/pull/66/commits/5e30c1d54dc9ed1d152e4a55e9c438775f623ef7 3 | 4 | --[[ ReverseSequence ]] -- 5 | -- Reverses a sequence on a given dimension. 6 | -- Example: Given a tensor of torch.Tensor({{1,2,3,4,5}, {6,7,8,9,10}) 7 | -- nn.ReverseSequence(1):forward(tensor) would give: torch.Tensor({{6,7,8,9,10},{1,2,3,4,5}}) 8 | ------------------------------------------------------------------------ 9 | local ReverseSequence, parent = torch.class("nn.ReverseSequence", "nn.Module") 10 | 11 | function ReverseSequence:__init(dim,gpu) 12 | parent.__init(self) 13 | self.output = torch.Tensor() 14 | self.gradInput = torch.Tensor() 15 | self.outputIndices = torch.LongTensor() 16 | self.gradIndices = torch.LongTensor() 17 | self.typ = 'torch.CudaTensor' 18 | if gpu and (gpu < 0) then 19 | self.typ = 'torch.LongTensor' 20 | end 21 | end 22 | 23 | function ReverseSequence:reverseOutput(input) 24 | self.output:resizeAs(input) 25 | self.outputIndices:resize(input:size()) 26 | local T = input:size(1) 27 | for x = 1, T do 28 | self.outputIndices:narrow(1, x, 1):fill(T - x + 1) 29 | end 30 | self.output:gather(input, 1, self.outputIndices:type(self.typ)) 31 | end 32 | 33 | function ReverseSequence:updateOutput(input) 34 | input = input:transpose(1, 2) 35 | self:reverseOutput(input) 36 | self.output = self.output:transpose(1, 2) 37 | return self.output 38 | end 39 | 40 | function ReverseSequence:reverseGradOutput(gradOutput) 41 | self.gradInput:resizeAs(gradOutput) 42 | self.gradIndices:resize(gradOutput:size()) 43 | local T = gradOutput:size(1) 44 | for x = 1, T do 45 | self.gradIndices:narrow(1, x, 1):fill(T - x + 1) 46 | end 47 | self.gradInput:gather(gradOutput, 1, self.gradIndices:type(self.typ)) 48 | end 49 | 50 | function ReverseSequence:updateGradInput(inputTable, gradOutput) 51 | gradOutput = gradOutput:transpose(1, 2) 52 | self:reverseGradOutput(gradOutput) 53 | self.gradInput = self.gradInput:transpose(1, 2) 54 | return self.gradInput 55 | end 56 | -------------------------------------------------------------------------------- /OLD-v1LuaTorch/util/auRoc.lua: -------------------------------------------------------------------------------- 1 | --[[ An auRoc class 2 | -- Same form as the torch optim.ConfusionMatrix class 3 | -- output is assumed to be a ranking (e.g. probability value) 4 | -- label is assumed to be 1 or -1 5 | Example: 6 | auRoc = auRoc.new() -- new matrix 7 | conf:zero() -- reset matrix 8 | for i = 1,N do 9 | conf:add( output, label ) -- accumulate errors 10 | end 11 | print(auRoc:calculateAuc()) 12 | ]] 13 | 14 | --local opt = require('doall') 15 | 16 | debug.getregistry()['auRoc'] = nil 17 | 18 | local auRoc = torch.class("auRoc") 19 | 20 | function auRoc:__init() 21 | self.target = {} 22 | self.pred = {} 23 | self.roc = 0 24 | self.auc = 0 25 | end 26 | 27 | function auRoc:add(prediction, target) 28 | table.insert(self.pred,prediction) 29 | table.insert(self.target,target) 30 | end 31 | 32 | 33 | function auRoc:zero() 34 | self.target = {} 35 | self.pred = {} 36 | self.roc = 0 37 | self.auc = 0 38 | end 39 | 40 | 41 | local function tableToTensor(table) 42 | local tensor = torch.Tensor(#table) 43 | for i = 1,#table do 44 | tensor[i] = table[i] 45 | end 46 | return tensor 47 | end 48 | 49 | 50 | local function get_rates(responses, labels) 51 | torch.setdefaulttensortype('torch.FloatTensor') 52 | 53 | responses = torch.Tensor(responses:size()):copy(responses) 54 | labels = torch.Tensor(labels:size()):copy(labels) 55 | 56 | -- assertions about the data format expected 57 | assert(responses:size():size() == 1, "responses should be a 1D vector") 58 | assert(labels:size():size() == 1 , "labels should be a 1D vector") 59 | 60 | -- assuming labels {-1, 1} 61 | local npositives = torch.sum(torch.eq(labels, 1)) 62 | local nnegatives = torch.sum(torch.eq(labels, -1)) 63 | local nsamples = npositives + nnegatives 64 | 65 | assert(nsamples == responses:size()[1], "labels should contain only -1 or 1 values") 66 | 67 | -- sort by response value 68 | 69 | local responses_sorted, indexes_sorted = torch.sort(responses,1,true) 70 | local labels_sorted = labels:index(1, indexes_sorted) 71 | 72 | 73 | local found_positives = 0 74 | local found_negatives = 0 75 | 76 | local tpr = {0} -- true pos rate 77 | local fpr = {0} -- false pos rate 78 | 79 | for i = 1,nsamples-1 do 80 | if labels_sorted[i] == -1 then 81 | found_negatives = found_negatives + 1 82 | else 83 | found_positives = found_positives + 1 84 | end 85 | 86 | table.insert(tpr, found_positives/npositives) 87 | table.insert(fpr, found_negatives/nnegatives) 88 | end 89 | 90 | table.insert(tpr, 1.0) 91 | table.insert(fpr, 1.0) 92 | 93 | --if opt.cuda then 94 | --torch.setdefaulttensortype('torch.CudaTensor') 95 | --end 96 | 97 | return tpr, fpr 98 | end 99 | 100 | local function find_auc(tpr,fpr) 101 | local area = 0.0 102 | for i = 2,#tpr do 103 | local xdiff = fpr[i] - fpr[i-1] 104 | local ydiff = tpr[i] - tpr[i-1] 105 | area = area + (xdiff * tpr[i]) 106 | end 107 | return area 108 | end 109 | 110 | 111 | function auRoc:calculateAuc() 112 | local aucPredTens = tableToTensor(self.pred) 113 | local aucTargetTens = tableToTensor(self.target) 114 | 115 | local tpr = nil 116 | local fpr = nil 117 | 118 | tpr,fpr = get_rates(aucPredTens,aucTargetTens) 119 | self.auc = find_auc(tpr,fpr) 120 | 121 | return self.auc 122 | end 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AttentiveChrome 2 | 3 | Reference Paper: [Attend and Predict: Using Deep Attention Model to Understand Gene Regulation by Selective Attention on Chromatin](https://arxiv.org/abs/1708.00339) 4 | 5 | BibTex Citation: 6 | ``` 7 | @inproceedings{singh2017attend, 8 | title={Attend and Predict: Understanding Gene Regulation by Selective Attention on Chromatin}, 9 | author={Singh, Ritambhara and Lanchantin, Jack and Sekhon, Arshdeep and Qi, Yanjun}, 10 | booktitle={Advances in Neural Information Processing Systems}, 11 | pages={6769--6779}, 12 | year={2017} 13 | } 14 | ``` 15 | 16 | AttentiveChrome is a unified architecture to model and to interpret dependencies among chromatin factors for controlling gene regulation. AttentiveChrome uses a hierarchy of multiple Long short-term memory (LSTM) modules to encode the input signals and to model how various chromatin marks cooperate automatically. AttentiveChrome trains two levels of attention jointly with the target prediction, enabling it to attend differentially to relevant marks and to locate important positions per mark. We evaluate the model across 56 different cell types (tasks) in human. Not only is the proposed architecture more accurate, but its attention scores also provide a better interpretation than state-of-the-art feature visualization methods such as saliency map. 17 | 18 | **Feature Generation for AttentiveChrome model:** 19 | 20 | We used the five core histone modification (listed in the paper) read counts from REMC database as input matrix. We downloaded the files from [REMC dabase](http://egg2.wustl.edu/roadmap/web_portal/processed_data.html#ChipSeq_DNaseSeq). We converted 'tagalign.gz' format to 'bam' by using the command: 21 | ``` 22 | gunzip .tagAlign.gz 23 | bedtools bedtobam -i .tagAlign -g hg19chrom.sizes > .bam 24 | ``` 25 | Next, we used "bedtools multicov" to get the read counts. 26 | Bins of length 100 base-pairs (bp) are selected from regions (+/- 5000 bp) flanking the transcription start site (TSS) of each gene. The signal value of all five selected histone modifications from REMC in bins forms input matrix X, while discretized gene expression (label +1/-1) is the output y. 27 | 28 | For gene expression, we used the RPKM read count files available in REMC database. We took the median of the RPKM read counts as threshold for assigning binary labels (-1: gene low, +1: gene high). 29 | 30 | We divided the genes into 3 separate sets for training, validation and testing. It was a simple file split resulting into 6601, 6601 and 6600 genes respectively. 31 | 32 | We performed training and validation on the first 2 sets and then reported AUC scores of best performing epoch model for the third test data set. 33 | 34 | **Datasets** 35 | 36 | We have provided a toy dataset to test out model in the data subdirectory of v2PyTorch 37 | 38 | The complete set of 56 Cell Type datasets is located at https://zenodo.org/record/2652278 39 | 40 | The rows are bins for all genes (100 rows per gene) and the columns are organised as follows: 41 | 42 | GeneID, Bin ID, H3K27me3 count, H3K36me3 count, H3K4me1 count, H3K4me3 count, H3K9me3 counts, Binary Label for gene expression (0/1) 43 | e.g. 000003,1,4,3,0,8,4,1 44 | 45 | **Running The Model** 46 | 47 | See the v1LuaTorch or v2PyTorch directories to run the code. 48 | 49 | 50 | 51 | # v2PyTorch folder includes Pytorch version of the AttentiveChrome Implementation. 52 | You can run it via the following command: 53 | 54 | ``` 55 | python train.py --cell_type Toy 56 | ``` 57 | 58 | 59 | 60 | ## We also provide trained AttentiveChrome models through the Kipoi model zoo [http://kipoi.org/](http://kipoi.org/) 61 | 62 | Attentive Chrome model can be run using Kipoi, which is a repository of predictive models for genomics. All models in the repo can be used through shared API. 63 | 64 | - The utility codes to adapt AttentiveChrome to Kipoi are in /kipoiutil 65 | 66 | ### Installation Requirements 67 | * python>=3.5 68 | * numpy 69 | * pytorch-cpu 70 | * torchvision-cpu 71 | 72 | ## Quick Start 73 | ### Creating new conda environtment using kipoi 74 | `kipoi env create AttentiveChrome` 75 | 76 | 77 | ### Activating environment 78 | `conda activate kipoi-AttentiveChrome` 79 | 80 | ## Command Line 81 | We can run AttentiveChrome using a terminal. 82 | 83 | ### Getting example input file 84 | To get an example input file for a specific model, run the following command. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 85 | 86 | `kipoi get-example AttentiveChrome/{model_name} -o example_file` 87 | 88 | example: `kipoi get-example AttentiveChrome/E003 -o example_file` 89 | 90 | ### Predicting using example file 91 | To make a prediction using an input file, run the following command. 92 | 93 | `kipoi predict AttentiveChrome/{model_name} --dataloader_args='{"input_file": "example_file/input_file", "bin_size": 100}' -o example_predict.tsv` 94 | 95 | This should produce a tsv file containing the results. To run it using another file, replace "example_file/input+file" with the path of your file. 96 | 97 | ## Python API 98 | We can also use Attentive Chrome through the Kipoi Python API. 99 | ### Fetching the model 100 | First, import kipoi: 101 | `import kipoi` 102 | 103 | Next, get the model. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 104 | 105 | `model = kipoi.get_model("AttentiveChrome/{model_name}")` 106 | 107 | ### Predicting using pipeline 108 | `prediction = model.pipeline.predict({"input_file": "path to input file", "bin_size": {some integer}})` 109 | 110 | This returns a numpy array containing the output from the final softmax function. 111 | 112 | e.g. `model.pipeline.predict({"input_file": "data/input_file", "bin_size": 100})` 113 | 114 | ### Predicting for a single batch 115 | First, we need to set up our dataloader `dl`. 116 | 117 | `dl = model.default_dataloader(input_file="path to input file", bin_size={some integer})` 118 | 119 | Next, we can use the iterator functionality of the dataloader. 120 | 121 | `it = dl.batch_iter(batch_size=32)` 122 | 123 | `single_batch = next(it)` 124 | 125 | First line gets us an iterator named `it` with each batch containing 32 items. We can use `next(it)` to get a batch. 126 | 127 | Then, we can perform prediction on this single batch. 128 | 129 | `prediction = model.predict_on_batch(single_batch['inputs'])` 130 | 131 | This also returns a numpy array containing the output from the final softmax function. 132 | 133 | 134 | # We have extended attentiveChrome to DeepDiffChrome 135 | 136 | 137 | - [DeepDiff: Deep-learning for predicting Differential 138 | gene expression from histone modifications](https://academic.oup.com/bioinformatics/article/34/17/i891/5093224) 139 | 140 | - Code Github [https://github.com/QData/DeepDiffChrome](https://github.com/QData/DeepDiffChrome) 141 | 142 | 143 | ## Meanwhile, here are some links for general data processing tools/guidance on ChIP-seq data: 144 | 145 | [https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003326](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003326) 146 | 147 | [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5389943/](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5389943/) 148 | 149 | [https://bedtools.readthedocs.io/en/latest/](https://bedtools.readthedocs.io/en/latest/) 150 | -------------------------------------------------------------------------------- /v2PyTorch/.gitignore: -------------------------------------------------------------------------------- 1 | Results/* 2 | __pycache__/* 3 | *.pyc 4 | -------------------------------------------------------------------------------- /v2PyTorch/README.md: -------------------------------------------------------------------------------- 1 | 2 | # This folder includes Pytorch version of the AttentiveChrome Implementation. 3 | You can run it via the following command: 4 | 5 | ``` 6 | python train.py --cell_type Toy 7 | ``` 8 | 9 | 10 | 11 | ## We also provide trained AttentiveChrome models through the Kipoi model zoo [http://kipoi.org/](http://kipoi.org/) 12 | 13 | AttentiveChrome model can be run using Kipoi, which is a repository of predictive models for genomics. All models in the repo can be used through shared API. 14 | 15 | - The utility codes to adapt AttentiveChrome to Kipoi are in /kipoiutil 16 | 17 | ### Installation Requirements 18 | * python>=3.5 19 | * numpy 20 | * pytorch-cpu 21 | * torchvision-cpu 22 | 23 | ## Quick Start 24 | ### Creating new conda environtment using kipoi 25 | `kipoi env create AttentiveChrome` 26 | 27 | 28 | ### Activating environment 29 | `conda activate kipoi-AttentiveChrome` 30 | 31 | ## Command Line 32 | We can run Attentive Chrome using a terminal. 33 | 34 | ### Getting example input file 35 | To get an example input file for a specific model, run the following command. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 36 | 37 | `kipoi get-example AttentiveChrome/{model_name} -o example_file` 38 | 39 | example: `kipoi get-example AttentiveChrome/E003 -o example_file` 40 | 41 | ### Predicting using example file 42 | To make a prediction using an input file, run the following command. 43 | 44 | `kipoi predict AttentiveChrome/{model_name} --dataloader_args='{"input_file": "example_file/input_file", "bin_size": 100}' -o example_predict.tsv` 45 | 46 | This should produce a tsv file containing the results. To run it using another file, replace "example_file/input+file" with the path of your file. 47 | 48 | ## Python API 49 | We can also use Attentive Chrome through the Kipoi Python API. 50 | ### Fetching the model 51 | First, import kipoi: 52 | `import kipoi` 53 | 54 | Next, get the model. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 55 | 56 | `model = kipoi.get_model("AttentiveChrome/{model_name}")` 57 | 58 | ### Predicting using pipeline 59 | `prediction = model.pipeline.predict({"input_file": "path to input file", "bin_size": {some integer}})` 60 | 61 | This returns a numpy array containing the output from the final softmax function. 62 | 63 | e.g. `model.pipeline.predict({"input_file": "data/input_file", "bin_size": 100})` 64 | 65 | ### Predicting for a single batch 66 | First, we need to set up our dataloader `dl`. 67 | 68 | `dl = model.default_dataloader(input_file="path to input file", bin_size={some integer})` 69 | 70 | Next, we can use the iterator functionality of the dataloader. 71 | 72 | `it = dl.batch_iter(batch_size=32)` 73 | 74 | `single_batch = next(it)` 75 | 76 | First line gets us an iterator named `it` with each batch containing 32 items. We can use `next(it)` to get a batch. 77 | 78 | Then, we can perform prediction on this single batch. 79 | 80 | `prediction = model.predict_on_batch(single_batch['inputs'])` 81 | 82 | This also returns a numpy array containing the output from the final softmax function. 83 | 84 | -------------------------------------------------------------------------------- /v2PyTorch/data.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import collections 3 | import pdb 4 | import torch.utils.data 5 | import csv 6 | import json 7 | from torch.utils.data import Dataset, DataLoader 8 | from torchvision import transforms, utils 9 | import math 10 | from pdb import set_trace as stop 11 | import numpy as np 12 | 13 | 14 | 15 | def loadData(filename,windows): 16 | with open(filename) as fi: 17 | csv_reader=csv.reader(fi) 18 | data=list(csv_reader) 19 | 20 | ncols=(len(data[0])) 21 | fi.close() 22 | nrows=len(data) 23 | ngenes=nrows/windows 24 | nfeatures=ncols-1 25 | print("Number of genes: %d" % ngenes) 26 | print("Number of entries: %d" % nrows) 27 | print("Number of HMs: %d" % nfeatures) 28 | 29 | count=0 30 | attr=collections.OrderedDict() 31 | 32 | for i in range(0,nrows,windows): 33 | hm1=torch.zeros(windows,1) 34 | hm2=torch.zeros(windows,1) 35 | hm3=torch.zeros(windows,1) 36 | hm4=torch.zeros(windows,1) 37 | hm5=torch.zeros(windows,1) 38 | for w in range(0,windows): 39 | hm1[w][0]=int(data[i+w][2]) 40 | hm2[w][0]=int(data[i+w][3]) 41 | hm3[w][0]=int(data[i+w][4]) 42 | hm4[w][0]=int(data[i+w][5]) 43 | hm5[w][0]=int(data[i+w][6]) 44 | geneID=str(data[i][0].split("_")[0]) 45 | 46 | thresholded_expr = int(data[i+w][7]) 47 | 48 | attr[count]={ 49 | 'geneID':geneID, 50 | 'expr':thresholded_expr, 51 | 'hm1':hm1, 52 | 'hm2':hm2, 53 | 'hm3':hm3, 54 | 'hm4':hm4, 55 | 'hm5':hm5 56 | } 57 | count+=1 58 | 59 | return attr 60 | 61 | 62 | class HMData(Dataset): 63 | # Dataset class for loading data 64 | def __init__(self,data_cell1,transform=None): 65 | self.c1=data_cell1 66 | def __len__(self): 67 | return len(self.c1) 68 | def __getitem__(self,i): 69 | final_data_c1=torch.cat((self.c1[i]['hm1'],self.c1[i]['hm2'],self.c1[i]['hm3'],self.c1[i]['hm4'],self.c1[i]['hm5']),1) 70 | label=self.c1[i]['expr'] 71 | geneID=self.c1[i]['geneID'] 72 | sample={'geneID':geneID, 73 | 'input':final_data_c1, 74 | 'label':label, 75 | } 76 | return sample 77 | 78 | def load_data(args): 79 | ''' 80 | Loads data into a 3D tensor for each of the 3 splits. 81 | 82 | ''' 83 | print("==>loading train data") 84 | cell_train_dict1=loadData(args.data_root+"/"+args.cell_type+"/classification/train.csv",args.n_bins) 85 | train_inputs = HMData(cell_train_dict1) 86 | 87 | print("==>loading valid data") 88 | cell_valid_dict1=loadData(args.data_root+"/"+args.cell_type+"/classification/valid.csv",args.n_bins) 89 | valid_inputs = HMData(cell_valid_dict1) 90 | 91 | print("==>loading test data") 92 | cell_test_dict1=loadData(args.data_root+"/"+args.cell_type+"/classification/test.csv",args.n_bins) 93 | test_inputs = HMData(cell_test_dict1) 94 | 95 | Train = torch.utils.data.DataLoader(train_inputs, batch_size=args.batch_size, shuffle=True) 96 | Valid = torch.utils.data.DataLoader(valid_inputs, batch_size=args.batch_size, shuffle=False) 97 | Test = torch.utils.data.DataLoader(test_inputs, batch_size=args.batch_size, shuffle=False) 98 | 99 | return Train,Valid,Test 100 | 101 | 102 | -------------------------------------------------------------------------------- /v2PyTorch/evaluate.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import torch 3 | import scipy 4 | import scipy.sparse as sp 5 | import logging 6 | from six.moves import xrange 7 | from collections import OrderedDict 8 | import sys 9 | import pdb 10 | from sklearn import metrics 11 | import torch.nn.functional as F 12 | from torch.autograd import Variable 13 | from pdb import set_trace as stop 14 | 15 | 16 | def compute_aupr(all_targets,all_predictions): 17 | aupr_array = [] 18 | for i in range(all_targets.shape[1]): 19 | try: 20 | precision, recall, thresholds = metrics.precision_recall_curve(all_targets[:,i], all_predictions[:,i], pos_label=1) 21 | auPR = metrics.auc(recall,precision)#,reorder=True) 22 | if not math.isnan(auPR): 23 | aupr_array.append(numpy.nan_to_num(auPR)) 24 | except: 25 | pass 26 | 27 | aupr_array = numpy.array(aupr_array) 28 | mean_aupr = numpy.mean(aupr_array) 29 | median_aupr = numpy.median(aupr_array) 30 | var_aupr = numpy.var(aupr_array) 31 | return mean_aupr,median_aupr,var_aupr,aupr_array 32 | 33 | 34 | def compute_auc(all_targets,all_predictions): 35 | auc_array = [] 36 | 37 | for i in range(all_targets.shape[1]): 38 | try: 39 | auROC = metrics.roc_auc_score(all_targets[:,i], all_predictions[:,i]) 40 | auc_array.append(auROC) 41 | except ValueError: 42 | pass 43 | 44 | auc_array = numpy.array(auc_array) 45 | mean_auc = numpy.mean(auc_array) 46 | median_auc = numpy.median(auc_array) 47 | var_auc = numpy.var(auc_array) 48 | return mean_auc,median_auc,var_auc,auc_array 49 | 50 | 51 | def compute_metrics(predictions, targets): 52 | 53 | 54 | pred=predictions.numpy() 55 | targets=targets.numpy() 56 | 57 | mean_auc,median_auc,var_auc,auc_array = compute_auc(targets,pred) 58 | mean_aupr,median_aupr,var_aupr,aupr_array = compute_aupr(targets,pred) 59 | 60 | 61 | return mean_aupr,mean_auc 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E003/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E004/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E005/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E006/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E007/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E011/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E012/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E013/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E016/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E024/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E027/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E028/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E037/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E038/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E047/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E050/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E053/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E054/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E055/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E056/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E057/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E058/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E059/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E061/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E062/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E065/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E066/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E070/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E071/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E079/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E082/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E084/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E085/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E087/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E094/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E095/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E096/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E097/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E098/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E100/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E104/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E105/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E106/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E109/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E112/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E113/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E114/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E116/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E117/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E118/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E119/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E120/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E122/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E123/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E127/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/Models/E128/model.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: https://zenodo.org/record/2616712/files/E003_attchrome_avgAUC_model.pt?download=1 7 | md5: 93d22f74bb42fc88e720f075310e58b0 8 | default_dataloader: . # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | info: # General information about the model 10 | authors: 11 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 12 | github: jacklanchantin 13 | email: jjl5sw@virginia.edu 14 | contributors: 15 | - name: Jeffrey Yoo 16 | doc: Gene Expression Prediction 17 | cite_as: https://doi.org:/10.1101/329334 18 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 19 | license: MIT 20 | dependencies: 21 | conda: # install via conda 22 | - python=3.5 23 | - h5py 24 | - soumith::pytorch # specify packages from other channels via :: 25 | - numpy 26 | - soumith::torchvision 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/README.md: -------------------------------------------------------------------------------- 1 | # Attentive Chrome Kipoi 2 | 3 | ## Dependency Requirements 4 | * python>=3.5 5 | * numpy 6 | * pytorch-cpu 7 | * torchvision-cpu 8 | 9 | ## Quick Start 10 | ### Creating new conda environtment using kipoi 11 | `kipoi env create AttentiveChrome` 12 | 13 | ### Activating environment 14 | `conda activate kipoi-AttentiveChrome` 15 | 16 | ## Command Line 17 | ### Getting example input file 18 | Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 19 | 20 | `kipoi get-example AttentiveChrome/{model_name} -o example_file` 21 | 22 | example: `kipoi get-example AttentiveChrome/E003 -o example_file` 23 | 24 | ### Predicting using example file 25 | `kipoi predict AttentiveChrome/{model_name} --dataloader_args='{"input_file": "example_file/input_file", "bin_size": 100}' -o example_predict.tsv` 26 | 27 | This should produce a tsv file containing the results. 28 | 29 | ## Python 30 | ### Fetching the model 31 | First, import kipoi: 32 | `import kipoi` 33 | 34 | Next, get the model. Replace {model_name} with the actual name of model (e.g. E003, E005, etc.) 35 | 36 | `model = kipoi.get_model("AttentiveChrome/{model_name}")` 37 | 38 | ### Predicting using pipeline 39 | `prediction = model.pipeline.predict({"input_file": "path to input file", "bin_size": {some integer}})` 40 | 41 | This returns a numpy array containing the output from the final softmax function. 42 | 43 | e.g. `model.pipeline.predict({"input_file": "data/input_file", "bin_size": 100})` 44 | 45 | ### Predicting for a single batch 46 | First, we need to set up our dataloader `dl`. 47 | 48 | `dl = model.default_dataloader(input_file="path to input file", bin_size={some integer})` 49 | 50 | Next, we can use the iterator functionality of the dataloader. 51 | 52 | `it = dl.batch_iter(batch_size=32)` 53 | 54 | `single_batch = next(it)` 55 | 56 | First line gets us an iterator named `it` with each batch containing 32 items. We can use `next(it)` to get a batch. 57 | 58 | Then, we can perform prediction on this single batch. 59 | 60 | `prediction = model.predict_on_batch(single_batch['inputs'])` 61 | 62 | This also returns a numpy array containing the output from the final softmax function. 63 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/dataloader.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import collections 3 | import pdb 4 | import csv 5 | from kipoi.data import Dataset 6 | import math 7 | import numpy as np 8 | 9 | class HMData(Dataset): 10 | # Dataset class for loading data 11 | def __init__(self, input_file, bin_size=100): 12 | self.hm_data = self.loadData(input_file, bin_size) 13 | 14 | 15 | def loadData(self,filename,windows): 16 | with open(filename) as fi: 17 | csv_reader=csv.reader(fi) 18 | data=list(csv_reader) 19 | 20 | ncols=(len(data[0])) 21 | fi.close() 22 | nrows=len(data) 23 | ngenes=nrows/windows 24 | nfeatures=ncols-1 25 | print("Number of genes: %d" % ngenes) 26 | print("Number of entries: %d" % nrows) 27 | print("Number of HMs: %d" % nfeatures) 28 | 29 | count=0 30 | attr=collections.OrderedDict() 31 | 32 | for i in range(0,nrows,windows): 33 | hm1=torch.zeros(windows,1) 34 | hm2=torch.zeros(windows,1) 35 | hm3=torch.zeros(windows,1) 36 | hm4=torch.zeros(windows,1) 37 | hm5=torch.zeros(windows,1) 38 | for w in range(0,windows): 39 | hm1[w][0]=int(data[i+w][2]) 40 | hm2[w][0]=int(data[i+w][3]) 41 | hm3[w][0]=int(data[i+w][4]) 42 | hm4[w][0]=int(data[i+w][5]) 43 | hm5[w][0]=int(data[i+w][6]) 44 | geneID=str(data[i][0].split("_")[0]) 45 | 46 | thresholded_expr = int(data[i+w][7]) 47 | 48 | attr[count]={ 49 | 'geneID':geneID, 50 | 'expr':thresholded_expr, 51 | 'hm1':hm1, 52 | 'hm2':hm2, 53 | 'hm3':hm3, 54 | 'hm4':hm4, 55 | 'hm5':hm5 56 | } 57 | count+=1 58 | 59 | return attr 60 | 61 | 62 | def __len__(self): 63 | return len(self.hm_data) 64 | 65 | def __getitem__(self,i): 66 | final_data=torch.cat((self.hm_data[i]['hm1'],self.hm_data[i]['hm2'],self.hm_data[i]['hm3'],self.hm_data[i]['hm4'],self.hm_data[i]['hm5']),1) 67 | final_data = final_data.numpy() 68 | label = self.hm_data[i]['expr'] 69 | geneID = self.hm_data[i]['geneID'] 70 | 71 | 72 | return_item={ 73 | 'inputs': final_data, 74 | 'metadata': {'geneID':geneID,'label':label} 75 | } 76 | 77 | return return_item 78 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/dataloader.yaml: -------------------------------------------------------------------------------- 1 | defined_as: dataloader.HMData 2 | args: 3 | input_file: 4 | doc: "Path of the histone modification read count file." 5 | example: 6 | url: https://zenodo.org/record/2616712/files/test.csv?download=1 7 | md5: 332d389b6860e39f9863c54544cbd2a4 8 | bin_size: 9 | doc: "Size of bin" 10 | optional: true 11 | dependencies: 12 | conda: # install via conda 13 | - python>=3.5 14 | - pytorch::pytorch-cpu 15 | - numpy 16 | info: # General information about the dataloader 17 | authors: 18 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 19 | github: jacklanchantin 20 | email: jjl5sw@virginia.edu 21 | contributors: 22 | - name: Jeffrey Yoo 23 | doc: "Dataloader for Gene Expression Prediction" 24 | cite_as: https://doi.org:/10.1101/329334 25 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 26 | license: MIT 27 | output_schema: 28 | inputs: 29 | associated_metadata: geneID, label 30 | doc: Histone Modification Bin Matrix 31 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 32 | metadata: 33 | geneID: 34 | doc: "gene ID" 35 | type: str 36 | label: 37 | doc: "label for gene expression (binary)" 38 | type: int 39 | type: Dataset 40 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/json_reader.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | 4 | with open('files.json') as f: 5 | data = json.load(f) 6 | 7 | 8 | with open('models.tsv','w') as f: 9 | f.write('cell_type\tmodel link\tmd5\n') 10 | for file in data['files']: 11 | if '.pt' in file['links']['self']: 12 | cell_type = file['links']['self'].split('/')[-1].split('_')[0] 13 | f.write(cell_type+'\t') 14 | f.write(file['links']['self']+'?download=1'+'\t') 15 | f.write(file['checksum'].split('md5:')[1]+'\n') 16 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/model-template.yaml: -------------------------------------------------------------------------------- 1 | type: pytorch 2 | args: 3 | module_file: models.py 4 | module_obj: att_chrome_model 5 | weights: 6 | url: {{model_url}} 7 | md5: {{model_md5}} 8 | default_dataloader: .. # path to the dataloader directory. Or to the dataloader class, e.g.: `kipoiseq.dataloaders.SeqIntervalDl 9 | 10 | info: # General information about the model 11 | authors: 12 | - name: Ritambhara Singh, Jack Lanchantin, Arshdeep Sekhon, Yanjun Qi 13 | github: jacklanchantin 14 | email: jjl5sw@virginia.edu 15 | contributors: 16 | - name: Jeffrey Yoo 17 | doc: Gene Expression Prediction 18 | cite_as: https://doi.org:/10.1101/329334 19 | trained_on: Histone Modidification and RNA Seq Data From Roadmad/REMC database # short dataset description 20 | license: MIT 21 | dependencies: 22 | conda: # install via conda 23 | - python>=3.5 24 | - numpy 25 | - pytorch::pytorch-cpu 26 | - pytorch::torchvision-cpu 27 | schema: # Model schema 28 | inputs: 29 | shape: (100, 5) # array shape of a single sample (omitting the batch dimension) 30 | doc: "Histone Modification Bin Matrix" 31 | targets: 32 | shape: (1, ) 33 | doc: "Binary Classification" 34 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import torch 3 | import torch.nn as nn 4 | import torch.nn.functional as F 5 | import numpy as np 6 | from pdb import set_trace as stop 7 | 8 | def batch_product(iput, mat2): 9 | result = None 10 | for i in range(iput.size()[0]): 11 | op = torch.mm(iput[i], mat2) 12 | op = op.unsqueeze(0) 13 | if(result is None): 14 | result = op 15 | else: 16 | result = torch.cat((result,op),0) 17 | return result.squeeze(2) 18 | 19 | 20 | class rec_attention(nn.Module): 21 | # attention with bin context vector per HM and HM context vector 22 | def __init__(self,hm,args): 23 | super(rec_attention,self).__init__() 24 | self.num_directions=2 if args.bidirectional else 1 25 | if (hm==False): 26 | self.bin_rep_size=args.bin_rnn_size*self.num_directions 27 | else: 28 | self.bin_rep_size=args.bin_rnn_size 29 | 30 | self.bin_context_vector=nn.Parameter(torch.Tensor(self.bin_rep_size,1),requires_grad=True) 31 | 32 | 33 | self.softmax=nn.Softmax(dim=1) 34 | 35 | self.bin_context_vector.data.uniform_(-0.1, 0.1) 36 | 37 | def forward(self,iput): 38 | alpha=self.softmax(batch_product(iput,self.bin_context_vector)) 39 | [batch_size,source_length,bin_rep_size2]=iput.size() 40 | repres=torch.bmm(alpha.unsqueeze(2).view(batch_size,-1,source_length),iput) 41 | return repres,alpha 42 | 43 | 44 | 45 | class recurrent_encoder(nn.Module): 46 | # modular LSTM encoder 47 | def __init__(self,n_bins,ip_bin_size,hm,args): 48 | super(recurrent_encoder,self).__init__() 49 | self.bin_rnn_size=args.bin_rnn_size 50 | self.ipsize=ip_bin_size 51 | self.seq_length=n_bins 52 | 53 | self.num_directions=2 if args.bidirectional else 1 54 | if (hm==False): 55 | self.bin_rnn_size=args.bin_rnn_size 56 | else: 57 | self.bin_rnn_size=args.bin_rnn_size // 2 58 | self.bin_rep_size=self.bin_rnn_size*self.num_directions 59 | 60 | 61 | self.rnn=nn.LSTM(self.ipsize,self.bin_rnn_size,num_layers=args.num_layers,dropout=args.dropout,bidirectional=args.bidirectional) 62 | 63 | self.bin_attention=rec_attention(hm,args) 64 | def outputlength(self): 65 | return self.bin_rep_size 66 | def forward(self,single_hm,hidden=None): 67 | bin_output, hidden = self.rnn(single_hm,hidden) 68 | bin_output = bin_output.permute(1,0,2) 69 | hm_rep,bin_alpha = self.bin_attention(bin_output) 70 | return hm_rep,bin_alpha 71 | 72 | 73 | class AttrDict(dict): 74 | def __init__(self, *args, **kwargs): 75 | super(AttrDict, self).__init__(*args, **kwargs) 76 | self.__dict__ = self 77 | 78 | 79 | class att_chrome(nn.Module): 80 | def __init__(self,args): 81 | super(att_chrome,self).__init__() 82 | self.n_hms=args.n_hms 83 | self.n_bins=args.n_bins 84 | self.ip_bin_size=1 85 | 86 | self.rnn_hms=nn.ModuleList() 87 | for i in range(self.n_hms): 88 | self.rnn_hms.append(recurrent_encoder(self.n_bins,self.ip_bin_size,False,args)) 89 | self.opsize = self.rnn_hms[0].outputlength() 90 | self.hm_level_rnn_1=recurrent_encoder(self.n_hms,self.opsize,True,args) 91 | self.opsize2=self.hm_level_rnn_1.outputlength() 92 | self.diffopsize=2*(self.opsize2) 93 | self.fdiff1_1=nn.Linear(self.opsize2,1) 94 | 95 | def forward(self,iput): 96 | 97 | bin_a=None 98 | level1_rep=None 99 | [batch_size,_,_]=iput.size() 100 | 101 | for hm,hm_encdr in enumerate(self.rnn_hms): 102 | hmod=iput[:,:,hm].contiguous() 103 | hmod=torch.t(hmod).unsqueeze(2) 104 | 105 | op,a= hm_encdr(hmod) 106 | if level1_rep is None: 107 | level1_rep=op 108 | bin_a=a 109 | else: 110 | level1_rep=torch.cat((level1_rep,op),1) 111 | bin_a=torch.cat((bin_a,a),1) 112 | level1_rep=level1_rep.permute(1,0,2) 113 | final_rep_1,hm_level_attention_1=self.hm_level_rnn_1(level1_rep) 114 | final_rep_1=final_rep_1.squeeze(1) 115 | prediction_m=((self.fdiff1_1(final_rep_1))) 116 | 117 | return torch.sigmoid(prediction_m) 118 | 119 | args_dict = {'lr': 0.0001, 'model_name': 'attchrome', 'clip': 1, 'epochs': 2, 'batch_size': 10, 'dropout': 0.5, 'cell_1': 'Cell1', 'save_root': 'Results/Cell1', 'data_root': 'data/', 'gpuid': 0, 'gpu': 0, 'n_hms': 5, 'n_bins': 200, 'bin_rnn_size': 32, 'num_layers': 1, 'unidirectional': False, 'save_attention_maps': False, 'attentionfilename': 'beta_attention.txt', 'test_on_saved_model': False, 'bidirectional': True, 'dataset': 'Cell1'} 120 | att_chrome_args = AttrDict(args_dict) 121 | att_chrome_model = att_chrome(att_chrome_args) 122 | 123 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/models.tsv: -------------------------------------------------------------------------------- 1 | cell_type model link md5 2 | E003 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E003_attchrome_avgAUC_model.pt?download=1 9b4ff730ac5e70265f7a78162fa76768 3 | E004 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E004_attchrome_avgAUC_model.pt?download=1 36edb7c1561bf26c29ebbd72fae9e6a2 4 | E005 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E005_attchrome_avgAUC_model.pt?download=1 19f61dca439ffcf7bbe44ca15238ff4d 5 | E006 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E006_attchrome_avgAUC_model.pt?download=1 6bf8b66481a97a3b8b1f6c019432a1e0 6 | E007 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E007_attchrome_avgAUC_model.pt?download=1 da2104816feafbf1a2567af71a9be2d8 7 | E011 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E011_attchrome_avgAUC_model.pt?download=1 51b455dbe695e3e059162c8154b09a74 8 | E012 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E012_attchrome_avgAUC_model.pt?download=1 a0359c3462a8bbee23fb11e3ada5c43a 9 | E013 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E013_attchrome_avgAUC_model.pt?download=1 1ca6c07c12773d6c69052959d6807ddc 10 | E016 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E016_attchrome_avgAUC_model.pt?download=1 25e8e91376dfecca41087d4560c3e9ee 11 | E024 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E024_attchrome_avgAUC_model.pt?download=1 34f1c4de69988560f63d983daf35a05f 12 | E027 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E027_attchrome_avgAUC_model.pt?download=1 a878a845467287d8e9d821ed44c5ad93 13 | E028 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E028_attchrome_avgAUC_model.pt?download=1 ad019b35a52fae8971df9790eb70e050 14 | E037 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E037_attchrome_avgAUC_model.pt?download=1 45e32e1ab02692ad529de480761329de 15 | E038 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E038_attchrome_avgAUC_model.pt?download=1 39036cd5afa8fc95222f88c2c9ad2ee6 16 | E047 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E047_attchrome_avgAUC_model.pt?download=1 5428bbb213fb90e47205a753e7820aef 17 | E050 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E050_attchrome_avgAUC_model.pt?download=1 e2b2edf9cf44d0c892b5619fc537ce57 18 | E053 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E053_attchrome_avgAUC_model.pt?download=1 5237ab0e405298e1fd616f57bbdcd8d7 19 | E054 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E054_attchrome_avgAUC_model.pt?download=1 1fd0ccc28e1c204574763a6dbb3e6c77 20 | E055 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E055_attchrome_avgAUC_model.pt?download=1 f7f6dff85b274ee77179095c97421167 21 | E056 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E056_attchrome_avgAUC_model.pt?download=1 93fdbc651eb966a94298a0c1d3452b8b 22 | E057 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E057_attchrome_avgAUC_model.pt?download=1 37176c4f55a477e4d661ddcb8ac4a063 23 | E058 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E058_attchrome_avgAUC_model.pt?download=1 a84d022064081663cdeba823e3d82d28 24 | E061 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E061_attchrome_avgAUC_model.pt?download=1 0f777b410ade532bba4d0b90e827bb31 25 | E062 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E062_attchrome_avgAUC_model.pt?download=1 f29133dd6809c451dfe94e9a8dfebe18 26 | E065 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E065_attchrome_avgAUC_model.pt?download=1 c29295513ed0af1f038be4d1a2846fe5 27 | E066 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E066_attchrome_avgAUC_model.pt?download=1 2e6ddfc87be8e2a1f86b6fc22a32c228 28 | E070 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E070_attchrome_avgAUC_model.pt?download=1 f164f58f1965b3bd61eb5ae04a57def5 29 | E071 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E071_attchrome_avgAUC_model.pt?download=1 333566e947e04a9dfdc543b6c489b1c3 30 | E079 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E079_attchrome_avgAUC_model.pt?download=1 978c928625b8027bad8898c7aeac622b 31 | E082 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E082_attchrome_avgAUC_model.pt?download=1 8b9d27c361c1ad258bde428fa72c8980 32 | E084 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E084_attchrome_avgAUC_model.pt?download=1 c0c1009fe4febfbf7dc64406466d8459 33 | E085 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E085_attchrome_avgAUC_model.pt?download=1 452ae1b368bf7b37d38ec89db51e463f 34 | E087 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E087_attchrome_avgAUC_model.pt?download=1 22137bd5dc6bdb78bdde944297c4ec54 35 | E094 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E094_attchrome_avgAUC_model.pt?download=1 f83430563d10c76f0396ed5574bee820 36 | E095 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E095_attchrome_avgAUC_model.pt?download=1 37130b60530f29aaf485a9789c905a2e 37 | E096 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E096_attchrome_avgAUC_model.pt?download=1 2be0fa577637386851bba657d6af60b5 38 | E097 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E097_attchrome_avgAUC_model.pt?download=1 97d266de1fce0c207d141126ff5cb143 39 | E098 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E098_attchrome_avgAUC_model.pt?download=1 8b40090f6217e0c252f56f92c5719a74 40 | E100 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E100_attchrome_avgAUC_model.pt?download=1 89867aede18576cf245501be1b66de3c 41 | E104 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E104_attchrome_avgAUC_model.pt?download=1 6d7defac37ffaf3bec204f76892eb2f2 42 | E105 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E105_attchrome_avgAUC_model.pt?download=1 c773aac4b33885e6f69f0241a2b84931 43 | E106 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E106_attchrome_avgAUC_model.pt?download=1 5d73011e3345e5d998d81169a8ea28c1 44 | E109 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E109_attchrome_avgAUC_model.pt?download=1 689f51758a873d0c99d32e5e8c80513b 45 | E112 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E112_attchrome_avgAUC_model.pt?download=1 a671823c56b8b4e000baec18562540aa 46 | E113 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E113_attchrome_avgAUC_model.pt?download=1 586b6c6c003a7c919fde57d2be0f5180 47 | E114 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E114_attchrome_avgAUC_model.pt?download=1 5ca9959f7442342907c2c5f0bc26d73b 48 | E116 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E116_attchrome_avgAUC_model.pt?download=1 ecdeb5d30b6124b0bce0d5e45046cab9 49 | E117 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E117_attchrome_avgAUC_model.pt?download=1 11be77c7266b198ee3f2fc74e452395c 50 | E118 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E118_attchrome_avgAUC_model.pt?download=1 65bd6369cddb01a837910694b84d00a6 51 | E119 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E119_attchrome_avgAUC_model.pt?download=1 ea3e5d604a4b69c3b26066e5d23dfe12 52 | E120 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E120_attchrome_avgAUC_model.pt?download=1 98beb529d183c7b0d3ce661699a4d6aa 53 | E122 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E122_attchrome_avgAUC_model.pt?download=1 eb26f18e6458bc4053c2dbdd1a95c6ac 54 | E123 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E123_attchrome_avgAUC_model.pt?download=1 dae6687bc9e6ac27945c176a9cacc9cc 55 | E127 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E127_attchrome_avgAUC_model.pt?download=1 9536df4e7822b0a14d2d50c451f47b1f 56 | E128 https://zenodo.org/api/files/2bf982b6-143f-49f6-b9ad-1b1e60f67292/E128_attchrome_avgAUC_model.pt?download=1 458eb929a4691faad12a274e2c727f50 57 | -------------------------------------------------------------------------------- /v2PyTorch/kipoiUtil/test_predict.py: -------------------------------------------------------------------------------- 1 | import kipoi 2 | import numpy as np 3 | 4 | example_input = "./downloaded/example_files/input_file" 5 | example_expr = "./downloaded/example_files/expr_file" 6 | 7 | #DataLoader = kipoi.get_dataloader_factory(".", source="dir") 8 | #print(DataLoader(example_input, example_expr).__getitem__(1)) 9 | 10 | model = kipoi.get_model(".", source="dir") 11 | prediction = model.pipeline.predict({"input_file": example_input, "expr_file": example_expr}) 12 | 13 | print("Output Return Type: ", type(prediction)) 14 | print(len(prediction)) 15 | print(len(prediction[0])) 16 | print(len(prediction[0][1])) 17 | print(len(prediction[1][1])) 18 | print(len(prediction[2][1])) 19 | #for i in range(len(prediction)): 20 | # for j in range(len(prediction[0])): 21 | # print(len(prediction[i][j])) 22 | 23 | #print("Output Shape: ", np.array(prediction).shape) -------------------------------------------------------------------------------- /v2PyTorch/models.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import torch 3 | import torch.nn as nn 4 | import torch.nn.functional as F 5 | import numpy as np 6 | from pdb import set_trace as stop 7 | 8 | def batch_product(iput, mat2): 9 | result = None 10 | for i in range(iput.size()[0]): 11 | op = torch.mm(iput[i], mat2) 12 | op = op.unsqueeze(0) 13 | if(result is None): 14 | result = op 15 | else: 16 | result = torch.cat((result,op),0) 17 | return result.squeeze(2) 18 | 19 | 20 | class rec_attention(nn.Module): 21 | # attention with bin context vector per HM and HM context vector 22 | def __init__(self,hm,args): 23 | super(rec_attention,self).__init__() 24 | self.num_directions=2 if args.bidirectional else 1 25 | if (hm==False): 26 | self.bin_rep_size=args.bin_rnn_size*self.num_directions 27 | else: 28 | self.bin_rep_size=args.bin_rnn_size 29 | 30 | self.bin_context_vector=nn.Parameter(torch.Tensor(self.bin_rep_size,1),requires_grad=True) 31 | 32 | 33 | self.softmax=nn.Softmax(dim=1) 34 | 35 | self.bin_context_vector.data.uniform_(-0.1, 0.1) 36 | 37 | def forward(self,iput): 38 | alpha=self.softmax(batch_product(iput,self.bin_context_vector)) 39 | [batch_size,source_length,bin_rep_size2]=iput.size() 40 | repres=torch.bmm(alpha.unsqueeze(2).view(batch_size,-1,source_length),iput) 41 | return repres,alpha 42 | 43 | 44 | 45 | class recurrent_encoder(nn.Module): 46 | # modular LSTM encoder 47 | def __init__(self,n_bins,ip_bin_size,hm,args): 48 | super(recurrent_encoder,self).__init__() 49 | self.bin_rnn_size=args.bin_rnn_size 50 | self.ipsize=ip_bin_size 51 | self.seq_length=n_bins 52 | 53 | self.num_directions=2 if args.bidirectional else 1 54 | if (hm==False): 55 | self.bin_rnn_size=args.bin_rnn_size 56 | else: 57 | self.bin_rnn_size=args.bin_rnn_size // 2 58 | self.bin_rep_size=self.bin_rnn_size*self.num_directions 59 | 60 | 61 | self.rnn=nn.LSTM(self.ipsize,self.bin_rnn_size,num_layers=args.num_layers,dropout=args.dropout,bidirectional=args.bidirectional) 62 | 63 | self.bin_attention=rec_attention(hm,args) 64 | def outputlength(self): 65 | return self.bin_rep_size 66 | def forward(self,single_hm,hidden=None): 67 | bin_output, hidden = self.rnn(single_hm,hidden) 68 | bin_output = bin_output.permute(1,0,2) 69 | hm_rep,bin_alpha = self.bin_attention(bin_output) 70 | return hm_rep,bin_alpha 71 | 72 | 73 | class AttrDict(dict): 74 | def __init__(self, *args, **kwargs): 75 | super(AttrDict, self).__init__(*args, **kwargs) 76 | self.__dict__ = self 77 | 78 | 79 | class att_chrome(nn.Module): 80 | def __init__(self,args): 81 | super(att_chrome,self).__init__() 82 | self.n_hms=args.n_hms 83 | self.n_bins=args.n_bins 84 | self.ip_bin_size=1 85 | 86 | self.rnn_hms=nn.ModuleList() 87 | for i in range(self.n_hms): 88 | self.rnn_hms.append(recurrent_encoder(self.n_bins,self.ip_bin_size,False,args)) 89 | self.opsize = self.rnn_hms[0].outputlength() 90 | self.hm_level_rnn_1=recurrent_encoder(self.n_hms,self.opsize,True,args) 91 | self.opsize2=self.hm_level_rnn_1.outputlength() 92 | self.diffopsize=2*(self.opsize2) 93 | self.fdiff1_1=nn.Linear(self.opsize2,1) 94 | 95 | def forward(self,iput): 96 | 97 | bin_a=None 98 | level1_rep=None 99 | [batch_size,_,_]=iput.size() 100 | 101 | for hm,hm_encdr in enumerate(self.rnn_hms): 102 | hmod=iput[:,:,hm].contiguous() 103 | hmod=torch.t(hmod).unsqueeze(2) 104 | 105 | op,a= hm_encdr(hmod) 106 | if level1_rep is None: 107 | level1_rep=op 108 | bin_a=a 109 | else: 110 | level1_rep=torch.cat((level1_rep,op),1) 111 | bin_a=torch.cat((bin_a,a),1) 112 | level1_rep=level1_rep.permute(1,0,2) 113 | final_rep_1,hm_level_attention_1=self.hm_level_rnn_1(level1_rep) 114 | final_rep_1=final_rep_1.squeeze(1) 115 | prediction_m=((self.fdiff1_1(final_rep_1))) 116 | 117 | return prediction_m 118 | 119 | args_dict = {'lr': 0.0001, 'model_name': 'attchrome', 'clip': 1, 'epochs': 2, 'batch_size': 10, 'dropout': 0.5, 'cell_1': 'Cell1', 'save_root': 'Results/Cell1', 'data_root': 'data/', 'gpuid': 0, 'gpu': 0, 'n_hms': 5, 'n_bins': 200, 'bin_rnn_size': 32, 'num_layers': 1, 'unidirectional': False, 'save_attention_maps': False, 'attentionfilename': 'beta_attention.txt', 'test_on_saved_model': False, 'bidirectional': True, 'dataset': 'Cell1'} 120 | att_chrome_args = AttrDict(args_dict) 121 | att_chrome_model = att_chrome(att_chrome_args) 122 | 123 | -------------------------------------------------------------------------------- /v2PyTorch/train.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings("ignore") 3 | import argparse 4 | import json 5 | # import matplotlib 6 | # import matplotlib.pyplot as plt 7 | import math 8 | import torch 9 | import torch.nn as nn 10 | import torch.optim as optim 11 | import torch.nn.functional as F 12 | from torch import cuda 13 | import sys, os 14 | import random 15 | import numpy as np 16 | from sklearn import metrics 17 | import models as Model 18 | # from SiameseLoss import ContrastiveLoss 19 | import evaluate 20 | import data 21 | import gc 22 | import csv 23 | from pdb import set_trace as stop 24 | 25 | # python train.py --cell_type=Cell1 --model_name=attchrome --epochs=120 --lr=0.0001 --data_root=data/ --save_root=Results/ 26 | 27 | parser = argparse.ArgumentParser(description='DeepDiff') 28 | parser.add_argument('--lr', type=float, default=0.0002, help='initial learning rate') 29 | parser.add_argument('--model_type', type=str, default='attchrome', help='DeepDiff variation') 30 | parser.add_argument('--clip', type=float, default=1,help='gradient clipping') 31 | parser.add_argument('--epochs', type=int, default=30, help='upper epoch limit') 32 | parser.add_argument('--batch_size', type=int, default=16, help='') 33 | parser.add_argument('--dropout', type=float, default=0.5, help='dropout applied to layers (0 = no dropout) if n_layers LSTM > 1') 34 | parser.add_argument('--cell_type', type=str, default='E003', help='cell type 1') 35 | parser.add_argument('--save_root', type=str, default='./Results/', help='where to save') 36 | parser.add_argument('--data_root', type=str, default='./data/', help='data location') 37 | parser.add_argument('--gpuid', type=int, default=0, help='CUDA gpu') 38 | parser.add_argument('--gpu', type=int, default=0, help='CUDA gpu') 39 | parser.add_argument('--n_hms', type=int, default=5, help='number of histone modifications') 40 | parser.add_argument('--n_bins', type=int, default=100, help='number of bins') 41 | parser.add_argument('--bin_rnn_size', type=int, default=32, help='bin rnn size') 42 | parser.add_argument('--num_layers', type=int, default=1, help='number of layers') 43 | parser.add_argument('--unidirectional', action='store_true', help='bidirectional/undirectional LSTM') 44 | parser.add_argument('--save_attention_maps',action='store_true', help='set to save validation beta attention maps') 45 | parser.add_argument('--attentionfilename', type=str, default='beta_attention.txt', help='where to save attnetion maps') 46 | parser.add_argument('--test_on_saved_model',action='store_true', help='only test on saved model') 47 | args = parser.parse_args() 48 | 49 | 50 | 51 | 52 | torch.manual_seed(1) 53 | 54 | 55 | model_name = '' 56 | model_name += (args.cell_type)+('_') 57 | 58 | model_name+=args.model_type 59 | 60 | 61 | 62 | args.bidirectional=not args.unidirectional 63 | 64 | print('the model name: ',model_name) 65 | args.data_root+='' 66 | args.save_root+='' 67 | args.dataset=args.cell_type 68 | args.data_root = os.path.join(args.data_root) 69 | print('loading data from: ',args.data_root) 70 | args.save_root = os.path.join(args.save_root,args.dataset) 71 | print('saving results in from: ',args.save_root) 72 | model_dir = os.path.join(args.save_root,model_name) 73 | if not os.path.exists(model_dir): 74 | os.makedirs(model_dir) 75 | 76 | 77 | 78 | attentionmapfile=model_dir+'/'+args.attentionfilename 79 | print('==>processing data') 80 | Train,Valid,Test = data.load_data(args) 81 | 82 | 83 | 84 | 85 | 86 | 87 | print('==>building model') 88 | model = Model.att_chrome(args) 89 | 90 | 91 | 92 | if torch.cuda.device_count() > 0: 93 | torch.cuda.manual_seed_all(1) 94 | dtype = torch.cuda.FloatTensor 95 | # cuda.set_device(args.gpuid) 96 | model.type(dtype) 97 | print('Using GPU '+str(args.gpuid)) 98 | else: 99 | dtype = torch.FloatTensor 100 | 101 | print(model) 102 | if(args.test_on_saved_model==False): 103 | print("==>initializing a new model") 104 | for p in model.parameters(): 105 | p.data.uniform_(-0.1,0.1) 106 | 107 | 108 | optimizer = optim.Adam(model.parameters(), lr = args.lr) 109 | #optimizer = optim.SGD(model.parameters(), lr = args.lr, momentum=args.momentum) 110 | def train(TrainData): 111 | model.train() 112 | # initialize attention 113 | diff_targets = torch.zeros(TrainData.dataset.__len__(),1) 114 | predictions = torch.zeros(diff_targets.size(0),1) 115 | 116 | all_attention_bin=torch.zeros(TrainData.dataset.__len__(),(args.n_hms*args.n_bins)) 117 | all_attention_hm=torch.zeros(TrainData.dataset.__len__(),args.n_hms) 118 | 119 | num_batches = int(math.ceil(TrainData.dataset.__len__()/float(args.batch_size))) 120 | all_gene_ids=[None]*TrainData.dataset.__len__() 121 | per_epoch_loss = 0 122 | print('Training') 123 | for idx, Sample in enumerate(TrainData): 124 | 125 | start,end = (idx*args.batch_size), min((idx*args.batch_size)+args.batch_size, TrainData.dataset.__len__()) 126 | 127 | 128 | inputs_1 = Sample['input'] 129 | batch_diff_targets = Sample['label'].unsqueeze(1).float() 130 | 131 | 132 | optimizer.zero_grad() 133 | batch_predictions= model(inputs_1.type(dtype)) 134 | 135 | loss = F.binary_cross_entropy_with_logits(batch_predictions.cpu(), batch_diff_targets,reduction='mean') 136 | 137 | per_epoch_loss += loss.item() 138 | loss.backward() 139 | torch.nn.utils.clip_grad_norm(model.parameters(), args.clip) 140 | optimizer.step() 141 | 142 | # all_attention_bin[start:end]=batch_alpha.data 143 | # all_attention_hm[start:end]=batch_beta.data 144 | 145 | diff_targets[start:end,0] = batch_diff_targets[:,0] 146 | all_gene_ids[start:end]=Sample['geneID'] 147 | batch_predictions = torch.sigmoid(batch_predictions) 148 | predictions[start:end] = batch_predictions.data.cpu() 149 | 150 | per_epoch_loss=per_epoch_loss/num_batches 151 | return predictions,diff_targets,all_attention_bin,all_attention_hm,per_epoch_loss,all_gene_ids 152 | 153 | 154 | 155 | def test(ValidData,split_name): 156 | model.eval() 157 | 158 | diff_targets = torch.zeros(ValidData.dataset.__len__(),1) 159 | predictions = torch.zeros(diff_targets.size(0),1) 160 | 161 | all_attention_bin=torch.zeros(ValidData.dataset.__len__(),(args.n_hms*args.n_bins)) 162 | all_attention_hm=torch.zeros(ValidData.dataset.__len__(),args.n_hms) 163 | 164 | num_batches = int(math.ceil(ValidData.dataset.__len__()/float(args.batch_size))) 165 | all_gene_ids=[None]*ValidData.dataset.__len__() 166 | per_epoch_loss = 0 167 | print(split_name) 168 | for idx, Sample in enumerate(ValidData): 169 | 170 | start,end = (idx*args.batch_size), min((idx*args.batch_size)+args.batch_size, ValidData.dataset.__len__()) 171 | optimizer.zero_grad() 172 | 173 | inputs_1 = Sample['input'] 174 | batch_diff_targets= Sample['label'].unsqueeze(1).float() 175 | 176 | 177 | # batch_predictions,batch_beta,batch_alpha = model(inputs_1.type(dtype)) 178 | batch_predictions = model(inputs_1.type(dtype)) 179 | 180 | loss = F.binary_cross_entropy_with_logits(batch_predictions.cpu(), batch_diff_targets,reduction='mean') 181 | # all_attention_bin[start:end]=batch_alpha.data 182 | # all_attention_hm[start:end]=batch_beta.data 183 | 184 | 185 | diff_targets[start:end,0] = batch_diff_targets[:,0] 186 | all_gene_ids[start:end]=Sample['geneID'] 187 | batch_predictions = torch.sigmoid(batch_predictions) 188 | predictions[start:end] = batch_predictions.data.cpu() 189 | 190 | per_epoch_loss += loss.item() 191 | per_epoch_loss=per_epoch_loss/num_batches 192 | return predictions,diff_targets,all_attention_bin,all_attention_hm,per_epoch_loss,all_gene_ids 193 | 194 | 195 | 196 | 197 | best_valid_loss = 10000000000 198 | best_valid_avgAUPR=-1 199 | best_valid_avgAUC=-1 200 | best_test_avgAUC=-1 201 | if(args.test_on_saved_model==False): 202 | for epoch in range(0, args.epochs): 203 | print('---------------------------------------- Training '+str(epoch+1)+' -----------------------------------') 204 | predictions,diff_targets,alpha_train,beta_train,train_loss,_ = train(Train) 205 | train_avgAUPR, train_avgAUC = evaluate.compute_metrics(predictions,diff_targets) 206 | 207 | predictions,diff_targets,alpha_valid,beta_valid,valid_loss,gene_ids_valid = test(Valid,"Validation") 208 | valid_avgAUPR, valid_avgAUC = evaluate.compute_metrics(predictions,diff_targets) 209 | 210 | predictions,diff_targets,alpha_test,beta_test,test_loss,gene_ids_test = test(Test,'Testing') 211 | test_avgAUPR, test_avgAUC = evaluate.compute_metrics(predictions,diff_targets) 212 | 213 | if(valid_avgAUC >= best_valid_avgAUC): 214 | # save best epoch -- models converge early 215 | best_valid_avgAUC = valid_avgAUC 216 | best_test_avgAUC = test_avgAUC 217 | torch.save(model.cpu().state_dict(),model_dir+"/"+model_name+'_avgAUC_model.pt') 218 | model.type(dtype) 219 | 220 | print("Epoch:",epoch) 221 | print("train avgAUC:",train_avgAUC) 222 | print("valid avgAUC:",valid_avgAUC) 223 | print("test avgAUC:",test_avgAUC) 224 | print("best valid avgAUC:", best_valid_avgAUC) 225 | print("best test avgAUC:", best_test_avgAUC) 226 | 227 | 228 | print("\nFinished training") 229 | print("Best validation avgAUC:",best_valid_avgAUC) 230 | print("Best test avgAUC:",best_test_avgAUC) 231 | 232 | 233 | 234 | if(args.save_attention_maps): 235 | attentionfile=open(attentionmapfile,'w') 236 | attentionfilewriter=csv.writer(attentionfile) 237 | beta_test=beta_test.numpy() 238 | for i in range(len(gene_ids_test)): 239 | gene_attention=[] 240 | gene_attention.append(gene_ids_test[i]) 241 | for e in beta_test[i,:]: 242 | gene_attention.append(str(e)) 243 | attentionfilewriter.writerow(gene_attention) 244 | attentionfile.close() 245 | 246 | 247 | else: 248 | model=torch.load(model_dir+"/"+model_name+'_avgAUC_model.pt') 249 | predictions,diff_targets,alpha_test,beta_test,test_loss,gene_ids_test = test(Test) 250 | test_avgAUPR, test_avgAUC = evaluate.compute_metrics(predictions,diff_targets) 251 | print("test avgAUC:",test_avgAUC) 252 | 253 | if(args.save_attention_maps): 254 | attentionfile=open(attentionmapfile,'w') 255 | attentionfilewriter=csv.writer(attentionfile) 256 | beta_test=beta_test.numpy() 257 | for i in range(len(gene_ids_test)): 258 | gene_attention=[] 259 | gene_attention.append(gene_ids_test[i]) 260 | for e in beta_test[i,:]: 261 | gene_attention.append(str(e)) 262 | attentionfilewriter.writerow(gene_attention) 263 | attentionfile.close() 264 | --------------------------------------------------------------------------------