 Hello, my name is Maria Doyle and in this tutorial I'm going to show how you can customize output from the volcano plot tool in Galaxy using R. So there's a Galaxy tutorial on using the volcano plot tool and that introduced volcano plots and showed how you can use the volcano plot tool in Galaxy to generate them. And in this tutorial we're going to show how you can customize the R script that you can output from that tool. Okay, in this tutorial we are going to import data. We're first going to create a plot using the volcano plot tool, selecting to output the R script. Then we're going to import the files into R, set up the script to generate the base plot and then show customizations that you can apply to the plot using R. And if you're not familiar with R, there are some nice tutorials on how to use RStudio and R in Galaxy that you can find in the links here. Okay, so for this tutorial we just need one file and it's in this link here in the training material. So I'm going to copy this file and if you're following on from the volcano plot tool tutorial you should already have this file in your history so you don't need to import it again. And here I'm using Galaxy Ur but you can use any Galaxy that has the volcano plot tool. And I'm going to first rename or give the history a name. So volcano plot R tutorial. And then I'm going to import the file into Galaxy. Great. And for this tutorial I'm using the Galaxy training material that you can find available in the menu at the top bar in Galaxy Europe and some other galaxies. And if you access the training material that way, if the tools are highlighted in blue it means you can click on the tool name and get brought to that tool in the Galaxy instance. So for example I'm going to open up the volcano plot tool and add in these settings and noting that we're going to be outputting the R script here. So I click on that. So our file has uploaded. So we've got volcano plot tool form open. That is our input file. I'm going to specify that the file has a header. That just makes the script a bit simpler. Next I'm going to specify the columns. So the adjusted p-value column is number eight. The raw p-value is seven. The logful change column is four. And the gene-identified symbols that we're using is in column two. Okay then I'm going to set these thresholds that were used in the paper. And this sets which genes get colored in the plot. And I am going to label the top 10 most significant genes by p-value. Okay and finally I'm going to select under output options to output the R script. Okay and that should give us both the PDF with the plot and the R script in the history. And the other thing we need to do is to get R Studio going. Okay so here I'm going to use R Studio that's available through Galaxy. And otherwise you could use R Studio Cloud or R Studio on your computer. Okay so I'm going to launch that R Studio and if you're using R Studio Cloud or R Studio on your computer you just need to import the files into those R Studios. Okay so our volcano plot has been produced. So if we just click on the I to check that it is as we expect and it is we've got our significant genes colored, red for up-regulated, blue for down-regulated and we've got our top 10 most significant genes labeled with their gene names. And the other output is our R script. And this is what we're going to be editing in R. Okay and our R Studio is now running. So how we access that is we'll first actually note we're going to be importing these files into R. So we need to know their history numbers. So for our input file it's number one for our script it's number three. Okay and then I'm going to go to the R Studio under active interactive tools and I'm going to click on the R Studio name and that launches the R Studio tab. Okay and now I'm going to copy in the files from the Galaxy History. So I can use with Galaxy R Studio this GXGet command to pull in history datasets by number. So I'm going to use the R file copy command and I'm going to say copy the file that's available at GXGet. So number one is our differential expression file and I'm going to call that derasults.tsv and we'll get some R messages, red messages but that's fine and we should see our file appearing here in the files pane. Then I'm going to use arrow up to get back that command to edit it and I'm going to say I want to copy in data set number three and that's the R script and I'm going to call it volcano.r that should also appear here in the files pane. Okay so now I'm going to click on the volcano.r to open up the script and so we should see it's just like the script we were looking at in the Galaxy History and now we're going to set it up to produce the first the same plot that we produced with the tool to check it works. So I'm going to delete these lines that are from galaxy settings start to galaxy settings end because they're just needed to run the tool the volcano plot to galaxy tool we don't need them in R. Next we need to make sure we've got the packages we need installed that's these ones here library so this galaxy has some packages pre-installed so we can see in this yellow message here the only one we don't have is ggrepel and we can click on that install link there and that will run the command for us install.packages so otherwise if you don't have these packages you can use install.packages and their name like so to install them and the final thing we need to do to set up the script to get it to produce the same plot we've seen in galaxy history is to change this file path so that was where galaxy the volcano plot to copy the file but we need it to be now where we have our deresults.tsv file that we copied in this one here okay and so once we've changed that and checked that our packages are all installed now we are going to highlight all the code so I'm using command a or you can use in mac or you can use control a and windows to highlight and then I'm clicking run or you can use command enter or control enter in windows and that runs all the code and the script and we should see then we get a pdf produced if we click on it we've got that same plot in that we produced in the galaxy history great so that just checks that everything's working so now we are going to customize that script and what I'm going to do first is to to not output the plot as a pdf so I'm going to output them in the plots pane here and this is just to make it easier to see the different plots we're going to be making rather than having to keep clicking to open up the pdf okay so I removed those two lines that create the pdf and then if I highlight and run those we should see that now instead of going to the pdf the plot is produced here okay so we can see the customizations we're going to make okay so the first thing we're going to do is change the colors so this is the row the line that sets the colors in the plot so instead of using blue and red so that's fire brick we'll use purple and orange just to show how you can change the colors okay and if I highlight and run we should now see we've got those colors in our plot and if we want to change the size of the points we go down to where this plot is being created and this is the line that sets the scatter plot features so we can add here the size so we can set that to 0.5 if I highlight and run and now we see our points are smaller and similarly if we want to make the label smaller this is where the labels are getting set so we can add a size also here and this time we'll use three and we'll highlight and run that and we'll just make the labels a bit smaller okay and what if we want to change our categories so instead of using down not seg and up if we want to just have two categories one for significant and one for not significant how we can do that is like so so we can create two new categories here so I'll call them significant and not significant okay so there'll be our two new category names and we'll remove the old ones and next we'll set the colors for those categories so let's say we'll have not significant will be gray and significant will be red we need to like so so gray for not significant red for significant and then finally we need to set the criteria for those categories so now instead of having a category for open down we're just going to have one category for significant and one way we can do it is using absolute so we can say if the absolute fold change is greater than 0.58 which means it's all greater than 0.58 or less than minus 0.58 so they will be our significant genes and otherwise they are not significant okay so now we can highlight that code and we can run that and we should see now we've got just a single color in the plot red for highlighting both our regulated and our downregulated genes so they're all our significant genes okay and just to show that if we want to download the script we can we can save it first here this save icon and we can tick in the files plane to download the script or any other files we want and we can then download them under more export download that will download to our computer and if we're done with this our studio if we want to delete it and because we're finished with this we can do that then back in galaxy with in the active interactive tools plane clicking stop and then we can also delete the our studio from our history okay great so we've gone through what's in this tutorial here you can find the information on it and so a one nice thing to point out is that you can also use the volcano plot tool the the plot option settings to specify things such as plot title x y axis labels and limits and if you do that then they'll be output in the script so you can see that's one way to see how you can add those or customize those features in the plot so hopefully this has helped you see how you can customize the volcano plot output using r and how you can use our studio within galaxy if you have any questions you can ask them in these links here and we do have a feedback form that would be great if you let us know if you like the tutorial or if you have suggestions for improvement so thank you very much and I hope you have a great day