I am analyzing geomx data with quantile and quartile normalization , while workflow has background expression and quartile normalization in R package: GeoMX workflow, GeoMX tools. I am getting the nice normalize table with quantile normalization but when I am trying to make density plot. It is not creating a significant plot for combines/overlayed quantile or quartile normalization. My code: library(preprocessCore) library(gridExtra) ann_of_interest <- "region"
negativeProbefData <- subset(fData(target_GeoData_QC_Other_Probe), CodeClass == "Negative") neg_probes <- unique(negativeProbefData$TargetName)
Filter data based on Detection Rate
target_GeoData_QC_Other_Probe <- target_GeoData_QC_Other_Probe[ fData(target_GeoData_QC_Other_Probe)$DetectionRate >= 0.1 | fData(target_GeoData_QC_Other_Probe)$TargetName %in% neg_probes, ]
Normalize using Quantile normalization
normalized_data <- normalize.quantiles(exprs(target_GeoData_QC_Other_Probe)) row.names(normalized_data) <- row.names(exprs(target_GeoData_QC_Other_Probe)) colnames(normalized_data) <- colnames(exprs(target_GeoData_QC_Other_Probe))
Stat_data_normalized <- data.frame( row.names = colnames(normalized_data), Segment = colnames(normalized_data), Annotation = pData(target_GeoData_QC_Other_Probe)[, ann_of_interest], Q3 = unlist(apply(normalized_data, 2, quantile, 0.75, na.rm = TRUE)), NegProbe = normalized_data[neg_probes, ])
Melt the dataframe for plotting
Stat_data_m <- melt( Stat_data_normalized, measure.vars = c("Q3", "NegProbe"), variable.name = "Statistic", value.name = "Value")
density plot
density_plot <- ggplot(data = Stat_data_m, aes(x = Value, fill = Statistic)) + geom_density(alpha = 0.3) + theme_bw() + scale_x_continuous(trans = "log2") + labs(x = "Value", y = "Density") + ggtitle("Density Plot for Q3 and NegProbe") + scale_fill_manual(values = c("Q3" = "blue", "NegProbe" = "red"))
I think I am doing some mistake in calculating Quartile normalization. If it is not a right way to calculate please help me...to calculate it