#====================================================================== # RScriptForGroupingmiRNAs.r: Preparing the data for vote-counting method # by grouping miRNAs per study and sorting miRNAs by total number of studies # reporting consistently differentially expressed miRNAs #====================================================================== #---------------------------------------------------------------------- # Load miRNA data from tab separated file that consists at least 3 columns: # miR Name, if miR is up-regulated or down-regulated and name of the study #---------------------------------------------------------------------- miRNATable = read.table("ReannotatedMIRNAsAllStudies.txt", sep="\t",stringsAsFactors=F) head(miRNATable) miRNATable <- unique(miRNATable[c("V1","V2","V3")]) #---------------------------------------------------------------------- # Removing duplicates #---------------------------------------------------------------------- distinct_miRNAs <- subset(miRNATable, !duplicated(V1) & !is.na(V1) )$V1 temp <- vector(mode = "character", length = length(distinct_miRNAs )) miRNAGroups = data.frame(distinct_miRNAs,temp,temp,temp,temp,temp,temp,temp,temp,temp,temp,temp,stringsAsFactors=F) studies <- c("Ganci, 2015", "Soga, 2013", "Shi, 2015", "Fukomoto, 2015", "Chen, 2017", "Manikandan, 2016", "Shiah, 2014") rownames(miRNAGroups) <- miRNAGroups$distinct_miRNAs names(miRNAGroups)[2] <- "Ganci, 2015" names(miRNAGroups)[3] <- "Soga, 2013" names(miRNAGroups)[4] <- "Shi, 2015" names(miRNAGroups)[5] <- "Fukomoto, 2015" names(miRNAGroups)[6] <- "Chen, 2017" names(miRNAGroups)[7] <- "Manikandan, 2016" names(miRNAGroups)[8] <- "Shiah, 2014" names(miRNAGroups)[9] <- "No Groups common" names(miRNAGroups)[10] <- "No Groups up" names(miRNAGroups)[11] <- "No Groups down" names(miRNAGroups)[12] <- "Present in study" for(i in 1:nrow(miRNATable)) { miRNA <- miRNATable[i,"V1"] study <- miRNATable[i,"V3"] type <- miRNATable[i,"V2"] if (study == "Ganci, 2015") {miRNAGroups[miRNA ,2] <- type} if (study == "Soga, 2013") {miRNAGroups[miRNA ,3] <- type} if (study == "Shi, 2015") {miRNAGroups[miRNA ,4] <- type} if (study == "Fukomoto, 2015") {miRNAGroups[miRNA ,5] <- type} if (study == "Chen, 2017") {miRNAGroups[miRNA ,6] <- type} if (study == "Manikandan, 2016") {miRNAGroups[miRNA ,7] <- type} if (study == "Shiah, 2014") {miRNAGroups[miRNA ,8] <- type} miRNAGroups[miRNA ,12] <- paste(miRNAGroups[miRNA ,12], study,sep = ",", collapse = NULL) } for(i in 1:nrow(miRNAGroups)) { miRNAGroups[i ,9] <- (sum(miRNAGroups[i,] != "")-2) miRNAGroups[i ,10] <- (sum(miRNAGroups[i,] == "up-regulated")) miRNAGroups[i ,11] <- (sum(miRNAGroups[i,] == "down-regulated")) } #---------------------------------------------------------------------- # Sorting by total number of studies # reporting consistently differentially expressed miRNAs #---------------------------------------------------------------------- sortedmiRNAGroups <- miRNAGroups[rev(order(miRNAGroups$`No Groups common`)),] head(sortedmiRNAGroups) #---------------------------------------------------------------------- # Storing results #---------------------------------------------------------------------- write.table(sortedmiRNAGroups, "VoteCountingResults.txt", sep="\t")