Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,16 +11,10 @@ scaler = MinMaxScaler()
|
|
| 11 |
def extract_features(sequence):
|
| 12 |
"""Calculate AAC, Dipeptide Composition, and normalize features."""
|
| 13 |
# Calculate Amino Acid Composition (AAC) and convert to array
|
| 14 |
-
aac = np.array(list(AAComposition
|
| 15 |
-
|
| 16 |
-
# Calculate Dipeptide Composition and convert to array
|
| 17 |
-
dipeptide_comp = np.array(list(AAComposition.CalculateAADipeptideComposition(sequence).values()))
|
| 18 |
-
|
| 19 |
-
# Combine both features (AAC and Dipeptide Composition)
|
| 20 |
-
features = np.concatenate((aac, dipeptide_comp))
|
| 21 |
-
|
| 22 |
# Normalize using the pre-trained scaler (Ensure the scaler is loaded correctly)
|
| 23 |
-
normalized_features = scaler.transform([
|
| 24 |
|
| 25 |
return normalized_features
|
| 26 |
|
|
|
|
| 11 |
def extract_features(sequence):
|
| 12 |
"""Calculate AAC, Dipeptide Composition, and normalize features."""
|
| 13 |
# Calculate Amino Acid Composition (AAC) and convert to array
|
| 14 |
+
aac = np.array(list(AAComposition..CalculateAADipeptideComposition(sequence)))
|
| 15 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# Normalize using the pre-trained scaler (Ensure the scaler is loaded correctly)
|
| 17 |
+
normalized_features = scaler.transform([aac]) # Don't use fit_transform(), only transform()
|
| 18 |
|
| 19 |
return normalized_features
|
| 20 |
|