question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

provide method for getting the nodes that correspond to a set of individuals

See original GitHub issue

Proposal: this should be like:

def individual_nodes(inds):
  out = np.repeat(-1, len(inds) * 2).reshape((len(inds), 2))
  for k, ind in enumerate(inds):
    out[k, :] = self.individual(ind).nodes

so returns an array with one row per individual that can be flattened to get just a flat list of the nodes corresponding to the genomes of the individuals whose IDs are inds. And, should insert tskit.NULL as appropriate in the array when individuals are of mixed ploidy.

(moved from https://github.com/tskit-dev/pyslim/issues/39)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
petrelharpcommented, Jun 29, 2020

Sure, we can forget about this. And this is plenty fast even for big tree sequences. I do think that we should streamline working with individuals generally - eg to avoid the error where one passes indiviual IDs to the ‘samples’ argument of simplify - but this is maybe better done by adding an individuals argument to various methods.

1reaction
jeromekellehercommented, Jul 3, 2019

Can you add it to the 0.2.0 milestone so please if you’d like it in?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find all reachable nodes from every node present in a given set
One straight forward solution is to do a BFS traversal for every node present in the set and then find all the reachable...
Read more >
3. py2neo.matching – Entity matching
The py2neo.matching module provides functionality to match nodes and relationships according to certain criteria. For each entity type, a Matcher class and ...
Read more >
get all relationships for a node with cypher - Stack Overflow
The simplest way to get all relationships for a single node is like this: MATCH (:User {username: 'user6'})-[r]-() RETURN r.
Read more >
MATCH - Cypher Manual - Neo4j
The MATCH clause allows you to specify the patterns Neo4j will search for in the database. This is the primary way of getting...
Read more >
Closeness Centrality - an overview | ScienceDirect Topics
Closeness centrality indicates how close a node is to all other nodes in the network. It is calculated as the average of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found