CMplot icon indicating copy to clipboard operation
CMplot copied to clipboard

Output file name

Open kokyriakidis opened this issue 5 years ago • 10 comments

Hi @YinLiLin !

Is there a way to change output file name and not use the default Rectangular-Manhattan.P_memo? I want it just to print memo

Also, can I just annotate with text only the top result per chromosome, as in qqman?

kokyriakidis avatar Apr 14 '20 17:04 kokyriakidis

Hi @kokyriakidis

The file names are linked with the colnames of your data, so you can just change the names of columns in your data, and the file names will be updated automatically.

You can annotate any SNP of interest by parameter highlight , a vector containing the names of your interested SNPs, then assign the labels to parameter highlight.text. CMplot doesn't provide the function of locating the top SNP of per chromosome and annotating automatically, that means you need to find those SNPs prior to using CMplot.

Best, LL

YinLiLin avatar Apr 15 '20 23:04 YinLiLin

Hi,

Great question. I have a related one. See below my code:

Pmap.temp <- subset(dt.temp, select = c("rsid", "chromosome", "position", "frequentist_add_pvalue"))
  CMplot(Pmap.temp,
         plot.type = "q", 
         cex.lab = 1,
         main = paste0("QQ plot [",var.temp,"]"),
         file.output = TRUE,
         # file = "jpg", 
         memo = paste0(PLOT_loc, "/",Today,".",PROJECTNAME,".",SUBPROJECTNAME,".",var.temp,".QQ."))

What I want is that it saves the plot at a specific location with a specific name. Now I get a message like this:

QQplot.frequentist_add_pvalue_/Users/swvanderlaan/PLINK/analyses/ucorbio/UCORBIO_7Q22/UCORBIO_7Q22.FULL/PLOTS/20200507.UCORBIO_7Q22.FULL.Gp.QQ..jpg

But I'd like it to be saved like this:

/Users/swvanderlaan/PLINK/analyses/ucorbio/UCORBIO_7Q22/UCORBIO_7Q22.FULL/PLOTS/20200507.UCORBIO_7Q22.FULL.Gp.QQ.jpg

Where the variables are like this: PLOT_loc = /Users/swvanderlaan/PLINK/analyses/ucorbio/UCORBIO_7Q22/UCORBIO_7Q22.FULL/PLOTS/ Today = 20200507 PROJECTNAME = UCORBIO_7Q22 SUBPROJECTNAME = FULL var.temp = Gp

How do I control this through CMplot?

swvanderlaan avatar May 07 '20 14:05 swvanderlaan

Hi @swvanderlaan ,

Thanks for your good question. Sorry that there is no parameter in CMplot can direct the path for all output files. The parameter 'memo' is designed to append a specific character at the end of each file name, aiming to avoid file overwriting. To change the file path, I would suggest to use the R function setwd() in front of CMplot, then change back at behind.

Best, LL

YinLiLin avatar May 08 '20 01:05 YinLiLin

Yes, excellent suggestion. I thought of that option too. Thanks!

swvanderlaan avatar May 08 '20 15:05 swvanderlaan

But are you working on a way such that we can just name the file the way we want to? So where memo = "myfavoriteplot.jpg" and the file would be just that, myfavoriteplot.jpg. Now I have a QQ plot with 7 traits and 7 names in the filename... while those names are also in the plot legend...

swvanderlaan avatar May 08 '20 15:05 swvanderlaan

My problem is that in front of the memo name it concats a string "Rectangular-Manhattan.", e.g. "Rectangular-Manhattan.P_memo" . In the future it may be better to just display the memo

kokyriakidis avatar May 08 '20 15:05 kokyriakidis

As you may know, there are various types of plots in function of CMplot, therefore, it's hard to use one filename given by users to name all files, although it may work by providing a vector of file names, I think it would make it more complex. So by default, CMplot uses the combination of types of plots and names of traits to be the final file names.

YinLiLin avatar May 10 '20 08:05 YinLiLin