Skip to content

Commit

Permalink
added high-Man removal to N-glycan biosynthesis modeling
Browse files Browse the repository at this point in the history
  • Loading branch information
Bribak committed Mar 9, 2024
1 parent 7cb51f8 commit 7e448a4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
5 changes: 1 addition & 4 deletions build/lib/glycowork/motif/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,7 @@ def neighbor_is_branchpoint(graph, node):
edges = list(graph.edges(node))
edges = unwrap([e for e in edges if sum(e) > 2*node])
edges = [graph.degree[e] for e in set(edges) if e != node]
if len(edges) > 0 and max(edges) > 3:
return True
else:
return False
return True if max(edges, default = 0) > 3 else False


def graph_to_string_int(graph):
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 @@ -863,7 +863,7 @@ def canonicalize_iupac(glycan):
# If still no '-' in glycan, assume 'a3' type of linkage denomination
if '-' not in glycan:
# Check whether linkages are recorded as b1 or as a3
if bool(re.search(r"^[^0-9]*1?[^0-9]*$", glycan)):
if bool(re.search(r"^[^2-6]*1?[^2-6]*$", glycan)):
glycan = re.sub(r'(a|b)(\d)', r'\g<1>\g<2>-?', glycan)
else:
glycan = re.sub(r'(a|b)(\d)', r'\g<1>1-\g<2>', glycan)
Expand Down
5 changes: 1 addition & 4 deletions glycowork/motif/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,7 @@ def neighbor_is_branchpoint(graph, node):
edges = list(graph.edges(node))
edges = unwrap([e for e in edges if sum(e) > 2*node])
edges = [graph.degree[e] for e in set(edges) if e != node]
if len(edges) > 0 and max(edges) > 3:
return True
else:
return False
return True if max(edges, default = 0) > 3 else False


def graph_to_string_int(graph):
Expand Down
2 changes: 1 addition & 1 deletion glycowork/motif/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def canonicalize_iupac(glycan):
# If still no '-' in glycan, assume 'a3' type of linkage denomination
if '-' not in glycan:
# Check whether linkages are recorded as b1 or as a3
if bool(re.search(r"^[^0-9]*1?[^0-9]*$", glycan)):
if bool(re.search(r"^[^2-6]*1?[^2-6]*$", glycan)):
glycan = re.sub(r'(a|b)(\d)', r'\g<1>\g<2>-?', glycan)
else:
glycan = re.sub(r'(a|b)(\d)', r'\g<1>1-\g<2>', glycan)
Expand Down
20 changes: 20 additions & 0 deletions glycowork/network/biosynthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,24 @@ def infer_roots(glycans):
print("Glycan class not detected; depending on the class, glycans should end in -ol, GalNAc, GlcNAc, or Glc")


def add_high_man_removal(network):
"""considers the process of cutting down high-mannose N-glycans for maturation\n
| Arguments:
| :-
| network (networkx object): biosynthetic network, returned from construct_network\n
| Returns:
| :-
| Returns a network with edges going upstream to indicate removal of Man
"""
edges_to_add = []
for source, target in network.edges():
if target.count('Man') >= 5:
diff_attr = network[source][target]['diff']
edges_to_add.append((target, source, diff_attr))
for target, source, diff_attr in edges_to_add:
network.add_edge(target, source, diff = diff_attr)


@rescue_glycans
def construct_network(glycans, allowed_ptms = allowed_ptms,
edge_type = 'monolink', permitted_roots = None, abundances = []):
Expand Down Expand Up @@ -720,6 +738,8 @@ def construct_network(glycans, allowed_ptms = allowed_ptms,
for node in sorted(network.nodes(), key = len, reverse = True):
if (network.out_degree[node] < 1) and (nodeDict[node]['virtual'] == 1):
network.remove_node(node)
if 'GlcNAc' in ''.join(permitted_roots) and any(g.count('Man') >= 5 for g in network.nodes()):
add_high_man_removal(network)
if abundances:
node_attributes = {g: {'abundance': abundance_mapping.get(g, 0.0)} for g in network.nodes()}
nx.set_node_attributes(network, node_attributes)
Expand Down

0 comments on commit 7e448a4

Please sign in to comment.