Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node Field in read.jplace() #22

Open
HollyKArnold opened this issue Oct 13, 2019 · 2 comments
Open

Node Field in read.jplace() #22

HollyKArnold opened this issue Oct 13, 2019 · 2 comments

Comments

@HollyKArnold
Copy link

Hello,

First thanks for publishing Treeio - very helpful set of code. I do have a question about a field that is present from get placements(). I have a .jplace file (attached) that I've read in with:

j = read.jplace("epa_result.CCF.300.jplace.txt")
p = get.placements(j, "best")
head(p)

This shows a tibble where "node" is one of the columns.

I have written a function which returns the ancestral node of an edge:
getEdgeAncestor = function(tree, edge){ return(tree$edge[edge, 1] - length(tree$tip.lable)) }

However, this function does not match the tibble "node" column. My question then is, what is the "node" column signify in the get.placements(j, "best") ?

Thanks

epa_result.CCF.300.jplace.txt

@xiangpin
Copy link
Member

Thanks for your attention, the node column is the index of total nodes, I don't understand edge in your function, is it the index of tree$edge? I guess the edge of the function is from the edge_num of jplace file, but the edge_num of jplace file is different from the index of tree$edge, you can see https://doi.org/10.1371/journal.pone.0031009. Could you please explain why you wrote the function?

@HollyKArnold
Copy link
Author

Hello xiangpin!

I have done the following experiment:

  1. I have a reference tree which was generated from full length 16S rRNA sequences.
  2. I took these long sequences that were used to build the reference tree and cut these 16S rRNA sequences into short 200 basepair long regions.
  3. I then placed these 200 long basepair reads onto the reference tree. Now I'm trying to determine the distance from the placed read to the read that it was derived from.

To do this, I'm trying to map the edges in get.placements(p) to the edge table in jTree$edge:

j = read.jplace("epa_result.1100F.200.jplace")
jTree = get.tree(j)
jTree

p = get.placements(j, "best")
head(p)
# how can I map between these two things?
jTree$edges
p$edge_num

epa_result.1100F.200.jplace.txt

Thanks so much for any help that you could provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants