Skip to content

Commit

Permalink
refine logic of terminal feature selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Bribak committed Jun 28, 2024
1 parent 3098e80 commit db9e9f9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build/lib/glycowork/motif/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ def get_glycoshift_per_site(df, group1, group2, paired = False, impute = True,
df, df_org, group1, group2 = preprocess_data(df, group1, group2, experiment = "diff", motifs = False, impute = impute,
min_samples = min_samples, transform = "Nothing", paired = paired)
alpha = get_alphaN(len(group1+group2))
df, glycan_features = process_for_glycoshift(df) # potentially expand this further to infer and label high-Man/Hybrid/complex
df, glycan_features = process_for_glycoshift(df)
necessary_columns = ['Glycoform'] + glycan_features
preserved_data = df[necessary_columns]
df = df.drop(necessary_columns, axis = 1)
Expand Down
4 changes: 2 additions & 2 deletions build/lib/glycowork/motif/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def annotate_switchboard(glycan):
shopping_cart.append(temp)
if 'chemical' in feature_set:
shopping_cart.append(get_molecular_properties(glycans, placeholder = True))
if 'terminal' or 'terminal1' or 'terminal2' in feature_set:
if 'terminal' in feature_set or 'terminal1' in feature_set or 'terminal2' in feature_set:
bag1, bag2 = [], []
if 'terminal' or 'terminal1' in feature_set:
if 'terminal' in feature_set or 'terminal1' in feature_set:
bag1 = list(map(get_terminal_structures, glycans))
if 'terminal2' in feature_set:
bag2 = [get_terminal_structures(glycan, size = 2) for glycan in glycans]
Expand Down
2 changes: 1 addition & 1 deletion build/lib/glycowork/motif/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def infer_features_from_composition(comp):
feature_dic['high_Man'] = 1
else:
feature_dic['high_Man'] = 0
if (comp.get('A', 0) + comp.get('G', 0) < 2 and comp.get('H', 0) > 4) or (comp.get('Neu5Ac', 0) + comp.get('Neu5Gc', 0) > 1 and comp.get('Hex', 0) > 4):
if (comp.get('A', 0) + comp.get('G', 0) < 2 and comp.get('H', 0) > 4) or (comp.get('Neu5Ac', 0) + comp.get('Neu5Gc', 0) < 2 and comp.get('Hex', 0) > 4):
feature_dic['hybrid'] = 1
else:
feature_dic['hybrid'] = 0
Expand Down
2 changes: 1 addition & 1 deletion glycowork/motif/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ def get_glycoshift_per_site(df, group1, group2, paired = False, impute = True,
df, df_org, group1, group2 = preprocess_data(df, group1, group2, experiment = "diff", motifs = False, impute = impute,
min_samples = min_samples, transform = "Nothing", paired = paired)
alpha = get_alphaN(len(group1+group2))
df, glycan_features = process_for_glycoshift(df) # potentially expand this further to infer and label high-Man/Hybrid/complex
df, glycan_features = process_for_glycoshift(df)
necessary_columns = ['Glycoform'] + glycan_features
preserved_data = df[necessary_columns]
df = df.drop(necessary_columns, axis = 1)
Expand Down
4 changes: 2 additions & 2 deletions glycowork/motif/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ def annotate_switchboard(glycan):
shopping_cart.append(temp)
if 'chemical' in feature_set:
shopping_cart.append(get_molecular_properties(glycans, placeholder = True))
if 'terminal' or 'terminal1' or 'terminal2' in feature_set:
if 'terminal' in feature_set or 'terminal1' in feature_set or 'terminal2' in feature_set:
bag1, bag2 = [], []
if 'terminal' or 'terminal1' in feature_set:
if 'terminal' in feature_set or 'terminal1' in feature_set:
bag1 = list(map(get_terminal_structures, glycans))
if 'terminal2' in feature_set:
bag2 = [get_terminal_structures(glycan, size = 2) for glycan in glycans]
Expand Down
2 changes: 1 addition & 1 deletion glycowork/motif/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def infer_features_from_composition(comp):
feature_dic['high_Man'] = 1
else:
feature_dic['high_Man'] = 0
if (comp.get('A', 0) + comp.get('G', 0) < 2 and comp.get('H', 0) > 4) or (comp.get('Neu5Ac', 0) + comp.get('Neu5Gc', 0) > 1 and comp.get('Hex', 0) > 4):
if (comp.get('A', 0) + comp.get('G', 0) < 2 and comp.get('H', 0) > 4) or (comp.get('Neu5Ac', 0) + comp.get('Neu5Gc', 0) < 2 and comp.get('Hex', 0) > 4):
feature_dic['hybrid'] = 1
else:
feature_dic['hybrid'] = 0
Expand Down

0 comments on commit db9e9f9

Please sign in to comment.