Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,22 +43,7 @@ selected_features = [
|
|
| 43 |
"APAAC24"
|
| 44 |
]
|
| 45 |
|
| 46 |
-
def extract_features(sequence):
|
| 47 |
-
"""Extract selected features and normalize them."""
|
| 48 |
-
all_features = AAComposition.CalculateAADipeptideComposition(sequence)
|
| 49 |
-
feature_values = list(all_features.values())
|
| 50 |
-
feature_array = np.array(feature_values).reshape(-1, 1)
|
| 51 |
-
feature_array = feature_array[: 420] # Ensure we only use 420 features
|
| 52 |
-
normalized_features = scaler.transform(feature_array.T)
|
| 53 |
-
normalized_features = normalized_features.flatten()
|
| 54 |
-
|
| 55 |
-
# Select features that match training data
|
| 56 |
-
selected_feature_dict = {feature: normalized_features[i] for i, feature in enumerate(selected_features)
|
| 57 |
-
if feature in all_features}
|
| 58 |
-
selected_feature_df = pd.DataFrame([selected_feature_dict])
|
| 59 |
-
selected_feature_array = selected_feature_df.T.to_numpy()
|
| 60 |
|
| 61 |
-
return selected_feature_array
|
| 62 |
|
| 63 |
def extract_features(sequence):
|
| 64 |
"""Extract selected features and normalize them."""
|
|
|
|
| 43 |
"APAAC24"
|
| 44 |
]
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
|
|
|
| 47 |
|
| 48 |
def extract_features(sequence):
|
| 49 |
"""Extract selected features and normalize them."""
|