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

plot.all.trees.clone.as.branch -bug with branches name #41

Open
qingjian1991 opened this issue Aug 11, 2020 · 2 comments
Open

plot.all.trees.clone.as.branch -bug with branches name #41

qingjian1991 opened this issue Aug 11, 2020 · 2 comments

Comments

@qingjian1991
Copy link

qingjian1991 commented Aug 11, 2020

Hi, I find a bug within the plot.all.trees.clone.as.branch(). When the founding clone is not 1, then there is a bug when plot the tree.

My code is as following:

#The default founding clone is 7, rather than 1 
y = infer.clonal.models(variants = mutdata,
   cluster.col.name = cluster.col.name,
   ccf.col.names = vaf.col.names,
   cancer.initiation.model="monoclonal",
   subclonal.test = "bootstrap",
   subclonal.test.model = "non-parametric",
   num.boots = 2000,
   founding.cluster = 7)

plot.all.trees.clone.as.branch(y, branch.width = 0.5,
    node.size = 1, node.label.size = 0.5)

leading to this error.

Error in x0[i] <- x1[which(x$branches == parent)] 

Solution is here:

The sub-fucntion germinate from plot.all.trees.clone.as.branch removed the "Y" branch with the code below. Your original code assumes the first branches is "Y", in some case, the "Y" brance is not the the first one.

#The first branch is not "Y"
y$matched$merged.trees[[1]]$branches
[1] "1"   "2"   "3"   "20"  "200" "Y"  

#your original code of germinate()
    x <- list(trunk.height=x$length[1],
              branches=x$branches[-1],
              lengths=x$lengths[-1],
              branch.colors=x$branch.colors[-1],
              branch.border.colors=x$branch.border.colors[-1],
              branch.border.linetypes=x$branch.border.linetypes[-1],
              branch.border.widths=x$branch.border.widths[-1],
              node.colors=x$node.colors[-1],
              node.border.colors=x$node.border.colors[-1],
              node.border.widths=x$node.border.widths[-1],
              node.labels=x$node.labels[-1],
              node.texts=x$node.texts[-1],
              branch.texts=x$branch.texts[-1])

The follwing code will solve this error.

 #update code in germinate()   
id = which(x$branches == "Y")

    x <- list(trunk.height=x$length[1],
              branches=x$branches[-id],
              lengths=x$lengths[-id],
              branch.colors=x$branch.colors[-id],
              branch.border.colors=x$branch.border.colors[-id],
              branch.border.linetypes=x$branch.border.linetypes[-id],
              branch.border.widths=x$branch.border.widths[-id],
              node.colors=x$node.colors[-id],
              node.border.colors=x$node.border.colors[-id],
              node.border.widths=x$node.border.widths[-id],
              node.labels=x$node.labels[-id],
              node.texts=x$node.texts[-id],
              branch.texts=x$branch.texts[-id])

Thanks for a very useful package!

Qingjian Chen

Sun Yat-Sen University Cancer Center (SYSUCC)

@daisyyr
Copy link

daisyyr commented Jun 22, 2022

Thanks for your answer! It's really useful. I've encountered the same problem.
BTW, where can I find the source code for germinate() function ? I could not find it under the clonovol R package.

@eidamama
Copy link

eidamama commented Mar 9, 2023

Hi qingjiang
Thank you so much for the bug fixing code.
I replaced the part in "trees.package.r" with your code but still the same error message came out. Which file did you modify?

Thank you and best

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

3 participants