Views
No views yet
fold_0: Model of 5-fold cross-validation: Fold 0
model.chrombpnet.fold_0.encid.h5: full chrombpnet model that combines both bias and corrected model in .h5 formatmodel.chrombpnet_nobias.fold_0.encid.h5: bias-corrected accessibility model in .h5 format (Use for all biological discovery)model.bias_scaled.fold_0.encid.h5: bias model in .h5 formatmodel.chrombpnet.fold_0.encid.tar: full chrombpnet model that combines both bias and corrected model in SavedModel format. After being untarred, it results in a directory named "chrombpnet".model.chrombpnet_nobias.fold_0.encid.tar: bias-corrected accessibility model in SavedModel format (Use for all biological discovery). After being untarred, it results in a directory named "chrombpnet_wo_bias".model.bias_scaled.fold_0.encid.tar: bias model in SavedModel format. After being untarred, it results in a directory named "bias_model_scaled".logs.models.fold_0.encid: folder containing log files for training modelsfold_1: Model of 5-fold coss-validation: Fold 1fold_2: Model of 5-fold cross-validation: Fold 2fold_3: Model of 5-fold cross-validation: Fold 3fold_4: Model of 5-fold cross-validation: Fold 4model_in_h5_format and inputs. inputs is a one hot encoded sequence of shape (N,2114,4). Here N corresponds to the
number of tested sequences, 2114 is the input sequence length and 4 corresponds to [A,C,G,T].1import tensorflow as tf
2from tensorflow.keras.utils import get_custom_objects
3from tensorflow.keras.models import load_model
4
5custom_objects={"tf": tf}
6get_custom_objects().update(custom_objects)
7
8model=load_model(model_in_h5_format,compile=False)
9outputs = model(inputs)outputs consists of two elements. The first element has a shape of (N, 1000) and
contains logit predictions for a 1000-base-pair output. The second element, with a shape of
(N, 1), contains logcount predictions. To transform these predictions into per-base signals,
follow the provided pseudo code lines below.1import numpy as np
2
3def softmax(x, temp=1):
4 norm_x = x - np.mean(x,axis=1, keepdims=True)
5 return np.exp(temp*norm_x)/np.sum(np.exp(temp*norm_x), axis=1, keepdims=True)
6
7predictions = softmax(outputs[0]) * (np.exp(outputs[1])-1)tar -xvf model.tar. model_dir_untared and inputs. inputs is a one hot encoded sequence of shape (N,2114,4). Here N corresponds to the number
of tested sequences, 2114 is the input sequence length and 4 corresponds to ACGT.1import tensorflow as tf
2
3model = tf.saved_model.load('model_dir_untared')
4outputs = model.signatures['serving_default'](**{'sequence':inputs.astype('float32')})outputs represents a dictionary containing two key-value pairs. The first key
is logits_profile_predictions, holding a value with a shape of (N, 1000). This value corresponds
to logit predictions for a 1000-base-pair output. The second key, named `logcount_predictions``,
is associated with a value of shape (N, 1), representing logcount predictions. To transform these
predictions into per-base signals, utilize the provided pseudo code lines mentioned below.1import numpy as np
2def softmax(x, temp=1):
3 norm_x = x - np.mean(x,axis=1, keepdims=True)
4 return np.exp(temp*norm_x)/np.sum(np.exp(temp*norm_x), axis=1, keepdims=True)
5
6predictions = softmax(outputs["logits_profile_predictions"]) * (np.exp(outputs["logcount_predictions"])-1)