Skip to content

Commit ecd30a6

Browse files
update readme
1 parent 0c49ab5 commit ecd30a6

1 file changed

Lines changed: 8 additions & 36 deletions

File tree

README.md

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -104,62 +104,34 @@ ScoreList = List[Score]
104104

105105

106106
class App(DeepChainApp):
107-
"""
108-
DeepChain App template:
109-
Implement score_names() and compute_score() methods.
110-
Choose a a transformer available on DeepChain
111-
Choose a personal keras/tensorflow model
107+
"""DeepChain App template:
108+
109+
- Implement score_names() and compute_score() methods.
110+
- Choose a a transformer available on BioTranfformers
111+
- Choose a personal keras/tensorflow model
112112
"""
113113

114114
def __init__(self, device: str = "cuda:0"):
115115
self._device = device
116116
self.transformer = BioTransformers(backend="protbert", device=device)
117-
# TODO: fill _checkpoint_filename if needed
118117
# Make sure to put your checkpoint file in your_app/checkpoint folder
119118
self._checkpoint_filename: Optional[str] = "model.pt"
120119

121-
# TODO: Use proper loading function
122-
# load_model for tensorflow/keras model
123-
# load for pytorch model
120+
# load_model for tensorflow/keras model-load for pytorch model
124121
if self._checkpoint_filename is not None:
125122
self.model = load(self.get_checkpoint_path(__file__))
126123

127124
@staticmethod
128125
def score_names() -> List[str]:
129-
"""
130-
App Score Names. Must be specified.
126+
"""App Score Names. Must be specified.
131127
132128
Example:
133129
return ["max_probability", "min_probability"]
134130
"""
135-
# TODO: Put your own score_names here
136131
return ["probability"]
137132

138133
def compute_scores(self, sequences: List[str]) -> ScoreList:
139-
"""
140-
Return a list of all proteins score
141-
Score must be a list of dict:
142-
- element of list is protein score
143-
- key of dict are score_names, value is the scorexs
144-
145-
Example:
146-
Calculate embeddings with the pre-trained Tranformer module
147-
-- Use same embedding as the one for training the model!
148-
-- Get available embedding with :
149-
>> transformer.list_backend()
150-
>> embeddings = self.transformer.compute_embedding(sequences)
151-
152-
153-
Args:
154-
sequences (List[str]): List of proteins (str)
155-
156-
Returns:
157-
ScoreList: List of score (dictionnary with score_name as key)
158-
"""
159-
# TODO: Fill with you own score function
160-
161-
if not isinstance(sequences, list):
162-
sequences = [sequences]
134+
"""Return a list of all proteins score"""
163135

164136
x_embedding = self.transformer.compute_embeddings(sequences)["cls"]
165137
probabilities = self.model(torch.tensor(x_embedding).float())

0 commit comments

Comments
 (0)