Andrew Stirn commited on
Commit
cf79aee
·
1 Parent(s): ecfb07a

unit-interval tiger model with web tool output transformation

Browse files
cutoff.npy ADDED
Binary file (132 Bytes). View file
 
model/fingerprint.pb CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:52d2b657d4a87fe128786cd8435a2f4c8d4e5d08571b12ff8911f100c0ee043b
3
- size 54
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50863a0916cffccddcaf74e2fd7ce7103ed14ccdd8ab99d668afd4f82c7bddd4
3
+ size 55
model/keras_metadata.pb CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e89af418a7cbb78442c6a65f20f2817352361b826189c4aad0de8a531aa5a8d
3
- size 13629
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d0f11e71ac2a87c7492ffcffb4952fa20be69acdf5ae4a0892087fe0534518e
3
+ size 13631
model/saved_model.pb CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f91692a0db6169ce09c321d292a7622468ea1b46c2f2293d97e43aa7c9cb9719
3
- size 241848
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c1e3ad2ce93d6b789ac232e88e3504244f5c82ce81266fa698944d75046a79b
3
+ size 242327
model/variables/variables.data-00000-of-00001 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ff1487ef1c93444ea6eeb6b023a0f4095aa0af473d98022d8c6e8b9e339d0add
3
  size 948103
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:414d4a3165687fac6ef187601e84b95dbecec6e73a5779ac7f46e099186bdeaa
3
  size 948103
model/variables/variables.index CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f00477f5d3801ba7e566cfcb16d16970ee88a94b716db4232e30ac27115bbfbd
3
  size 877
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9443a94e79ea78e84271801274ba69b826c4b1fd2190a9eff9e7406423eb13a3
3
  size 877
tiger.py CHANGED
@@ -1,6 +1,7 @@
1
  import argparse
2
  import os
3
  import gzip
 
4
  import pandas as pd
5
  import tensorflow as tf
6
  from Bio import SeqIO
@@ -98,6 +99,19 @@ def process_data(transcript_seq: str):
98
  return target_seq, guide_seq, model_inputs
99
 
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  def predict_on_target(transcript_seq: str, model: tf.keras.Model):
102
 
103
  # parse transcript sequence
 
1
  import argparse
2
  import os
3
  import gzip
4
+ import numpy as np
5
  import pandas as pd
6
  import tensorflow as tf
7
  from Bio import SeqIO
 
99
  return target_seq, guide_seq, model_inputs
100
 
101
 
102
+ def prediction_transform(predictions: np.array, cutoff_path: str = 'cutoff.npy'):
103
+ """
104
+ :param predictions: in [0,1] where 0 represents most active guides
105
+ :param cutoff_path: full path to cutoff.npy (a float in [0,1] above which guides are inactive)
106
+ :return: predictions in [0,1] where 1 represents most active guides
107
+ """
108
+ cutoff = np.load(cutoff_path)
109
+ predictions[predictions > cutoff] = cutoff + (predictions[predictions > cutoff] - cutoff) * 0.01
110
+ predictions = predictions.max() - predictions
111
+ predictions = predictions / predictions.max()
112
+ return predictions
113
+
114
+
115
  def predict_on_target(transcript_seq: str, model: tf.keras.Model):
116
 
117
  # parse transcript sequence