SequenceFeatureTransformer.fit
- SequenceFeatureTransformer.fit(X, y=None)[source]
Select CPP features from
(X, y)(the training fold) and store them.Runs
CPP.run()on the training fold only, so the selected features never see the held-out samples when the transformer sits inside a scikit-learnPipelineunder cross-validation. The selected feature ids are kept on the instance and reused bytransform().Added in version 1.1.0.
- Parameters:
X (pd.DataFrame, shape (n_samples, n_seq_info) or (n_samples, n_parts)) – A
df_seq(sequence information) or a pre-builtdf_parts.y (array-like, shape (n_samples,)) – Binary class labels (must contain
label_testandlabel_ref). Required.
- Returns:
self – The fitted transformer.
- Return type:
Examples
fitselects CPP features from(X, y)— the training fold only — and stores them onfeatures_/df_feat_. First, the dataset:import aaanalysis as aa aa.options["verbose"] = False # Disable verbosity # DOM_GSEC example dataset (df_seq with an 'entry' + 'sequence' column, one row per protein) df_seq = aa.load_dataset(name="DOM_GSEC", n=20) labels = df_seq["label"].to_list()
Pass the sequence DataFrame as
Xand the labels asy:sft = aa.SequenceFeatureTransformer(n_filter=50, random_state=42) sft.fit(X=df_seq, y=labels) aa.display_df(sft.df_feat_, n_rows=10, show_shape=True)
DataFrame shape: (50, 13)
feature category subcategory scale_name scale_description abs_auc abs_mean_dif mean_dif std_test std_ref p_val_mann_whitney p_val_fdr_bh positions 1 TMD-Pattern(C,4,8)-BEGF750101 Conformation α-helix α-helix Conformational ...in-Dirkx, 1975) 0.444000 0.299000 0.299000 0.090000 0.196000 0.000002 0.008336 23,27 2 TMD_C_JMD_C-Pat...4,8)-BEGF750101 Conformation α-helix α-helix Conformational ...in-Dirkx, 1975) 0.444000 0.299000 0.299000 0.090000 0.196000 0.000002 0.008336 24,28 3 TMD_C_JMD_C-Pat...,12)-CRAJ730103 Conformation β-turn β-turn Normalized freq...d et al., 1973) 0.431000 0.251000 -0.251000 0.088000 0.143000 0.000003 0.008336 24,28,32 4 TMD_C_JMD_C-Pat...,12)-MUNV940102 Energy Free energy (folding) Free energy (α-helix) Free energy in ...-Serrano, 1994) 0.422000 0.148000 -0.148000 0.056000 0.097000 0.000005 0.008730 24,28,32 5 TMD_C_JMD_C-Per...4,2)-BEGF750103 Conformation β-turn β-turn Conformational ...in-Dirkx, 1975) 0.409000 0.139000 -0.139000 0.098000 0.094000 0.000010 0.008730 23,27,31,35,39 6 TMD_C_JMD_C-Pat...,14)-ZIMJ680104 Energy Isoelectric point Isoelectric point Isoelectric poi...n et al., 1968) 0.402000 0.130000 0.130000 0.080000 0.088000 0.000013 0.008730 27,30,33 7 TMD_C_JMD_C-Pat...,14)-ZIMJ680104 Energy Isoelectric point Isoelectric point Isoelectric poi...n et al., 1968) 0.402000 0.130000 0.130000 0.080000 0.088000 0.000013 0.008730 28,31,34 8 TMD_C_JMD_C-Pat...,14)-MUNV940102 Energy Free energy (folding) Free energy (α-helix) Free energy in ...-Serrano, 1994) 0.391000 0.153000 -0.153000 0.067000 0.130000 0.000023 0.008730 27,31 9 TMD-Segment(10,11)-CHAM820102 Polarity Hydrophobicity (interface) Free energy (interface) Free energy of ...-Charton, 1982) 0.389000 0.169000 -0.169000 0.050000 0.130000 0.000026 0.008730 27,28 10 TMD_C_JMD_C-Per...3,1)-AURR980108 Conformation α-helix α-helix (N-terminal, inside) Normalized posi...ora-Rose, 1998) 0.385000 0.156000 0.156000 0.077000 0.105000 0.000031 0.008730 21,25,28,32,35,39