chrisamiller / fishplot

Create timecourse "fish plots" that show changes in the clonal architecture of tumors
Other
161 stars 46 forks source link

adding clones IDs + child clone emerging outside parent clone #40

Open LayalYasin opened 7 months ago

LayalYasin commented 7 months ago

Good after noon ! I have three questions please

is it possible to edit some code/parameters to fix this issue when you have a child clone originating outside its parent clone, like this picture:

Screenshot 2023-12-20 at 14 26 00

Now in this second image you see for clones (two above and two below, and probably some hidden clones) starting to emerge at this timepoints, is it possible that we have all those emerging clones starting on the same vertical line ? if not, based on what is the starting point of those emerging clones chosen ?

Screenshot 2023-12-20 at 14 26 11

Finally, could we have IDs before the start of each clone ? to be able to differentiate them ?

Screenshot 2023-12-20 at 14 26 19

thanks a lot for your support !

chrisamiller commented 7 months ago

is it possible to edit some code/parameters to fix this issue when you have a child clone originating outside its parent clone, like this picture:

This sort of thing can often be fixed by adding additional "fake" timepoints to help shape the graph the way you'd like it to be.

Now in this second image you see for clones (two above and two below, and probably some hidden clones) starting to emerge at this timepoints, is it possible that we have all those emerging clones starting on the same vertical line ? if not, based on what is the starting point of those emerging clones chosen ?

How far back the point extends is based, in part, on the pad.left parameter given to the drawClust* commands (see draw.R). With bezier curves, there's always some "slop" from having to make the curves look smooth. If you draw polygons with no padding instead, it may ameliorate this issue, to some extent, especially if you play with the ramp.angle parameter.

Finally, could we have IDs before the start of each clone ? to be able to differentiate them ?

You can label the clones by providing the clone.annots parameter to the createFishObject function. Example that modifies the example code from the front page:

    library(fishplot)
    timepoints=c(0,30,75,150)      

    #provide a matrix with the fraction of each population
    #present at each timepoint
    frac.table = matrix(
      c(100, 45, 00, 00,
         02, 00, 00, 00,
         02, 00, 02, 01,
         98, 00, 95, 40),
      ncol=length(timepoints))

    #provide a vector listing each clone's parent
    #(0 indicates no parent)
    parents = c(0,1,1,3)

    #create a fish object 
    fish = createFishObject(frac.table,parents,timepoints=timepoints, clone.annots=c("A","B","C","D"), clone.annots.cex=0.8)

    #calculate the layout of the drawing
    fish = layoutClones(fish)

    #draw the plot, using the splining method (recommended)
    #and providing both timepoints to label and a plot title
    fishPlot(fish,shape="spline",title.btm="Sample1",
             cex.title=0.5, vlines=c(0,150), 
             vlab=c("day 0","day 150"))