Closed LauraMCE closed 5 years ago
Hi Laura, I can't access the data of the graphic 1) you need to save it into .csv 2) you need to put it into the data folder 3) In your R code you need to import these data
Hi laura
To import .csv files you have to do this
name_df <- read.csv("name_your_file.csv")
Hi Cris,
The command to export a table is: write.csv(table_in_R$columns, "name.csv")
May be you can check this if you have header and others considers: ERROR: Nine number changed by ) read.table(file, header = FALSE, sep = "", quote = ""'"9 TRUE: read.table(file, header = FALSE, sep = "", quote = ""'")
Hi! I've indicated the header but I don't know how to indicate rownames... help!
https://github.com/opetchey/RREEBES/wiki/Reading-data-and-code-from-an-online-github-repository
How to upload a file in R from Github
Hi! I added a line in the script,
VPSol <- data.frame(BCresultsNR$log2FoldChange, BCresultsNR$sig, row.names = rownames(BCresultsNR)) ##Creates a data frame with coordinates##
This generates a data frame with coordinates data. For colors, I would like to categorize data following this:
Color 1: $log2FC > 1.5, $sig <0.05 Color 2: $log2FC < -1.5, $sig <0.05 Color 3: $log2FC > 1.5, $sig > 0.05 Color 4: $log2FC < -1.5, $sig >0.05 Color 5: 0 < $log2FC< 1.5, $sig > 0.05 Color 6: -1.5 < $log2FC < 0 Thanks!!!
Hi Laura
I have the answer, you have to do this:
##Rename the columns to simplify the dataframe##
VPSol <- VPSol %>% rename(FoldChange = BCresultsNR.log2FoldChange, p_value = BCresultsNR.sig)
##Create a column with colors depending on the value of Fold Change and p-value##
VPSol$color <- ifelse((VPSol$FoldChange > 1.5) & (VPSol$p_value < 0.05), "Col_1",
ifelse((VPSol$FoldChange < -1.5) & (VPSol$p_value < 0.05), "Col_2",
ifelse((VPSol$FoldChange > 1.5) & (VPSol$p_value > 0.05), "Col_3",
ifelse((VPSol$FoldChange < -1.5) & (VPSol$p_value > 0.05), "Col_4",
ifelse((VPSol$FoldChange < 1.5) & (VPSol$p_value > 0.05), "Col_5", "Col_6")))))
##Create plot##
ggplot(VPSol, aes(x=FoldChange, y=p_value)) +
geom_point(aes(colour = color))
I can run it on my computer, I hope you can also run it. In ggplot we can put the lines to divide the grid, but I don't know how to you want it.
Hi Laura
I finally found a way to upload the dataframe in R from GitHub!
# upload the csv file
# the first column need to have a name - I modified the csv file by adding "sample" on the first column
# the link need to be the raw data by clicking "view raw"
library (readr)
urlfile="https://raw.githubusercontent.com/LauraMCE/lncRNA_BC/master/Transcriptome/Data_1_Diff_genes.csv"
BCData<-read_csv(url(urlfile))
# transform the table into a dataframe, indicating that the first column is the row names
BCData <- as.data.frame(BCData)
rownames(BCData) <- BCData[, 1]
BCData <- BCData[, -1]
#verify that the data are correct
head(BCData)
row.names(BCData)
colnames(BCData)
It works on my computer. Try on your own and if it works, modify the code in Github so that everyone can access the data and make the graphic.
Good job everyone, we are getting close!
Hi Laura, Don't forget to reply and if no further issues occur, close the issue!
Hi, @camillethuyentruong ! The code you provided me worked perfectly, and it is already uploaded in the code. Thanks! Hi, @cristoichkov ! Thanks for the script. I did some changes that you can see here, but... It worked!! I have now a very nice Volcano Plot with a lot of colors. Thanks everybody @VeroIarrachtai @camillethuyentruong for helping me!!
Help ith my advisor's issue
Hi! My advisor ask me to do a very difficult task with my paper's pictures. Here is literally what he said:
So, I hope that you can help me with the 2 issues.
1.- Volcano Plot
This is the code I'm using for Volcano plot.
And my problem is that I couldn't have a color code with 6 colors. Please Help!
2.- PCA plot (SOLVED!!)
I had problems with PCA too. But I solved it. Here is my first script, that does not work with what I want, and here is my solution. Thanks!!