fishplot icon indicating copy to clipboard operation
fishplot copied to clipboard

Bug In fishPlot Function: Clone Arising Outside Of Parent

Open armonazizi opened this issue 6 years ago • 3 comments

Hi, I'm running into a bug where a clone is arising outside of its assigned parent. Im running the following code (a slight modification from the given example):

library(fishplot)

timepoints=c(0,100,600) 

frac.table = matrix(
  c(100,80,60,2,
    8,4,0,1,
    60,50,0,50),
  ncol=length(timepoints))

parents = c(0,1,2,2)

fish = createFishObject(frac.table,parents,timepoints=timepoints)

fish = layoutClones(fish)

fishPlot(fish,shape="spline",vlines=timepoints, 
         vlab=c("DX","CR","REL"))

Which produces the following plot:

image

The yellow clone (clone 4) has an assigned parent clone 2, but it originates in clone 1. I'm not sure if this is just due to some parameters that I incorrectly used, but I can't seem to fix it. Let me know if there's a workaround or something else I can do to correctly plot examples like this.

Thanks!

Armon

armonazizi avatar Feb 28 '19 03:02 armonazizi

Yes, that's a thing that can happen in edge cases. There is a pad.left parameter on the fishPlot function that can be modified to help with that - I'd suggestion reducing its value to see what happens as a first pass.

chrisamiller avatar Feb 28 '19 04:02 chrisamiller

Unfortunately, that didn't work. Decreasing and increasing the value just compresses what is already being plotted (it just changes the distance between where clone 1 starts and clone 2 starts). I think one way to approach this would be to manually set the time/position where each clone arises. Is that possible in the current iteration of the code?

armonazizi avatar Feb 28 '19 19:02 armonazizi

One option would be to add an additional, unlabeled timepoint just to the right of your DX, and have your yellow clone start there.

chrisamiller avatar Feb 28 '19 21:02 chrisamiller