[med-svn] [Git][med-team/hinge][master] 4 commits: Added readme for networkx patch references

Israel Komolehin (@Komolehin) gitlab at salsa.debian.org
Wed Feb 7 11:24:56 GMT 2024



Israel Komolehin pushed to branch master at Debian Med / hinge


Commits:
e88e39d7 by Komolehin Israel Timilehin at 2024-02-07T11:05:32+00:00
Added readme for networkx patch references

- - - - -
90310140 by Komolehin Israel Timilehin at 2024-02-07T11:06:07+00:00
Added patch for networkx implementation

- - - - -
11818c26 by Komolehin Israel Timilehin at 2024-02-07T11:06:07+00:00
Updated test readme

- - - - -
848bc659 by Komolehin Israel Timilehin at 2024-02-07T11:20:26+00:00
Updated readme

- - - - -


4 changed files:

- + debian/README.md
- + debian/patches/networkx_update
- debian/patches/series
- debian/tests/README.md


Changes:

=====================================
debian/README.md
=====================================
@@ -0,0 +1,9 @@
+### networkx_update patch references
+
+____________________________________
+
+- [AttributeError: 'DiGraph' object has no attribute 'edge'](https://github.com/DerwenAI/pytextrank/issues/10)
+- [dict_keyiterator' has no len()](https://stackoverflow.com/questions/53584341/len-throws-with-dict-keyiterator-has-no-len-when-calculating-outgoing-and-in)
+- [TypeError: 'dict_keyiterator' object is not subscriptable ](https://stackoverflow.com/questions/60331374/typeerror-dict-keyiterator-object-is-not-subscriptable-python-2)
+- [RuntimeError: dictionary changed size during iteration](https://stackoverflow.com/questions/11941817/how-can-i-avoid-runtimeerror-dictionary-changed-size-during-iteration-error)
+


=====================================
debian/patches/networkx_update
=====================================
@@ -0,0 +1,263 @@
+--- a/scripts/pruning_and_clipping.py
++++ b/scripts/pruning_and_clipping.py
+@@ -209,8 +209,8 @@
+             print('----0')
+             print(st_node)
+ 
+-        if len(H.successors(st_node)) == 1:
+-            cur_node = H.successors(st_node)[0]
++        if len(list(H.successors(st_node))) == 1:
++            cur_node = next(H.successors(st_node))
+ 
+             if print_debug:
+                 print('----1')
+@@ -221,7 +221,7 @@
+                 if print_debug:
+                     print(cur_node)
+ 
+-                cur_node = H.successors(cur_node)[0]
++                cur_node = next(H.successors(cur_node))
+ 
+                 if len(cur_path) > threshold + 1:
+                     break
+@@ -328,7 +328,7 @@
+         except:
+             continue
+ 
+-        for sec_node in H.successors(st_node):
++        for sec_node in list(H.successors(st_node)):
+ 
+             if H.out_degree(st_node) == 1:
+                 break
+@@ -338,8 +338,8 @@
+ 
+             while H.in_degree(cur_node) == 1 and H.out_degree(cur_node) == 1:
+ 
+-                cur_path.append([cur_node,H.successors(cur_node)[0]])
+-                cur_node = H.successors(cur_node)[0]
++                cur_path.append([cur_node, next(H.successors(cur_node))])
++                cur_node = next(H.successors(cur_node))
+ 
+                 if len(cur_path) > threshold + 1:
+                     break
+@@ -350,8 +350,8 @@
+ 
+                 for edge in cur_path:
+ 
+-                    G0.edge[edge[0]][edge[1]]['z'] = 1
+-                    G0.edge[rev_node(edge[1])][rev_node(edge[0])]['z'] = 1
++                    G0.adj[edge[0]][edge[1]]['z'] = 1
++                    G0.adj[rev_node(edge[1])][rev_node(edge[0])]['z'] = 1
+ 
+                     try:
+                         H.remove_edge(edge[0],edge[1])
+@@ -362,8 +362,8 @@
+ 
+                 for j in range(len(cur_path)-1):
+ 
+-                    G0.node[cur_path[j][1]]['z'] = 1
+-                    G0.node[rev_node(cur_path[j][1])]['z'] = 1
++                    G0._node[cur_path[j][1]]['z'] = 1
++                    G0._node[rev_node(cur_path[j][1])]['z'] = 1
+ 
+                     try:
+                         H.remove_node(cur_path[j][1])
+@@ -513,7 +513,7 @@
+             in_node = g.in_edges(node)[0][0]
+             out_node = g.out_edges(node)[0][1]
+ 
+-            if g.node[node]['hinge']==0 and g.node[in_node]['hinge']==0  and g.node[out_node]['hinge']==0:
++            if g._node[node]['hinge']==0 and g._node[in_node]['hinge']==0  and g._node[out_node]['hinge']==0:
+                 if g.out_degree(in_node) == 1 and g.in_degree(out_node) == 1:
+                     if in_node != node and out_node != node and in_node != out_node:
+                         bad_node=False
+@@ -854,7 +854,7 @@
+ 
+         # if we got here, we probably have a Y, and not a collapsed repeat
+         for vert in H.successors(st_node):
+-            if H.node[vert]['CFLAG'] == True:
++            if H._node[vert]['CFLAG'] == True:
+                 
+                 try:
+                     H.remove_edge(st_node,vert)
+@@ -896,35 +896,35 @@
+         # print node_base
+ 
+         #print node
+-        g.node[node]['normpos'] = 0
++        g._node[node]['normpos'] = 0
+         if node_base in mapping:
+-            g.node[node]['chr'] = mapping[node_base][0][2]+1
+-            g.node[node]['aln_start'] = min (mapping[node_base][0][0],mapping[node_base][0][1])
+-            g.node[node]['aln_end'] = max(mapping[node_base][0][1],mapping[node_base][0][0])
++            g._node[node]['chr'] = mapping[node_base][0][2]+1
++            g._node[node]['aln_start'] = min (mapping[node_base][0][0],mapping[node_base][0][1])
++            g._node[node]['aln_end'] = max(mapping[node_base][0][1],mapping[node_base][0][0])
+ 
+ 
+-            # max_chr = max(g.node[node]['chr'],max_chr)
++            # max_chr = max(g._node[node]['chr'],max_chr)
+             # mapped_nodes+=1
+         else:
+             # pass
+-            g.node[node]['chr'] =  0
+-            g.node[node]['aln_start'] = 1
+-            g.node[node]['aln_end'] = 1
+-#             g.node[node]['aln_strand'] = 0
++            g._node[node]['chr'] =  0
++            g._node[node]['aln_start'] = 1
++            g._node[node]['aln_end'] = 1
++#             g._node[node]['aln_strand'] = 0
+ 
+         if node in in_hinges or node in out_hinges:
+-            g.node[node]['hinge'] = 1
++            g._node[node]['hinge'] = 1
+         else:
+-            g.node[node]['hinge'] = 0
++            g._node[node]['hinge'] = 0
+ 
+-        if g.node[node]['chr'] in chr_length_dict:
+-            chr_length_dict[g.node[node]['chr']] = max(g.node[node]['aln_end'], chr_length_dict[g.node[node]['chr']])
++        if g._node[node]['chr'] in chr_length_dict:
++            chr_length_dict[g._node[node]['chr']] = max(g._node[node]['aln_end'], chr_length_dict[g._node[node]['chr']])
+         else:
+-            chr_length_dict[g.node[node]['chr']] = max(g.node[node]['aln_end'], 1)
++            chr_length_dict[g._node[node]['chr']] = max(g._node[node]['aln_end'], 1)
+ 
+     chr_list = sorted(list(chr_length_dict.items()), key=operator.itemgetter(1), reverse=True)
+ 
+-    max_chr_len1 = max([g.node[x]['aln_end'] for x in  g.nodes()])
++    max_chr_len1 = max([g._node[x]['aln_end'] for x in  g.nodes()])
+     max_chr_multiplier = 10**len(str(max_chr_len1))
+     print([x for x in chr_list])
+     chr_set =[x [0] for x in chr_list]
+@@ -936,11 +936,11 @@
+     for colour in colour_list:
+         print(matplotlib.colors.colorConverter.to_rgb(colour))
+     for index, chrom in enumerate(chr_set):
+-        node_set = set([x for x in  g.nodes() if g.node[x]['chr'] == chrom])
++        node_set = set([x for x in  g.nodes() if g._node[x]['chr'] == chrom])
+         print(chrom)
+ 
+ 
+-        max_chr_len = max([g.node[x]['aln_end'] for x in  g.nodes() if g.node[x]['chr'] == chrom])
++        max_chr_len = max([g._node[x]['aln_end'] for x in  g.nodes() if g._node[x]['chr'] == chrom])
+         # max_chr_multiplier = 10**len(str(max_chr_len))
+ 
+ 
+@@ -962,40 +962,40 @@
+ 
+         print(red,blue,green)
+         for node in node_set:
+-            g.node[node]['normpos'] = g.node[node]['chr'] * max_chr_multiplier + (g.node[node]['aln_end']/float(max_chr_len))*max_chr_multiplier
+-            lamda = (g.node[node]['aln_end']/max_chr_len)
++            g._node[node]['normpos'] = g._node[node]['chr'] * max_chr_multiplier + (g._node[node]['aln_end']/float(max_chr_len))*max_chr_multiplier
++            lamda = (g._node[node]['aln_end']/max_chr_len)
+             nd_red = (1-lamda)*red + lamda*red_bk
+             nd_green = (1-lamda)*green + lamda*green_bk
+             nd_blue = (1-lamda)*blue + lamda*blue_bk
+-            g.node[node]['color'] = rgb2hex(nd_red, nd_green, nd_blue)
+-            g.node[node]['color_r'] = nd_red
+-            g.node[node]['color_g'] = nd_green
+-            g.node[node]['color_b'] = nd_blue
++            g._node[node]['color'] = rgb2hex(nd_red, nd_green, nd_blue)
++            g._node[node]['color_r'] = nd_red
++            g._node[node]['color_g'] = nd_green
++            g._node[node]['color_b'] = nd_blue
+ 
+     # max_chr_len = len(str(max_chr))
+ 
+     # div_num = float(10**(max_chr_len))
+ 
+     # for node in g.nodes():
+-    #     g.node[node]['normpos'] = (g.node[node]['chr'] + g.node[node]['aln_end']/float(chr_length_dict[g.node[node]['chr']]))/div_num
++    #     g._node[node]['normpos'] = (g._node[node]['chr'] + g._node[node]['aln_end']/float(chr_length_dict[g._node[node]['chr']]))/div_num
+ 
+     for edge in g.edges_iter():
+         in_node=edge[0]
+         out_node=edge[1]
+ 
+-#         if ((g.node[in_node]['aln_start'] < g.node[out_node]['aln_start'] and
+-#             g.node[out_node]['aln_start'] < g.node[in_node]['aln_end']) or
+-#             (g.node[in_node]['aln_start'] < g.node[out_node]['aln_end'] and
+-#             g.node[out_node]['aln_end'] < g.node[in_node]['aln_end'])):
++#         if ((g._node[in_node]['aln_start'] < g._node[out_node]['aln_start'] and
++#             g._node[out_node]['aln_start'] < g._node[in_node]['aln_end']) or
++#             (g._node[in_node]['aln_start'] < g._node[out_node]['aln_end'] and
++#             g._node[out_node]['aln_end'] < g._node[in_node]['aln_end'])):
+ #             g.edge[in_node][out_node]['false_positive']=0
+ #         else:
+ #             g.edge[in_node][out_node]['false_positive']=1
+ 
+ 
+-        if ((g.node[in_node]['aln_start'] < g.node[out_node]['aln_start'] and
+-            g.node[out_node]['aln_start'] < g.node[in_node]['aln_end']) or
+-            (g.node[in_node]['aln_start'] < g.node[out_node]['aln_end'] and
+-            g.node[out_node]['aln_end'] < g.node[in_node]['aln_end'])):
++        if ((g._node[in_node]['aln_start'] < g._node[out_node]['aln_start'] and
++            g._node[out_node]['aln_start'] < g._node[in_node]['aln_end']) or
++            (g._node[in_node]['aln_start'] < g._node[out_node]['aln_end'] and
++            g._node[out_node]['aln_end'] < g._node[in_node]['aln_end'])):
+             g.edge[in_node][out_node]['false_positive']=0
+         else:
+             g.edge[in_node][out_node]['false_positive']=1
+@@ -1015,8 +1015,8 @@
+             e1 = (lines1[0] + "_" + lines1[3], lines1[1] + "_" + lines1[4])
+ 
+             if e1 in G.edges():
+-                G.edge[lines1[0] + "_" + lines1[3]][lines1[1] + "_" + lines1[4]]['skipped'] = 1
+-                G.edge[lines1[1] + "_" + str(1-int(lines1[4]))][lines1[0] + "_" + str(1-int(lines1[3]))]['skipped'] = 1
++                G.adj[lines1[0] + "_" + lines1[3]][lines1[1] + "_" + lines1[4]]['skipped'] = 1
++                G.adj[lines1[1] + "_" + str(1-int(lines1[4]))][lines1[0] + "_" + str(1-int(lines1[3]))]['skipped'] = 1
+ 
+ 
+ 
+@@ -1027,11 +1027,11 @@
+     for node in g.nodes():
+ 
+         if node in in_hinges:
+-            g.node[node]['hinge'] = 1
++            g._node[node]['hinge'] = 1
+         elif node in out_hinges:
+-            g.node[node]['hinge'] = -1
++            g._node[node]['hinge'] = -1
+         else:
+-            g.node[node]['hinge'] = 0
++            g._node[node]['hinge'] = 0
+ 
+     return g
+ 
+@@ -1044,9 +1044,9 @@
+     slf_flags = None
+ 
+     for node in g.nodes():
+-        g.node[node]['CFLAG'] = False
++        g._node[node]['CFLAG'] = False
+     if slf_flags != None:
+-        g.node[node]['SFLAG'] = False
++        g._node[node]['SFLAG'] = False
+ 
+     node_set = set(g.nodes())
+     num_bad_cov_reads = 0
+@@ -1061,8 +1061,8 @@
+                     print(node_name + ' is not symmetrically present in the graph input.')
+                     raise
+                 if node_name+'_0' in node_set:
+-                    g.node[node_name+'_0']['CFLAG'] = True
+-                    g.node[node_name+'_1']['CFLAG'] = True
++                    g._node[node_name+'_0']['CFLAG'] = True
++                    g._node[node_name+'_1']['CFLAG'] = True
+                     num_bad_cov_reads += 1
+     print(str(num_bad_cov_reads) + ' bad coverage reads.')
+ 
+@@ -1078,8 +1078,8 @@
+                     print(node_name + ' is not symmetrically present in the graph input.')
+                     raise
+                 if node_name+'_0' in node_set:
+-                    g.node[node_name+'_0']['SFLAG'] = True
+-                    g.node[node_name+'_1']['SFLAG'] = True
++                    g._node[node_name+'_0']['SFLAG'] = True
++                    g._node[node_name+'_1']['SFLAG'] = True
+                     num_bad_slf_reads += 1
+     print(str(num_bad_slf_reads) + ' bad self aligned reads.')            
+ 


=====================================
debian/patches/series
=====================================
@@ -3,3 +3,4 @@ libspdlog-14.0.patch
 libspdlog-1:1.3.0
 2to3.patch
 spdlog-1.5.0.patch
+networkx_update


=====================================
debian/tests/README.md
=====================================
@@ -1,6 +1,15 @@
 ## Hinge Autopkgtest
 
 - The test breaks at line 55 of `run-demo` due to `networkx` with the following error:
-- **AttributeError: 'DiGraph' object has no attribute 'node'. Did you mean: '_node'?**
-- Suggestions on resolving the error can be found [here](https://github.com/victorlei/smop/issues/165)
 
+**Traceback (most recent call last):**
+  **File "/usr/bin/../lib/hinge/pruning_and_clipping.py", line 1407, in <module>**
+    **Gs = random_condensation_sym(G1,1000)**
+         
+  **File "/usr/bin/../lib/hinge/pruning_and_clipping.py", line 452, in random_condensation_sym**
+    **node = g.nodes()[random.randrange(len(g.nodes()))]**
+           
+  **File "/usr/lib/python3/dist-packages/networkx/classes/reportviews.py", line 194, in __getitem__**
+    **return self._nodes[n]**
+           
+**KeyError: 819**
\ No newline at end of file



View it on GitLab: https://salsa.debian.org/med-team/hinge/-/compare/2dbe3b422f155efee99196d521a7bc99fd6083c3...848bc6599fff98336e711bb5e81aad8408a82888

-- 
View it on GitLab: https://salsa.debian.org/med-team/hinge/-/compare/2dbe3b422f155efee99196d521a7bc99fd6083c3...848bc6599fff98336e711bb5e81aad8408a82888
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20240207/4adb9bda/attachment-0001.htm>


More information about the debian-med-commit mailing list