Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204798

Volcano plot for multiple clusters

$
0
0

I am trying to make a volcano plot for different clusters. I have 2 conditions, untreated vs. treated. I have a differential expression excel file that cellranger generated for me but within the file it has multiple clusters each which have a fold change and p value. How do I create a volcano plot that contains all the clusters rather than one? Would I have to do a volcano plot for each cluster and then combine them all somehow?

I used this code to generate the plot for just one of the clusters...

macrophage_list <- read.table("differential_expression_macrophage.csv", header = T, sep = ",")`

EnhancedVolcano(macrophage_list, lab = as.character(macrophage_list$FeatureName), x = 'Cluster1.Log2.Fold.Change', y = 'Cluster1.Adjusted.P.Value', xlim = c(-8,8), title = 'Macrophage', pCutoff = 10e-5, FCcutoff = 1.5, pointSize = 3.0, labSize = 3.0)

How do I merge all the information in the excel file to create a volcano plot?

I uploaded each data cluster one by one and then merged them by using rbind, but is there a simpler/quicker way to do this?

output for dput(gene_list[1:20, 1:14])

df <- structure(list(Cluster.1.Mean.Counts = c(0.000960904, 
0.000320301, 0.001281205, 0.000320301, 0.000320301, 0.016335362, 
0.000960904, 0, 0.001601506, 0.000320301, 0.007046627, 0.026585, 
0.017296265, 0.004804518, 0, 0.874742598, 0.017616566, 0.007366928, 
0.008327831, 0.001921807), Cluster.1.Log2.fold.change = c(0.291978774, 
1.954943787, -2.008530337, -2.482461526, 3.539906287, 0.407455991, 
-0.214981215, 1.539906287, 0.802940693, 2.539906287, -1.333136538, 
-1.879953595, -0.52422405, -0.877946228, 1.539906287, -0.629373147, 
1.118442519, 0.170672478, 1.065975099, 1.099333696), Cluster.1.Adjusted.p.value = c(1, 
0.910243711, 0.04672812, 0.080866038, 0.610296549, 0.80063597, 
1, 1, 0.951841603, 0.797013021, 0.103401275, 0.000594428, 0.907754993, 
0.532689631, 1, 0.480958806, 0.078345008, 1, 0.198557945, 0.668312142
), Cluster.2.Mean.Counts = c(0.000902278, 0.001804555, 0.006315943, 
0.004511388, 0, 0.029775159, 0.001804555, 0, 0.002706833, 0, 
0.023459216, 0.128123411, 0.030677437, 0.009022775, 0, 2.174488883, 
0.018947828, 0.019850106, 0.010827331, 0.000902278), Cluster.2.Log2.fold.change = c(0.792589781, 
4.769869705, 0.35201719, 0.839132367, 3.184907204, 1.32985554, 
0.962514783, 3.184907204, 1.725475586, 2.599944703, 0.560416339, 
0.580736324, 0.407299626, 0.184907204, 3.184907204, 0.816580902, 
1.120776867, 1.742684876, 1.409613491, 0.599944703), Cluster.2.Adjusted.p.value = c(1, 
0.153573448, 1, 0.737977734, 1, 0.14478935, 0.853816767, 1, 0.47952604, 
1, 0.65316285, 0.507251471, 0.776636022, 1, 1, 0.346630571, 0.285006452, 
0.060868933, 0.21546202, 1), Cluster.3.Mean.Counts = c(0.001813813, 
0, 0.019045032, 0.00725525, 0, 0.022672657, 0.000906906, 0, 0, 
0, 0.029927908, 0.043531502, 0.046252221, 0.029021001, 0, 3.146057931, 
0.020858845, 0.013603594, 0.008162157, 0), Cluster.3.Log2.fold.change = c(1.455721575, 
2.192687169, 2.008262598, 1.504631175, 3.192687169, 0.9044422, 
0.334706174, 3.192687169, -0.451169021, 2.607724668, 0.931421856, 
-1.032594057, 1.038258504, 1.970294748, 3.192687169, 1.412371018, 
1.26985503, 1.14829305, 0.991053308, -0.451169021), Cluster.3.Adjusted.p.value = c(0.757752635, 
1, 0.032609935, 0.33316083, 1, 0.441825712, 1, 1, 1, 1, 0.380305075, 
0.605158722, 0.339946318, 0.016952505, 1, 0.056529024, 0.259458704, 
0.339639234, 0.536765022, 1), Cluster.4.Mean.Counts = c(0.000641899, 
0, 0.002567596, 0.004493293, 0, 0.010270384, 0.003209495, 0, 
0.000641899, 0, 0.028243557, 0.160474756, 0.012196081, 0.005135192, 
0, 1.199709274, 0.005135192, 0.004493293, 0.005777091, 0.001283798
), Cluster.4.Log2.fold.change = c(0.269229783, 1.661547206, -0.886889419, 
0.778904157, 2.661547206, -0.289908942, 1.602653517, 2.661547206, 
0.076584705, 2.076584705, 0.854192284, 0.961549693, -0.967809414, 
-0.644261223, 2.661547206, -0.104384578, -0.790579612, -0.467735811, 
0.459913345, 0.722947751), Cluster.4.Adjusted.p.value = c(1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.584036686, 1, 1, 1, 1, 1, 1, 
1, 1)), row.names = c(NA, 20L), class = "data.frame")

Viewing all articles
Browse latest Browse all 204798

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>