Can any one help me in intersect and merge in my correlation plot ?
0
0
Entering edit mode
3 months ago
isha.lily20 ▴ 10

Hello Researchers,

Can anyone help me in intersect and merging my correlation plot in one plot only, I am getting two separate plot by my script but I want only one plot.

I have attached my Rscript of correlation

I am getting two separate plots but I want only one is the only issue

Thank you so much

Code:

library("gdata")

Basmati_Type1_miRNA=as.data.frame(readxl::read_excel("Basmati miRNA Cuffdiff_with_tcons.xlsx", sheet=1))
Basmati_Type2_miRNA=as.data.frame(readxl::read_excel("Basmati miRNA Cuffdiff_with_tcons.xlsx", sheet=2))
BrownRice_Type1_miRNA=as.data.frame(readxl::read_excel("Brown miRNA Cuffdiff_with_tcons.xlsx", sheet=1))
BrownRice_Type2_miRNA=as.data.frame(readxl::read_excel("Brown miRNA Cuffdiff_with_tcons.xlsx", sheet=2))
BrownRice_Type1_miRNA$LOC=gsub(",.*","",BrownRice_Type1_miRNA$LOC)
BrownRice_Type2_miRNA$LOC=gsub(",.*","",BrownRice_Type2_miRNA$LOC)
Basmati_Type1_miRNA$LOC=gsub(",.*","",Basmati_Type1_miRNA$LOC)
Basmati_Type2_miRNA$LOC=gsub(",.*","",Basmati_Type2_miRNA$LOC)

Common=as.data.frame(intersect(Basmati_Type1_miRNA$LOC, Basmati_Type2_miRNA$LOC))
Common=as.data.frame(Common[-18,])
colnames(Common)="miRNA"

Common=merge(Common, Basmati_Type1_miRNA[,c(3:9)], by.x="miRNA",
             by.y="LOC", all.x = T)

mat=as.matrix(Common[,2:7])
rownames(mat)=Common$miRNA

library(corrplot)

sampleCor <- (cor(mat))

library(RColorBrewer)

png("Sample-Sample Correlation type1 and type2 miRNA Basmati.png", width=800, height=800)
corrplot(sampleCor, type="upper", order="hclust",
         col=brewer.pal(n=8, name="RdYlBu"), mar=c(5,1,1,1),title = "Correlation between Basmati Type 1 and Type 2 miRNA")
dev.off()

###Brown Rice Type 1 and Type 2 miRNA 
Common=as.data.frame(intersect(BrownRice_Type1_miRNA$LOC, BrownRice_Type2_miRNA$LOC))
Common=as.data.frame(Common[-21,])
colnames(Common)="miRNA"

Common=merge(Common, BrownRice_Type1_miRNA[,c(3:9)], by.x="miRNA",
             by.y="LOC", all.x = T)


mat=as.matrix(Common[,2:7])
rownames(mat)=Common$miRNA

library(corrplot)

sampleCor <- (cor(mat))

library(RColorBrewer)

png("Sample-Sample Correlation type1 and type2 miRNA BrownRice.png", width=800, height=800)
corrplot(sampleCor, type="upper", order="hclust",
         col=brewer.pal(n=8, name="RdYlBu"), mar=c(5,1,1,1),title = "Correlation between BrownRice Type 1 and Type 2 miRNA")
dev.off()
corrplot Rscript Correlation • 504 views
ADD COMMENT
2
Entering edit mode

Please make a reproducible example by providing relevant data via dput, highlight code with markdown (the 10101 button) and show something to illustrate the problem. A wall of unformatted code does not help.

ADD REPLY
1
Entering edit mode
  1. You don't need to load libraries multiple times. Copy-pasting code is fine but always check and edit after you do that.
  2. Don't use jargon like "plz" on a professional forum. Be professional.
  3. The word "separate" is spelled with an a, not an e: separate.
ADD REPLY
4
Entering edit mode

Don't use jargon like "plz" on a professional forum. Be professional.

Never fails to trigger me.

How is it more professional to order a total stranger Don't use jargon and be professional compared to an individual using "plz" on an internet forum? Were there some rules of professional writing that were presented when we signed up?

There would be some argument for this type of policing if the whole post was littered with internet jargon, but this is a single word.

Is there a set of rules for Biostars moderation? It seems to me that some moderators consistently enforce certain things and others consistently ignore them. Whatever the case, moderators should be held to a higher standard of behavior than members. I don't mean that 100% of time as we are all human and bound to slip, but there are certain moderation patterns that happen too often to be ignored. One of them is lecturing where no lecture is needed, and now I go with the same type of behavior.

ADD REPLY

Login before adding your answer.

Traffic: 2406 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6