saezlab / MetaProViz

R-package to perform metabolomics pre-processing, differential metabolite analysis, metabolite clustering and custom visualisations.
https://saezlab.github.io/MetaProViz/
GNU General Public License v3.0
11 stars 1 forks source link

VizLollipop - some final enhancements #37

Closed dprymidis closed 1 year ago

dprymidis commented 1 year ago
  1. In Plot_Settings=Standard, if you dont specify color or size the color is black and the size the same.
  2. However, in Plot_Settings = Compare, the color is used to colorcode the datasets and the dot size is automatically set to p.adj.

Initially, I made it that the dot size is automatically the p.adj because it made (like in 2). Then, I changed that to give full control to the user (like in 1). Now I have to change one because they are not the same. What is preferable?

I would say to change the 2 and make it like 1. Meaning that if you dont specify that you want the p.adj as a dot size then its not shown. It makes sense that the standard lolipop would have the p.adj as a dotsize but in that canse we wouldnt be able to generate a plot without the p.adj as the dot size and that might might not be preferable for some people. What do you think?

ChristinaSchmidt1 commented 1 year ago

In Plot_Settings=Standard, if you dont specify color or size the color is black and the size the same. This is what we want and I would do the same for Plot_Settings = "Compare". Yet, check out the VizVolcano function I wrote for compare. You will see that if the user gives us shape and color, we will ignore shape and use it for the conditions and give them a warning stating that we ignored it. Here it would be the same as we need color for the conditions and will ignore the parameter they pass. Does this makes sense?

Additonally, I would sort the volcano plots for Log2FC. if you whant we can have a brief chat to clarify action points.

ChristinaSchmidt1 commented 1 year ago

Also, lets add the following parameters: y= "Metabolite", (column name of the metabolites, plotted on y-axis) x= "Log2FC", (column name of Log2FC, or tval or score), must be numerical stat = "p.adj", can also be p-value or other statistics they want to use.

Also: for the case that the user takes p-value for size, we would want to revers the size (meaning small p-values biggest size) so we need a parameter size="Reverse" or default "Standard"

dprymidis commented 1 year ago

Yes, I agree with the first comment and i am adding this.

For the second I dont know about the x and y. Because if you change that you wont have a lolipop right? Chage of x is ok but I dont know why someone would change the y-axis and with what.

For the stat and the size parameters all good.

ChristinaSchmidt1 commented 1 year ago

You can plot the lollipop graoh the other way around by changing x and y. See here for example: https://academic.oup.com/biolreprod/article/104/1/130/5941973 (Figure 4!)

dprymidis commented 1 year ago

Got it!

ChristinaSchmidt1 commented 1 year ago

We should add a check, to see that one of the two is numeric and the other one character (x and y)

dprymidis commented 1 year ago

Done. x and y can change positions and also they can take another value gor example x=p.val instead of Log2FC. The points are sorted by x.
Color is ignored in "Compare" mode. Added the stat parameter with default = "p.adj". For the parameter size the default is "Reverse" because the general way is that the dots are gibber for smaller p.adj. It can be changed to "Standard" to plot bigger dots for bigger values. Also, added the check for x and y. One has to be numeric and the other character otherwise it stops.

dprymidis commented 1 year ago

Important to know is when you change the x or y from Log2FC to something else. For example p.val you also have to change the FCcutoff to adjust it for the p.values. Otherwise the log2FC cutoff (=0.5) is used for the p.values.

ChristinaSchmidt1 commented 1 year ago

Maybe we need to rename this to x cutoff and y cutoff? And maybe the default should be NULL, so nothing is cutoff? Cause sometimes as for volcano we wont even want to remove samples.

dprymidis commented 1 year ago

From x or y only one is numeric. We have these parameters stat = "p.adj", pCutoff= 0.05 , FCcutoff=0.5,

stat is used for subsetting the data. We have this on p.adj or p.val. pCutoff is used for the stat FCcutoff is used on the Log2FC column of the data.

Since now we can plot on an axis either Log2FC or pval or p adj and change the size and color I would sugget we keep the stat and only one cutoff named statCutoff. We the user then can select the column they want to use the cutoff and the cutoff value.

What do you think?

I am thinking this because I also think someone would use the lolipop to plot something else and they might not have a p.val/p.adj or Log2FC column and then the code would break.

ChristinaSchmidt1 commented 1 year ago

I think this is getting to complicated and in the end we would want to enable it to work with any numeric value. I get your point with the cutoff, but I am inclined to have the user select their data based on their cutoffs prior to running the function. So anything thats included in the data will be plotted.

dprymidis commented 1 year ago

Ok so I will remove it completely

ChristinaSchmidt1 commented 1 year ago

If you agree with my point, yes go ahead :)

dprymidis commented 1 year ago
  1. Add plotSettingsInfo = c(label_dot = ) which takes data from plotSettingsFile in order to show selectd values on the dots on the lolipop graph (for exaple "p.adj).

  2. Add PEA.

dprymidis commented 1 year ago
  1. is done
ChristinaSchmidt1 commented 1 year ago

I have got an error now after pulling your recent changes. Is the vignette for lollipopgraph still working for you?

Error in geom_segment() at MetaProViz/R/Visualization.R:2061:8: ! Problem while computing aesthetics. ℹ Error occurred in the 1st layer. Caused by error in get(): ! invalid first argument

dprymidis commented 1 year ago

Indeed, I am working on it

dprymidis commented 1 year ago

Fixed and pushed. It should be working now!

dprymidis commented 1 year ago

PEA for Lolipop is added. Thanks for the example. I also added an example in the vignette. Note. I added the additional_Input_data which is used only for the PEA.

ChristinaSchmidt1 commented 1 year ago

Amazing, thanks! I will close this issue now, and if there is anything else coming up, we can always reopen it.