Mercurial > repos > galaxyp > unipept
comparison unipept.py @ 11:4edfc76f8a29 draft default tip
planemo upload for repository https://unipept.ugent.be/apidocs commit 3c558355ee4f859d4356a05e79f8777fdfbede87
| author | galaxyp |
|---|---|
| date | Fri, 14 Nov 2025 21:05:00 +0000 |
| parents | 2e297d531259 |
| children |
comparison
equal
deleted
inserted
replaced
| 10:2e297d531259 | 11:4edfc76f8a29 |
|---|---|
| 197 taxa_cols.append(col) | 197 taxa_cols.append(col) |
| 198 id_to_node = dict() | 198 id_to_node = dict() |
| 199 | 199 |
| 200 def get_node(id, name, rank, child, seq): | 200 def get_node(id, name, rank, child, seq): |
| 201 if id not in id_to_node: | 201 if id not in id_to_node: |
| 202 data = {'count': 0, 'self_count': 0, 'valid_taxon': 1, 'rank': rank, 'sequences': []} | 202 extra = {'valid_taxon': 1, 'rank': rank, 'sequences': []} |
| 203 node = {'id': id, 'name': name, 'children': [], 'kids': [], 'data': data} | 203 node = {'id': id, 'name': name, 'children': [], 'kids': [], 'count': 0, 'selfCount': 0, 'extra': extra} |
| 204 id_to_node[id] = node | 204 id_to_node[id] = node |
| 205 else: | 205 else: |
| 206 node = id_to_node[id] | 206 node = id_to_node[id] |
| 207 node['data']['count'] += 1 | 207 node['count'] += 1 |
| 208 if seq is not None and seq not in node['data']['sequences']: | 208 if seq is not None and seq not in node['extra']['sequences']: |
| 209 node['data']['sequences'].append(seq) | 209 node['extra']['sequences'].append(seq) |
| 210 if child is None: | 210 if child is None: |
| 211 node['data']['self_count'] += 1 | 211 node['selfCount'] += 1 |
| 212 elif child['id'] not in node['kids']: | 212 elif child['id'] not in node['kids']: |
| 213 node['kids'].append(child['id']) | 213 node['kids'].append(child['id']) |
| 214 node['children'].append(child) | 214 node['children'].append(child) |
| 215 return node | 215 return node |
| 216 root = get_node(1, 'root', 'no rank', None, None) | 216 root = get_node(1, 'root', 'no rank', None, None) |
| 247 return ids | 247 return ids |
| 248 id_to_node = dict() | 248 id_to_node = dict() |
| 249 | 249 |
| 250 def get_node(id, name, child, seq): | 250 def get_node(id, name, child, seq): |
| 251 if id not in id_to_node: | 251 if id not in id_to_node: |
| 252 data = {'count': 0, 'self_count': 0, 'sequences': []} | 252 extra = {'sequences': []} |
| 253 node = {'id': id, 'name': name, 'children': [], 'kids': [], 'data': data} | 253 node = {'id': id, 'name': name, 'children': [], 'kids': [], 'count': 0, 'selfCount': 0, 'extra': extra} |
| 254 id_to_node[id] = node | 254 id_to_node[id] = node |
| 255 else: | 255 else: |
| 256 node = id_to_node[id] | 256 node = id_to_node[id] |
| 257 node['data']['count'] += 1 | 257 node['count'] += 1 |
| 258 if seq is not None and seq not in node['data']['sequences']: | 258 if seq is not None and seq not in node['extra']['sequences']: |
| 259 node['data']['sequences'].append(seq) | 259 node['extra']['sequences'].append(seq) |
| 260 if child is None: | 260 if child is None: |
| 261 node['data']['self_count'] += 1 | 261 node['selfCount'] += 1 |
| 262 elif child['id'] not in node['kids']: | 262 elif child['id'] not in node['kids']: |
| 263 node['kids'].append(child['id']) | 263 node['kids'].append(child['id']) |
| 264 node['children'].append(child) | 264 node['children'].append(child) |
| 265 return node | 265 return node |
| 266 root = get_node(0, '-.-.-.-', None, None) | 266 root = get_node(0, '-.-.-.-', None, None) |
