From b3a97716377820e2cd3097e6e96e20b7a2622cad Mon Sep 17 00:00:00 2001 From: Efrain Gonzalez Date: Tue, 6 Jun 2017 12:29:19 -0400 Subject: [PATCH] Update to the Rcode (UNTESTED) --- RClean4.R | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/RClean4.R b/RClean4.R index 07947e7..b646312 100644 --- a/RClean4.R +++ b/RClean4.R @@ -241,20 +241,20 @@ if(clfileex == 0){ .[IDLOCAL] geneIDNam <- genena %>% read_delim(delim="\t",col_names = TRUE, comment = "!", skip = idlocgpl) %>% - dplyr::select(.,ID,grep("Symbol|ORF",colnames(.))) + dplyr::select(.,ID,grep("Symbol|^ORF\\s*$",colnames(.))) } if(IDF == 0){ #No information on this particular GPL file idLOCGPL <- genena %>% read_delim(delim="\t",col_names = FALSE, comment = "!", n_max = 1000) %>% t(.) %>% - grep("^\\D",.) %>% - length()-1 + grep("^ID\\s*$",.) %>% + -1 cbind(as.integer(gplnum),as.integer(idLOCGPL)) %>% cat(file="GPL_ID_LOC.txt",sep = "\t", fill = TRUE, append = TRUE) geneIDNam <- genena %>% read_delim(delim="\t",col_names = TRUE, comment = "!", skip = idLOCGPL) %>% - dplyr::select(.,ID,grep("Symbol|ORF",colnames(.))) + dplyr::select(.,ID,grep("Symbol|^ORF\\s*$",colnames(.))) } } if(fileex == 0){ @@ -262,20 +262,20 @@ if(clfileex == 0){ idLOCGPL <- genena %>% read_delim(delim="\t",col_names = FALSE, comment = "!", n_max = 1000) %>% t(.) %>% - grep("^\\D",.) %>% - length()-1 + grep("^ID\\s*$",.) %>% + -1 Firstval <- cbind(as.integer(gplnum),as.integer(idLOCGPL)) colnames(Firstval) <- c("GPL_FILE_NUM","LOC_ID") write.table(Firstval,file = "GPL_ID_LOC.txt", sep = "\t",row.names = FALSE, col.names = TRUE) geneIDNam <- genena %>% read_delim(delim="\t",col_names = TRUE, comment = "!", skip = idLOCGPL) %>% - dplyr::select(.,ID,grep("Symbol|ORF",colnames(.))) + dplyr::select(.,ID,grep("Symbol|^ORF\\s*$",colnames(.))) } } if(soft == FALSE){ geneIDNam <- genena %>% read_delim(delim="\t",comment = "#")%>% - dplyr::select(.,ID,grep("Symbol|ORF",colnames(.))) + dplyr::select(.,ID,grep("Symbol|^ORF\\s*$",colnames(.))) } ##Labeling the gene IDs without names @@ -322,3 +322,4 @@ nfnaex <- strsplit(alz,"[\\]") %>% paste(collapse = "") write.table(t(Fullalzdw), file = nfnaex, sep = "\t") + -- 2.29.0