Found 50916 results in 5429 files, showing top 50 files (show more).
seq2pathway:R/seq2pathway.r: [ ]
928:    path <-paste(system.file(package="seq2pathway"),
856: get_python3_command_path <- function()
859:   python3_command_path <- Sys.which2("python")
1029:     script_path <- file.path(tempdir(), name)
275: pathwaygene<-length(intersect(toupper(gene_list[[i]]),
484: pathwaygene<-length(intersect(toupper(gsmap$genesets[[i]]),
843:   cmdpath <- Sys.which(cmdname)
1051: runseq2pathway<-function(inputfile,
1161: gene2pathway_result<-list()
1310: gene2pathway_test<-function(dat,DataBase="GOterm",FisherTest=TRUE,
1344: gene2pathway_result<-list()
854: #get_python3_command_path: funtion from Herve Pages, Bioconductor Maintainance Team, Oct 9 2020
858: #  python3_command_path <- Sys.which2("python3") #3/3/2021 by Holly
860:   if (python3_command_path != "")
864:           return(python3_command_path)}
873: #  python3_command_path <- Sys.which2("python")
874:   python3_command_path <- Sys.which2("python3")  #3/3/2021 by Holly
875:   if (python3_command_path != ""){
876:     print(paste0("python3 found: ",python3_command_path))
877:     return(python3_command_path)}
880:        "  'python3' (or 'python') executable is in your PATH.")
924:     ### assign the path of main function
932:     path <-paste(system.file(package="seq2pathway"),
976: 		sink(file.path(tempdir(),name,fsep = .Platform$file.sep))} 
994:     cat("'", path, "').load_module()",sep="")
1030:     if (!file.exists(script_path))
1032:     mypython <- get_python3_command_path()
1034:     response <- system2(mypython, args=script_path,
75: data(gencode_coding,package="seq2pathway.data")
155: data(gencode_coding,package="seq2pathway.data")
214: ####load GP pathway information
216:    data(GO_BP_list,package="seq2pathway.data")
217:    data(GO_MF_list,package="seq2pathway.data")
218:    data(GO_CC_list,package="seq2pathway.data") 
219:    data(Des_BP_list,package="seq2pathway.data")
220:    data(Des_MF_list,package="seq2pathway.data")
221:    data(Des_CC_list,package="seq2pathway.data")
223:          data(GO_BP_list,package="seq2pathway.data") 
224:          data(Des_BP_list,package="seq2pathway.data")
226:               data(GO_MF_list,package="seq2pathway.data") 
227:               data(Des_MF_list,package="seq2pathway.data")
229:                   data(GO_CC_list,package="seq2pathway.data")
230:                   data(Des_CC_list,package="seq2pathway.data")
237: data(GO_GENCODE_df_hg_v36,package="seq2pathway.data")
240: data(GO_GENCODE_df_hg_v19,package="seq2pathway.data")
243: data(GO_GENCODE_df_mm_vM25,package="seq2pathway.data")
246: data(GO_GENCODE_df_mm_vM1,package="seq2pathway.data")
280: c<-pathwaygene-a
289: mdat[i,7]<-pathwaygene
321: pathwaygene<-length(intersect(toupper(GO_BP_list[[i]]),
326: c<-pathwaygene-a
335: mdat[i,7]<-pathwaygene
367: pathwaygene<-length(intersect(toupper(GO_CC_list[[i]]),
372: c<-pathwaygene-a
381: mdat[i,7]<-pathwaygene
413: pathwaygene<-length(intersect(toupper(GO_MF_list[[i]]),
418: c<-pathwaygene-a
427: mdat[i,7]<-pathwaygene
455: data(Msig_GENCODE_df_hg_v36,package="seq2pathway.data")
458: data(Msig_GENCODE_df_hg_v19,package="seq2pathway.data")
461: data(Msig_GENCODE_df_mm_vM25,package="seq2pathway.data")
464: data(Msig_GENCODE_df_mm_vM1,package="seq2pathway.data")
489: c<-pathwaygene-a
498: mdat[i,7]<-pathwaygene
549: data(gencode_coding,package="seq2pathway.data")
647: rungene2pathway <-
704: colnames(res) <- c(paste(colnames(dat),"2pathscore",sep=""))
705: print("gene2pathway calculates score....... done")
711: rungene2pathway_EmpiricalP <-
770: colnames(res) <- c(paste(colnames(dat),"2pathscore",sep=""))
829: colnames(res_p) <- c(paste(colnames(dat),"2pathscore_Pvalue",sep=""))
832: print("pathwayscore Empirical Pvalue calculation..........done")
849:   success <- grepl(pattern1, cmdpath, fixed=TRUE) ||
850:     grepl(pattern2, cmdpath, fixed=TRUE)
851:   if (success) cmdpath else ""
1007:     #cat(paste("inputpath=","'",inputpath,"/'",sep=""),sep="\n")
1009:     #cat(paste("outputpath=","'",outputpath,"/'",sep=""),sep="\n")
1018:     cat(paste("pwd=","'",system.file(package="seq2pathway.data"),"/extdata/'",sep=""),sep="\n")
1103: data(GO_BP_list,package="seq2pathway.data")
1104: data(GO_MF_list,package="seq2pathway.data")
1105: data(GO_CC_list,package="seq2pathway.data")
1106: data(Des_BP_list,package="seq2pathway.data")
1107: data(Des_CC_list,package="seq2pathway.data")
1108: data(Des_MF_list,package="seq2pathway.data")
1134: #############################rungene2pathway,normalization,empiricalP,summary table
1166: GO_BP_FAIME<-rungene2pathway(dat=dat_CP,gsmap=GO_BP_list,alpha=alpha,logCheck=logCheck,
1171: GO_BP_FAIME_Pvalue<-rungene2pathway_EmpiricalP(dat=dat_CP,gsmap=GO_BP_list,
1174: ########gene2pathway table
1190: gene2pathway_result[[n.list]]<-GO_BP_N_P
1191: names(gene2pathway_result)[n.list]<-c("GO_BP")
1195: GO_MF_FAIME<-rungene2pathway(dat=dat_CP,gsmap=GO_MF_list,alpha=alpha,logCheck=logCheck,
1198: GO_MF_FAIME_Pvalue<-rungene2pathway_EmpiricalP(dat=dat_CP,gsmap=GO_MF_list,
1215: gene2pathway_result[[n.list]]<-GO_MF_N_P
1216: names(gene2pathway_result)[n.list]<-c("GO_MF")
1220: GO_CC_FAIME<-rungene2pathway(dat=dat_CP,gsmap=GO_CC_list,alpha=alpha,logCheck=logCheck,
1223: GO_CC_FAIME_Pvalue<-rungene2pathway_EmpiricalP(dat=dat_CP,gsmap=GO_CC_list,
1241: gene2pathway_result[[n.list]]<-GO_CC_N_P
1242: names(gene2pathway_result)[n.list]<-c("GO_CC")
1245: dat_FAIME<-rungene2pathway(dat=dat_CP,gsmap=DataBase,alpha=alpha,logCheck=logCheck,
1248: dat_FAIME_Pvalue<-rungene2pathway_EmpiricalP(dat=dat_CP,gsmap=DataBase,
1255: colnames(DB_N_P)<-c("score2pathscore_Normalized","score2pathscore_Pvalue")
1274: gene2pathway_result<-DB_N_P[,c(ncol(DB_N_P),1:(ncol(DB_N_P)-1))]
1276: print("gene2pathway analysis is done")
1279: if(exists("gene2pathway_result")&exists("FS_test")){
1283: TotalResult[[2]]<-gene2pathway_result
1284: names(TotalResult)[2]<-"gene2pathway_result.FAIME"
1286: names(TotalResult)[3]<-"gene2pathway_result.FET"
1289: }else if(exists("gene2pathway_result")&exists("FS_test")==FALSE){
1293: TotalResult[[2]]<-gene2pathway_result
1294: names(TotalResult)[2]<-"gene2pathway_result.FAIME"
1298: else if(exists("gene2pathway_result")==FALSE&exists("FS_test")){
1303: names(TotalResult)[2]<-"gene2pathway_result.FET"
1326: data(GO_BP_list,package="seq2pathway.data")
1327: data(GO_MF_list,package="seq2pathway.data")
1328: data(GO_CC_list,package="seq2pathway.data")
1329: data(Des_BP_list,package="seq2pathway.data")
1330: data(Des_CC_list,package="seq2pathway.data")
1331: data(Des_MF_list,package="seq2pathway.data")
1346: #############################rungene2pathway,normalization,empiricalP,summary table
1348: gene2pathway_result<-list()
1352:   GO_BP_method<-rungene2pathway(dat=dat,gsmap=GO_BP_list,alpha=alpha,logCheck=logCheck,
1358:     GO_BP_method_Pvalue<-rungene2pathway_EmpiricalP(dat=dat,gsmap=GO_BP_list,alpha=alpha,
1364:   ########gene2pathway table
1376:   gene2pathway_result[[n.list]]<-GO_BP_N_P
1377:   names(gene2pathway_result)[n.list]<-c("GO_BP")
1380:     GO_MF_method<-rungene2pathway(dat=dat,gsmap=GO_MF_list,alpha=alpha,logCheck=logCheck,
1384:       GO_MF_method_Pvalue<-rungene2pathway_EmpiricalP(dat=dat,gsmap=GO_MF_list,alpha=alpha,
1402:   gene2pathway_result[[n.list]]<-GO_MF_N_P
1403:   names(gene2pathway_result)[n.list]<-c("GO_MF")
1406:    GO_CC_method<-rungene2pathway(dat=dat,gsmap=GO_CC_list,alpha=alpha,logCheck=logCheck,
1410:       GO_CC_method_Pvalue<-rungene2pathway_EmpiricalP(dat=dat,gsmap=GO_CC_list,alpha=alpha,
1427:   gene2pathway_result[[n.list]]<-GO_CC_N_P
1428:   names(gene2pathway_result)[n.list]<-c("GO_CC")
1431: dat_method<-rungene2pathway(dat=dat,gsmap=DataBase,alpha=alpha,logCheck=logCheck,
1435: dat_method_Pvalue<-rungene2pathway_EmpiricalP(dat=dat,gsmap=DataBase,alpha=alpha,
1443: colnames(DB_N_P)<-c("score2pathscore_Normalized","score2pathscore_Pvalue")
1464: gene2pathway_result<-DB_N_P[,c(ncol(DB_N_P),1:(ncol(DB_N_P)-1))]
1466: print("gene2pathway analysis is done")
1470: if(exists("gene2pathway_result")&exists("FS_test")){
1472: TResult[[1]]<-gene2pathway_result
1473: names(TResult)[1]<-"gene2pathway_result.2"
1475: names(TResult)[2]<-"gene2pathway_result.FET"
1476: }else if(exists("gene2pathway_result")&exists("FS_test")==FALSE){
1477: TResult<-gene2pathway_result
1479: else if(exists("gene2pathway_result")==FALSE&exists("FS_test")){
NoRCE:R/pathway.R: [ ]
351:   path <- merge(merge1, symb, by = "gene")
65:     pathTable <- unique(keggPathwayDB(org_assembly))
71:     pathfreq <- as.data.frame(table(annot$pathway))
99:     pathT <- as.character(freq$Var1[enrich])
118:     pathways <- data.frame(unique(pathT))
203:     pathTable <- unique(reactomePathwayDB(org_assembly))
209:     pathfreq <- as.data.frame(table(annot$pathway))
235:     pathT <- as.character(freq$Var1[enrich])
540:   pathTable <- unique(WikiPathwayDB(org_assembly))
545:   pathfreq <- as.data.frame(table(annot$pathID))
571:   pathT <- as.character(freq$Var1[enrich])
578:   pathTerms <- as.character(r$pathTerm[match(pathT, r$pathID)])
628: pathwayEnrichment <- function(genes,
678:   pathfreq <- as.data.frame(table(annot$pathTerm))
710:   pathT <- as.character(freq$Var1[enrich])
718:   pathTerms <- as.character(r$pathTerm[match(pathT, r$pathID)])
270: reactomePathwayDB <- function(org_assembly = c("hg19",
357: keggPathwayDB <- function(org_assembly = c("hg19",
433: WikiPathwayDB <- function(org_assembly = c("hg19",
15: #' @param gmtFile File path of the gmt file
91:         file.path(x[1], x[2]))
95:         file.path(x[1], x[2]))
155: #' @param gmtFile File path of the gmt file
228:       file.path(x[1], x[2]))
231:       file.path(x[1], x[2]))
353:   return(path)
499: #' @param gmtFile File path of the gmt file
563:       file.path(x[1], x[2]))
567:       file.path(x[1], x[2]))
608: #' @param gmtFile File path of the gmt file
703:     file.path(x[1], x[2]))
706:     file.path(x[1], x[2]))
1: #' KEGG pathway enrichment
22: #' @return KEGG pathway enrichment results
68:     annot <- pathTable[which(pathTable$symbol %in% genes$g),]
72:     pathfreq <- pathfreq[which(pathfreq$Freq > 0),]
75:     geneSize = length(unique(pathTable$symbol))
77:     bckfreq <- as.data.frame(table(pathTable$pathway))
78:     notGene <- bckfreq[bckfreq$Var1 %in% pathfreq$Var1,]
79:     freq <- merge(pathfreq, notGene, by = "Var1")
104:     r <- annot[annot$pathway %in% pathT,]
106:     for (i in seq_along(pathT))
108:       if (length(which(pathT[i] == r$pathway)) > 0)
113:               as.character(r[which(pathT[i] == r$pathway),]$symbol)),
114:                      paste(pathT[i])))
119:     tmp <- character(length(pathT))
120:     if (nrow(pathways) > 0) {
122:         unlist(lapply(seq_len(nrow(pathways)), function(x)
123:           tmp[x] <- try(KEGGREST::keggGet(pathT[x])[[1]]$NAME)
129:         ID = pathT,
141: #' Reactome pathway enrichment
163: #' @return Reactome pathway enrichment results
206:     annot <- pathTable[which(pathTable$symbol %in% genes$g),]
210:     pathfreq <- pathfreq[which(pathfreq$Freq > 0),]
212:     geneSize = length(unique(pathTable$symbol))
214:     bckfreq <- as.data.frame(table(pathTable$pathway))
215:     notGene <- bckfreq[bckfreq$Var1 %in% pathfreq$Var1,]
216:     freq <- merge(pathfreq, notGene, by = "Var1")
240:     r <- annot[annot$pathway %in% pathT,]
244:     for (i in seq_along(pathT))
246:       if (length(which(pathT[i] == r$pathway)) > 0)
251:               list(as.character(r[which(pathT[i] == r$pathway),]$symbol)),
252:                      paste(pathT[i])))
258:         ID = pathT,
259:         Term = as.character(rt[order(match(rt$pathway, pathT)), ]$name),
279:   table1 <- data.frame(pathway = rep(names(xx), lapply(xx, length)),
282:   pn <- data.frame(pathway = rep(names(pn), lapply(pn, length)),
288:     ty <- table1[grepl("^R-HSA", table1$pathway),]
289:     pn1 <- pn[grepl("^R-HSA", pn$pathway),]
296:     ty <- table1[grepl("^R-MMU", table1$pathway),]
297:     pn1 <- pn[grepl("^R-MMU", pn$pathway),]
304:     ty <- table1[grepl("^R-DRE", table1$pathway),]
305:     pn1 <- pn[grepl("^R-DRE", pn$pathway),]
312:     ty <- table1[grepl("^R-RNO", table1$pathway),]
313:     pn1 <- pn[grepl("^R-RNO", pn$pathway),]
320:     ty <- table1[grepl("^R-CEL", table1$pathway),]
321:     pn1 <- pn[grepl("^R-CEL", pn$pathway),]
328:     ty <- table1[grepl("^R-SCE", table1$pathway),]
329:     pn1 <- pn[grepl("^R-SCE", pn$pathway),]
342:     ty <- table1[grepl("^R-DME", table1$pathway),]
343:     pn1 <- pn[grepl("^R-DME", pn$pathway),]
349:                   by = "pathway",
369:     kegg <- org.Hs.eg.db::org.Hs.egPATH2EG
377:     kegg <- org.Mm.eg.db::org.Mm.egPATH2EG
385:     kegg <- org.Dr.eg.db::org.Dr.egPATH2EG
393:     kegg <- org.Rn.eg.db::org.Rn.egPATH2EG
401:     kegg <- org.Ce.eg.db::org.Ce.egPATH2EG
409:     kegg <- org.Sc.sgd.db::org.Sc.sgdPATH2ORF
417:     kegg <- org.Dm.eg.db::org.Dm.egPATH2EG
423:   pathTable <-
424:     data.frame(pathway = paste0(prefix, rep(names(kegg2),
429:   pathTable <- merge(pathTable, x, by = "gene")
430:   return(pathTable)
472:     do.call(rbind, strsplit(as.character(gmtFile$pathTerm), '%'))
478:         pathID = tmp[, 3],
479:         pathTerm = tmp[, 1]
506: #' @return Wiki Pathway Enrichment
543:   annot <- pathTable[which(pathTable$gene %in% genes$g),]
546:   pathfreq <- pathfreq[which(pathfreq$Freq > 0),]
548:   geneSize = length(unique(pathTable$gene))
549:   bckfreq <- as.data.frame(table(pathTable$pathID))
550:   notGene <- bckfreq[bckfreq$Var1 %in% pathfreq$Var1,]
551:   freq <- merge(pathfreq, notGene, by = "Var1")
576:   r <- annot[annot$pathID %in% pathT,]
579:   for (i in seq_along(pathT))
581:     if (length(which(pathT[i] == r$pathID)) > 0)
585:           list(as.character(r[which(pathT[i] == r$pathID),]$gene)),
586:                           paste(pathT[i])))
593:       ID = pathT,
594:       Term = pathTerms,
604: #' For a given gmt file of a specific pathway database, pathway enrichment
626: #' @return Pathway Enrichment
670:     pathTable <-
675:     pathTable <- geneListEnrich(f = gmtFile, isSymbol = isSymbol)
677:   annot <- pathTable[which(pathTable$symbol %in% genes$g),]
679:   pathfreq <- pathfreq[which(pathfreq$Freq > 0),]
683:     geneSize = length(unique(pathTable$symbol))
688:   bckfreq <- as.data.frame(table(pathTable$pathTerm))
690:   notGene <- bckfreq[bckfreq$Var1 %in% pathfreq$Var1,]
691:   freq <- merge(pathfreq, notGene, by = "Var1")
716:   r <- annot[annot$pathTerm %in% pathT,]
720:   for (i in seq_along(pathT))
722:     if (length(which(pathT[i] == r$pathTerm)) > 0)
725:           list(as.character(r[which(pathT[i] == r$pathTerm),]$symbol)),
726:                           paste(pathT[i])))
731:       ID = pathT,
732:       Term = pathTerms,
742: #' Convert gmt formatted pathway file to the Pathway ID, Entrez, symbol
745: #' @param gmtName Custom pathway gmt file
814:     colnames(f) <- c('pathTerm', 'Entrez', 'symbol')
829:     colnames(f) <- c('pathTerm', 'symbol', 'Entrez')
851:     colnames(f) <- c('pathTerm', 'Entrez', 'symbol')
862:     colnames(f) <- c('pathTerm', 'symbol', 'Entrez')
278:   xx <- as.list(reactome.db::reactomePATHID2EXTID)
281:   pn <- as.list(reactome.db::reactomePATHID2NAME)
443:       rWikiPathways::downloadPathwayArchive(organism = "Homo sapiens",
447:       rWikiPathways::downloadPathwayArchive(organism = "Mus musculus",
451:       rWikiPathways::downloadPathwayArchive(organism = "Danio rerio",
455:       rWikiPathways::downloadPathwayArchive(organism = "Rattus norvegicus",
459:       rWikiPathways::downloadPathwayArchive(
463:       rWikiPathways::downloadPathwayArchive(
467:       rWikiPathways::downloadPathwayArchive(
485: #' WikiPathways Enrichment
CHRONOS:R/pathwayToGraph.R: [ ]
101:         path <- paste(dir, file, sep='//')
34:         paths <- list.files(xmlDir) 
83: pathwayToGraph <- function (i, ...)
3: createPathwayGraphs <- function(org, pathways, edgeTypes, doubleEdges, choice,
141: getPathwayType                    <- function(filepath, file)
159: metabolicPathwayToGraph           <- function(filepath)
347: nonMetabolicPathwayToGraph <- function(filepath, doubleEdges, groupMode)
102:         gr   <- metabolicPathwayToGraph(path)
119:         path <- paste(dir, file, sep='//')
120:         gr   <- nonMetabolicPathwayToGraph(path, doubleEdges, groupMode)
225: removeCompoundsMetabolicGraph     <- function(path)
228:     if(path$name != gsub('ec','',path$name)) { nodeType<-"enzyme" }
229:     enzymes  <- which(path$vertices$type == nodeType)
230:     vid      <- path$vertices$id
233:     if ( length(path$edges) > 0 )
243:             for (r1 in path$edges[path$edges$e1 == 
244:                                 path$vertices[,'id'][enzymes[j]],]$e2)  
247:                 for (r2 in path$edges[path$edges$e1 == 
248:                                 path$vertices[,'id'][which(vid == r1)],]$e2)
252:                     nid <- vid[which(path$vertices$id == r2)]
267:     xid    <- path$vertices$id[enzymes]
268:     names  <- path$vertices$names[enzymes]       
513: removeCompoundsNonMetabolicGraph <- function(path, unique, edgeTypes)
515:     if (is.null(path)) return(NULL)
516:     vid      <- as.numeric(path$vertices$id)
517:     etype    <- path$vertices$type
519:     if(path$name != gsub('ko','',path$name)) { nodeType <- "ortholog" }
522:     genesIndx <- which(path$vertices$type == nodeType)
528:         neighbors <- path$edges$e2[path$edges$e1 == vid[gi]]
546:                 idx1 <- which( path$edges$e1 == vid[gi] )
547:                 idx2 <- which( path$edges$e2 == vid[nbrId] )
549:                 TT   <- c( TT, paste((path$edges$type[idx]), collapse='_') )
557:                 cpdNeighbors <- path$edges$e2[ 
558:                                         which(path$edges$e1 == vid[nbrId]) ]
586:         names            <- unique(path$vertices$names[genesIndx])
598:             idx1 <- which(path$vertices$id == source[i])
599:             idx2 <- which(path$vertices$id == destin[i])
600:             source[i] <- names[ names == path$vertices$names[idx1] ]
601:             destin[i] <- names[ names == path$vertices$names[idx2] ]
623:         gids                <- path$vertices$id[genesIndx]
624:         names               <- unname(path$vertices$names[genesIndx])
31:     # Choose valid pathways
32:     if (missing(pathways))  
37:     if (!missing(pathways)) 
39:         paths <- paste(org, pathways, '.xml', sep='') 
44:     # Create compact adjacency matrices for given pathways.
45:     types  <- getPathwayType(paste(xmlDir, paths, sep='//'))
46:     N <- length(paths)
56:                     funcName=pathwayToGraph,
59:                     N=length(paths),
61:                     xmlDir, paths, types, FALSE, edgeTypes, 
64:     names(cAdjMats) <- gsub('.xml', '', paths)
67:     eAdjMats <- .doSafeParallel(funcName=pathwayToGraph,
70:                                 N=length(paths),
72:                                 xmlDir, paths, types, TRUE, edgeTypes, 
75:     names(eAdjMats) <- gsub('.xml', '', paths)
143:     types <- vector(mode='numeric', length=length(filepath))
144:     for (i in 1:length(filepath))
146:         num <- tail(unlist(strsplit(filepath[i], '//')), 1)
156: # Graph from Metabolic Pathways
161:     xmlDoc <- tryCatch(xmlTreeParse(filepath,error=NULL),
344: # Graph from Mon Metabolic Pathways
350:     xmlDoc         <- tryCatch(xmlTreeParse(filepath,error=NULL),
49:         'nonMetabolicPathwayToGraph', 'expandMetabolicGraph', 
51:         'metabolicPathwayToGraph', 'expandNonMetabolicGraph',
609:                 # Set new interaction types to apathetic
732:     # apathetic  3
biodbKegg:R/KeggPathwayConn.R: [ ]
61:         path <- self$getEntry(path.id)
59:     for (path.id in id) {
127:     for (path.id in id) {
304:     path_idx <- sub('^[^0-9]+', '', id)
322:     path_idx <- sub('^[^0-9]+', '', id)
29: KeggPathwayConn <- R6::R6Class("KeggPathwayConn",
40:     super$initialize(db.name='pathway', db.abbrev='path', ...)
62:         if ( ! is.null(path) && path$hasField('kegg.module.id')) {
65:             for (mod.id in path$getFieldValue('kegg.module.id')) {
144:             graph[[path.id]]=list(vertices=vert, edges=edg)
147:             graph[[path.id]]=NULL
309:         params=c(org_name='map', mapno=path_idx,
325:     img_filename <- paste0('pathwaymap-', path_idx)
331:             biodb::error0('Impossible to find pathway image path inside',
335:         tmp_file <- file.path(cache$getTmpFolderPath(),
2: #' The connector class to KEGG Pathway database.
16: #' conn=mybiodb$getFactory()$createConn('kegg.pathway')
18: #' # Retrieve all reactions related to a mouse pathway:
21: #' # Get a pathway graph
44: #' Retrieves all reactions part of a KEGG pathway. Connects to
45: #'     KEGG databases, and walk through all pathways submitted, and
58:     # Loop on all Pathway IDs
89: #' Takes a list of pathways IDs and converts them to the specified organism,
92: #' @param org The organism in which to search for pathways, as a KEGG organism
113: #' Builds a pathway graph in the form of two tables of vertices and edges,
115: #' @param id A character vector of KEGG pathway entry IDs.
120: #' @return A named list whose names are the pathway IDs, and values are lists
126:     # Loop on all pathway IDs
158: #' Builds a pathway graph, as an igraph object, using KEGG database.
159: #' @param id A character vector of KEGG pathway entry IDs.
196: #' Create a pathway graph picture, with some of its elements colorized.
197: #' @param id A KEGG pathway ID.
227: #' Extracts shapes from a pathway map image.
228: #' @param id A KEGG pathway ID.
303:     # Extract pathway number
308:         'show_pathway'),
329:             'src="([^"]+)"(\\s+.*)?\\s+(name|id)="pathwayimage"')
332:                 ' HTML page for pathway ID ', id, '.')
342:     img_file <- cache$getFilePath(cid, img_filename, 'png')
22: #' graph=conn$buildPathwayGraph('mmu00260')
98: convertToOrgPathways=function(id, org) {
122: buildPathwayGraph=function(id, directed=FALSE, drop=TRUE) {
166: getPathwayIgraph=function(id, directed=FALSE, drop=TRUE) {
173:         g <- self$buildPathwayGraph(id=id, directed=directed, drop=FALSE)
210:         pix <- private$getPathwayImage(id)
213:         shapes <- self$extractPathwayMapShapes(id=id, color2ids=color2ids)
233: ,extractPathwayMapShapes=function(id, color2ids) {
237:     html <- private$getPathwayHtml(id)
301: ,getPathwayHtml=function(id) {
319: getPathwayImage=function(id) {
321:     html <- private$getPathwayHtml(id)
NxtIRFcore:R/BuildRef.R: [ ]
993:         path <- tryCatch(BiocFileCache::bfcadd(bfc, url),
483: .validate_path <- function(reference_path, subdirs = NULL) {
577:     map_path <- file.path(normalizePath(reference_path), "Mappability")
836:     r_path <- file.path(reference_path, "resource")
837:     gtf_path <- file.path(r_path, "transcripts.gtf.gz")
972: .get_cache_file_path <- function(cache, rpath) {
10: #' subdirectory within the given `reference_path`. Resources are retrieved via
12: #' 1. User-supplied FASTA and GTF file. This can be a file path, or a web link
44: #' file, open the file specified in the path returned by
49: #' @param reference_path (REQUIRED) The directory path to store the generated
51: #' @param fasta The file path or web link to the user-supplied genome
54: #'   been run using the same `reference_path`.
55: #' @param gtf The file path or web link  to the user-supplied transcript
59: #'   `reference_path`.
65: #'   the file `IRFinder.ref.gz` is present inside `reference_path`.
112: #' * `reference_path/resource/genome.2bit`: Local copy of the genome sequences
114: #' * `reference_path/resource/transcripts.gtf.gz`: Local copy of the gene
117: #'   which is written to the given directory specified by `reference_path`.
119: #' * `reference_path/settings.Rds`: An RDS file containing parameters used
121: #' * `reference_path/IRFinder.ref.gz`: A gzipped text file containing collated
123: #' * `reference_path/fst/`: Contains fst files for subsequent easy access to
125: #' * `reference_path/cov_data.Rds`: An RDS file containing data required to
129: #'   subdirectory inside the designated `reference_path`
131: #' For `GetNonPolyARef`: Returns the file path to the BED file for
137: #' example_ref <- file.path(tempdir(), "Reference")
139: #'     reference_path = example_ref,
144: #'     reference_path = example_ref
149: #' example_ref <- file.path(tempdir(), "Reference")
151: #'     reference_path = example_ref,
156: #' # Get the path to the Non-PolyA BED file for hg19
167: #'     reference_path = "./Reference_user",
179: #'     reference_path = "./Reference_FTP",
214: #'     reference_path = "./Reference_AH",
226: #'     reference_path = "./Reference_UCSC",
236: #' #      inside the given `reference_path`.
241: #'     reference_path = "./Reference_with_STAR",
251: #'     reference_path = "./Reference_with_STAR",
255: #'     reference_path = reference_path,
260: #'     reference_path = "./Reference_with_STAR",
274: #' of the given reference path
277:         reference_path = "./Reference",
282:         reference_path = reference_path,
292: #' given reference path
295:         reference_path = "./Reference",
301:     .validate_path(reference_path)
303:             file.exists(file.path(reference_path, "IRFinder.ref.gz"))) {
307:     extra_files <- .fetch_genome_defaults(reference_path,
313:         reference_path = reference_path,
322:     .process_gtf(reference_data$gtf_gr, reference_path)
329:     .process_introns(reference_path, reference_data$genome,
333:     .gen_irf(reference_path, extra_files, reference_data$genome, chromosomes)
338:         .gen_nmd(reference_path, reference_data$genome))
341:     .gen_splice(reference_path)
342:     if (file.exists(file.path(reference_path, "fst", "Splice.fst"))) {
344:         .gen_splice_proteins(reference_path, reference_data$genome)
354:     cov_data <- .prepare_covplot_data(reference_path)
355:     saveRDS(cov_data, file.path(reference_path, "cov_data.Rds"))
358:     settings.list <- readRDS(file.path(reference_path, "settings.Rds"))
366:     saveRDS(settings.list, file.path(reference_path, "settings.Rds"))
369: #' @describeIn BuildReference Returns the path to the BED file containing
405:         reference_path,
417:             file.exists(file.path(reference_path, "IRFinder.ref.gz"))) {
424:     GetReferenceResource(reference_path = reference_path,
428:     STAR_buildRef(reference_path = reference_path,
432:     BuildReference(reference_path = reference_path,
440: Get_Genome <- function(reference_path, validate = TRUE,
442:     if (validate) .validate_reference(reference_path)
443:     twobit <- file.path(reference_path, "resource", "genome.2bit")
446:     } else if (file.exists(file.path(reference_path, "settings.Rds"))) {
447:         settings <- readRDS(file.path(reference_path, "settings.Rds"))
450:         .log("In Get_Genome, invalid reference_path supplied")
458: Get_GTF_file <- function(reference_path) {
459:     .validate_reference(reference_path)
460:     if (file.exists(file.path(reference_path,
462:         return(file.path(reference_path, "resource", "transcripts.gtf.gz"))
464:         .log("In Get_GTF_file, invalid reference_path supplied")
485:         reference_path != "" &&
487:             ifelse(normalizePath(dirname(reference_path)) != "", TRUE, TRUE),
493:         .log(paste("Error in 'reference_path',",
494:             paste0("base path of '", reference_path, "' does not exist")
498:     base <- normalizePath(dirname(reference_path))
499:     if (!dir.exists(file.path(base, basename(reference_path))))
500:         dir.create(file.path(base, basename(reference_path)))
504:             dir_to_make <- file.path(base, basename(reference_path), subdirs)
508:     return(file.path(base, basename(reference_path)))
511: .validate_reference_resource <- function(reference_path, from = "") {
512:     ref <- normalizePath(reference_path)
517:             "in reference_path =", reference_path,
518:             ": this path does not exist"))
520:     if (!file.exists(file.path(ref, "settings.Rds"))) {
522:             "in reference_path =", reference_path,
525:     settings.list <- readRDS(file.path(ref, "settings.Rds"))
529:             "in reference_path =", reference_path,
535: .validate_reference <- function(reference_path, from = "") {
536:     ref <- normalizePath(reference_path)
541:             "in reference_path =", reference_path,
542:             ": this path does not exist"))
544:     if (!file.exists(file.path(ref, "settings.Rds"))) {
546:             "in reference_path =", reference_path,
549:     if (!file.exists(file.path(ref, "IRFinder.ref.gz"))) {
551:             "in reference_path =", reference_path,
554:     settings.list <- readRDS(file.path(ref, "settings.Rds"))
558:             "in reference_path =", reference_path,
564: .fetch_genome_defaults <- function(reference_path, genome_type,
578:     map_file <- file.path(map_path, "MappabilityExclusion.bed.gz")
586:             genome_type, as_type = "bed.gz", path = map_path, overwrite = TRUE)
638: .get_reference_data <- function(reference_path, fasta, gtf,
644:     .validate_path(reference_path, subdirs = "resource")
646:         twobit <- file.path(reference_path, "resource", "genome.2bit")
650:         gtf <- file.path(reference_path, "resource", "transcripts.gtf.gz")
668:         reference_path = reference_path,
675:         reference_path = reference_path,
682:         reference_path = reference_path
685:     saveRDS(settings.list, file.path(reference_path, "settings.Rds"))
687:     settings.list <- readRDS(file.path(reference_path, "settings.Rds"))
720:         reference_path = "./Reference",
727:         .fetch_fasta_save_2bit(genome, reference_path, overwrite)
731:         twobit <- file.path(reference_path, "resource", "genome.2bit")
735:             genome <- Get_Genome(reference_path, validate = FALSE,
746:             twobit <- file.path(reference_path, "resource", "genome.2bit")
750:                 genome <- Get_Genome(reference_path, validate = FALSE,
764:         .fetch_fasta_save_2bit(genome, reference_path, overwrite)
769:         genome <- Get_Genome(reference_path, validate = FALSE,
794: .fetch_fasta_save_fasta <- function(genome, reference_path, overwrite) {
795:     genome.fa <- file.path(reference_path, "resource", "genome.fa")
806: .fetch_fasta_save_2bit <- function(genome, reference_path, overwrite) {
807:     genome.2bit <- file.path(reference_path, "resource", "genome.2bit")
809:             normalizePath(rtracklayer::path(genome)) ==
819:                 file.exists(rtracklayer::path(genome))) {
820:             file.copy(rtracklayer::path(genome), genome.2bit)
831:         reference_path = "./Reference",
841:         if (overwrite || !file.exists(gtf_path)) {
845:                 if (file.exists(gtf_path)) file.remove(gtf_path)
846:                 file.copy(cache_loc, gtf_path)
856:         if (!file.exists(gtf_path) ||
857:                 normalizePath(gtf_file) != normalizePath(gtf_path)) {
858:             if (overwrite || !file.exists(gtf_path)) {
863:                     if (file.exists(gtf_path)) file.remove(gtf_path)
864:                     file.copy(gtf_file, gtf_path)
866:                     gzip(filename = gtf_file, destname = gtf_path,
991:             return(.get_cache_file_path(cache, res$rpath[nrow(res)]))
999:         if (identical(path, NA)) {
1003:             return(return(.get_cache_file_path(cache, res$rpath[nrow(res)]))) 
1008:         return(.get_cache_file_path(cache, res$rpath[nrow(res)]))
1069: .process_gtf <- function(gtf_gr, reference_path) {
1071:     .validate_path(reference_path, subdirs = "fst")
1074:     Genes_group <- .process_gtf_genes(gtf_gr, reference_path)
1076:     .process_gtf_transcripts(gtf_gr, reference_path)
1078:     .process_gtf_misc(gtf_gr, reference_path)
1080:     .process_gtf_exons(gtf_gr, reference_path, Genes_group)
1086: .process_gtf_genes <- function(gtf_gr, reference_path) {
1131:         file.path(reference_path, "fst", "Genes.fst")
1140: .process_gtf_transcripts <- function(gtf_gr, reference_path) {
1188:         file.path(reference_path, "fst", "Transcripts.fst")
1192: .process_gtf_misc <- function(gtf_gr, reference_path) {
1203:         file.path(reference_path, "fst", "Proteins.fst")
1214:         file.path(reference_path, "fst", "Misc.fst")
1218: .process_gtf_exons <- function(gtf_gr, reference_path, Genes_group) {
1261:         file.path(reference_path, "fst", "Exons.fst"))
1264:         file.path(reference_path, "fst", "Exons.Group.fst")
1326: .process_introns <- function(reference_path, genome,
1331:     data <- .process_introns_data(reference_path, genome, 
1345:         file.path(reference_path, "fst", "junctions.fst"))
1350: .process_introns_data <- function(reference_path, genome,
1353:         read.fst(file.path(reference_path, "fst", "Exons.fst")),
1356:         read.fst(file.path(reference_path, "fst", "Transcripts.fst")),
1359:         read.fst(file.path(reference_path, "fst", "Proteins.fst")),
1362:         read.fst(file.path(reference_path, "fst", "Exons.Group.fst")),
1675: .gen_irf <- function(reference_path, extra_files, genome, chromosome_aliases) {
1680:     data <- .gen_irf_prep_data(reference_path)
1692:         ), stranded = TRUE, reference_path, data2[["introns.unique"]]
1699:         ), stranded = FALSE, reference_path, data2[["introns.unique"]]
1702:     ref.cover <- .gen_irf_refcover(reference_path)
1704:     ref.ROI <- .gen_irf_ROI(reference_path, extra_files, genome,
1707:     readcons <- .gen_irf_readcons(reference_path,
1710:     ref.sj <- .gen_irf_sj(reference_path)
1722:     .gen_irf_final(reference_path, ref.cover, readcons, ref.ROI, ref.sj, chr)
1729: .gen_irf_prep_data <- function(reference_path) {
1731:         read.fst(file.path(reference_path, "fst", "Genes.fst")),
1744:         read.fst(file.path(reference_path, "fst", "junctions.fst"))
1747:         read.fst(file.path(reference_path, "fst", "Exons.fst")),
1751:         read.fst(file.path(reference_path, "fst", "Transcripts.fst")),
1958:         reference_path, introns.unique) {
2013:     rtracklayer::export(IntronCover, file.path(reference_path,
2016:     write.fst(IntronCover.summa, file.path(
2017:         reference_path, "fst",
2074: .gen_irf_refcover <- function(reference_path) {
2075:     tmpdir.IntronCover <- fread(file.path(
2076:         reference_path, "tmpdir.IntronCover.bed"
2079:     tmpnd.IntronCover <- fread(file.path(
2080:         reference_path, "tmpnd.IntronCover.bed"
2093: .gen_irf_ROI <- function(reference_path, extra_files, genome,
2155: .gen_irf_readcons <- function(reference_path,
2184: .gen_irf_sj <- function(reference_path) {
2188:         read.fst(file.path(reference_path, "fst", "junctions.fst"))
2209: .gen_irf_final <- function(reference_path,
2213:     IRF_file <- file.path(reference_path, "IRFinder.ref")
2252:     if (file.exists(file.path(reference_path, "tmpdir.IntronCover.bed"))) {
2253:         file.remove(file.path(reference_path, "tmpdir.IntronCover.bed"))
2255:     if (file.exists(file.path(reference_path, "tmpnd.IntronCover.bed"))) {
2256:         file.remove(file.path(reference_path, "tmpnd.IntronCover.bed"))
2263: .gen_nmd <- function(reference_path, genome) {
2265:     Exons.tr <- .gen_nmd_exons_trimmed(reference_path)
2266:     protein.introns <- .gen_nmd_protein_introns(reference_path, Exons.tr)
2274:     write.fst(NMD.Table, file.path(reference_path, "fst", "IR.NMD.fst"))
2279: .gen_nmd_exons_trimmed <- function(reference_path) {
2281:         read.fst(file.path(reference_path, "fst", "Exons.fst"))
2284:         read.fst(file.path(reference_path, "fst", "Misc.fst"))
2315: .gen_nmd_protein_introns <- function(reference_path, Exons.tr) {
2317:         read.fst(file.path(reference_path, "fst", "junctions.fst"))
2320:         read.fst(file.path(reference_path, "fst", "Misc.fst"))
2624: .gen_splice <- function(reference_path) {
2627:         read.fst(file.path(reference_path, "fst", "junctions.fst"))
2630:         reference_path, candidate.introns)
2661:     introns_found_RI <- .gen_splice_RI(candidate.introns, reference_path)
2677:         .gen_splice_save(AS_Table, candidate.introns, reference_path)
2688: .gen_splice_skipcoord <- function(reference_path, candidate.introns) {
2690:         read.fst(file.path(reference_path, "fst", "Genes.fst"))
3228: .gen_splice_RI <- function(candidate.introns, reference_path) {
3230:         read.fst(file.path(reference_path, "fst", "Exons.fst")),
3234:         read.fst(file.path(reference_path, "fst", "Introns.Dir.fst")))
3269: .gen_splice_save <- function(AS_Table, candidate.introns, reference_path) {
3281:         reference_path)
3282:     AS_Table <- .gen_splice_name_events(AS_Table, reference_path)
3312:         reference_path) {
3314:         read.fst(file.path(reference_path, "fst", "Exons.fst")),
3402:         file.path(reference_path, "fst", "Splice.options.fst"))
3408: .gen_splice_name_events <- function(AS_Table, reference_path) {
3456:         file.path(reference_path, "fst", "Splice.fst"))
3464: .gen_splice_proteins <- function(reference_path, genome) {
3469:         read.fst(file.path(reference_path, "fst", "Splice.fst"))
3472:         read.fst(file.path(reference_path, "fst", "Proteins.fst"))
3511:         file.path(reference_path, "fst", "Splice.Extended.fst"))
14: #'    to specify the files or web paths to use.
199: #' #   rdatapath, sourceurl, sourcetype
810:             normalizePath(genome.2bit)) {
973:     if(grepl(cache, rpath, fixed = TRUE)) {
974:         return(rpath)
976:         return(paste(cache, rpath, sep = "/"))
989:         res <- BiocFileCache::bfcquery(bfc, url, "fpath", exact = TRUE)
1006:         res <- BiocFileCache::bfcquery(bfc, url, "fpath", exact = TRUE)
qusage:R/qusage.R: [ ]
532:           path = q$pathways[[i]]
537:         path = QSarray$pathways[[i]]
379:   PDFs = pathMeans = Sizes = NULL
792:     SDPath = apply(calcBayesCI(QSarray,low=0.5,up=0.8413448)[,path.index,drop=F],2,function(x)x[2]-x[1])
800:       XPath = getXcoords(QSarray,i,addVIF=addVIF)
808:         PDFPath<-approx( XPath, QSarray$path.PDF[,i],X_Sample,rule=2)$y
47:     qs.results.comb$path.mean = 2 * qs.results.comb$path.mean
59:     for(i in c("var.method","labels","pairVector","pathways","path.size")){
408:   geneResults$path.mean = pathMeans
409:   geneResults$path.size = Sizes
412:   geneResults$path.PDF = PDFs
503:   if(!is.null(geneResults$path.PDF)){ ##if defined, rescale the pdf with the new vif values
504:     geneResults$path.PDF = t(t(geneResults$path.PDF) / pdfScaleFactor(geneResults))
524:   if(is.null(QSarray$path.PDF)){stop("convolution results not found.")}
525:   p = sapply(1:ncol(QSarray$path.PDF), function(i){
526:     if(!is.null(QSarray$path.size) && QSarray$path.size[i]==0){return(NA)}
533:           mean(q$mean[-path])
538:         null.hyp = mean(QSarray$mean[-path])
545: #         path = QSarray$pathways[[i]]
546: #         null.hyp=mean(getExAbs(QSarray$dof[path])*QSarray$SD[path])
551:     PDF_NORM<-QSarray$path.PDF[,i]/sum(QSarray$path.PDF[,i])
552: #     sum(QSarray$path.PDF[1:findInterval(0,x),i]) / sum(QSarray$path.PDF[,i])
571: twoWay.pVal <- function(grp1, grp2, path.index1 = 1:numPathways(grp1), path.index2 = 1:numPathways(grp2), 
575:   return(twoCurve.pVal(grp1, grp2, path.index1, path.index2, alternative, direction,addVIF))
582:                         path.index1 = 1:numPathways(grp1),
583:                         path.index2 = 1:numPathways(grp2), 
589: #   if(ncol(grp1$path.PDF)!=ncol(grp2$path.PDF) | all(colnames(grp1$path.PDF) != colnames(grp2$path.PDF))){
592:   if(length(path.index1)!=length(path.index2)){
595: #     if(sum(names(grp1$path.mean[path.index1])!=names(grp2$path.mean[path.index2]))){
599:   x1 = sapply(path.index1,function(i){getXcoords(grp1,i,addVIF=addVIF)})
600:   x2 = sapply(path.index2,function(i){getXcoords(grp2,i,addVIF=addVIF)})
605:   p = sapply(1:length(path.index1), function(i){
607:     PDF1<-approx( x1[,i], grp1$path.PDF[,path.index1[i]],seq(Min[i],Max[i],length.out=Length1+Length2),rule=2)$y
608:     PDF2<-approx( x2[,i], grp2$path.PDF[,path.index2[i]],seq(Min[i],Max[i],length.out=Length1+Length2),rule=2)$y
615: ## path.index can either be an integer between 1 and length(path.means), or the name of the pathway.
618: getXcoords = function(QSarray,path.index=1, addVIF=!is.null(QSarray$vif)){ #,absolute=FALSE){
619:   if(length(path.index)>1){stop("path.index must be of length 1")}
622:   sif = ifelse(addVIF,sqrt(QSarray$vif[path.index]),1)
626:   seq(-1,1,length.out=QSarray$n.points)* QSarray$ranges[path.index]* sif + QSarray$path.mean[path.index]
630: #    MeanAbs<-mean(abs(QSarray$mean[QSarray$pathways[[path.index]]]))
631: #    seq(-1,1,length.out=QSarray$n.points)* QSarray$ranges[path.index]* sif / QSarray$path.size[path.index] + MeanAbs
642:   pdfSum = colSums(QSarray$path.PDF)
655:   cis = sapply(1:ncol(QSarray$path.PDF), function(i){
657:         any(is.na(QSarray$path.PDF[,i]))){return(c(NA,NA))}
659:     cdf = cumsum(QSarray$path.PDF[,i])
668:   colnames(cis) = colnames(QSarray$path.PDF)
771:                                  path.index=1:numPathways(QSarray), ##The pathways to calculate the pVals for.
778:   ##check path.index
779:   if(is.character(path.index)){
780:     path.index = match(path.index, names(QSarray$pathways))
793:     if(!addVIF)SDPath = SDPath / sqrt(QSarray$vif[path.index])
799:     for(i in path.index){
824:             TMP<-pnorm( ( Means[j] - QSarray$path.mean[i]  ) / sqrt( SDPath[i]^2 + (DOF[j])/(DOF[j]-2)*SD[j]^2) )
835:     for(i in path.index){
842:           if(compareTo=="mean")SUBSTRACT=QSarray$path.mean[i]
875:         if(!CompareWithZero)SUBSTRACT=QSarray$path.mean[i]
17:                   geneSets,          ##a list of pathways to be compared. Each item in the list is a vector of names that correspond to the row names of ...(5 bytes skipped)...
74:                          geneSets,          ##a list of pathways to be compared. Each item in the list is a vector of names that correspond to the row names of ...(5 bytes skipped)...
308:  if(!is.null(QSarray$pathways)){stop("too late...aggregateGeneSet already being called")}
320: ##Simple function to read in a .gmt file and return a list of pathways
322:   if(!grepl("\\.gmt$",file)[1]){stop("Pathway information must be a .gmt file")}
331: #######Combine individual gene differential expresseion for each pathway (Neg) ~ 1 minute
334:                            geneSets,     ##a list of pathways to be compared, each item in the list is a vector of names that correspond to the gene names fr...(25 bytes skipped)...
336:                            silent=TRUE   ##If false, print a "." every fifth pathway, as a way to keep track of progress
401:     pathMeans = c(pathMeans, mean(Means[Indexes]))
405:   colnames(PDFs) = names(pathMeans) = names(Sizes) = names(geneSets)
407:   geneResults$pathways = geneSets
425: #                    geneSets=NULL, ##a list of pathways calculate the vif for, each item in the list is a vector of names that correspond to the gene n...(32 bytes skipped)...
430:     if(is.null(geneResults$pathways)){stop("Pathway Information not found. Please provide a list of gene sets.")}
431:     geneSets = geneResults$pathways
439: #     geneResults$pathways = geneSets
516: ## function for calculating a p-value for each pathway convolution as output by aggregateGeneSet.
519: ...(59 bytes skipped)... true (and alternative="two.sided"), p-values will be returned as eiter positive or negative if the pathway is greater or less than 0, respectively.
521: ...(15 bytes skipped)...      selfContained=TRUE                ##If false, rather than comparing to 0, it will compare the pathway mean to the mean of all genes not in the pathway.
578: ## A method to compare the pathway convolutions in two QSarray objects. 
588:   ##if the names of the pathways don't match, 
590: #     stop("Pathways in grp1 do not match pathways in grp2")
593:     stop("Number of pathways in grp1 do not match number of pathways in grp2")
596: #         warning("Some of the comparisons are made between different pathways")
614: ## Calculates the x-coordinates for the PDF of a given pathway.
629: #    ###First calculate the new mean of the pathway based on the absolute values of the means
656:     if( (!is.null(QSarray$pathways) && length(QSarray$pathways[[i]])==0 ) ||
772:                                  silent=TRUE,   ##If false, print a "." every fifth pathway, as a way to keep track of progress  
784:   if(is.null(QSarray$pathways)){stop("Pathway Information not found. Please run aggregateGeneSet first.")}
785:   geneSets = QSarray$pathways
805:         Min<-min(c(XGene[1]+ Means[Indexes],XPath[1]))
806:         Max<-max(c(XGene[NPoints]+ Means[Indexes],XPath[QSarray$n.points]))
815:             PS<-c(PS,compareTwoDistsFaster(PDFGene,PDFPath, alternative="two.sided"))                    
860: ...(17 bytes skipped)...             CompareWithZero=TRUE ###Logical, if TRUE compares with mean of zero, else with mean of pathway
862:   if(is.null(QSarray$pathways)){stop("Pathway Information not found. Please provide a list of gene sets.")}
863:   geneSets = QSarray$pathways
898: #                    geneSets=NULL, ##a list of pathways calculate the vif for, each item in the list is a vector of names that correspond to the gene n...(32 bytes skipped)...
901:   if(is.null(geneResults$pathways)){stop("Pathway Information not found. Please provide a list of gene sets.")}
902:   geneSets = geneResults$pathways  
640:   sif = sapply(1:numPathways(QSarray),function(i){ifelse(addVIF,sqrt(QSarray$vif[i]),1)})
TEQC:R/multiTEQCreport.R: [ ]
42:   Path <- getwd()
44:   print(paste("results and report are saved in folder", Path))
47:   imgDir <- file.path(destDir, "image")
82:   write.table(speci, file=file.path(destDir, "fractionReadsOnTarget.txt"), sep="\t", quote=FALSE)
86:   write.table(targcov, file=file.path(destDir, "targetCoverageStats.txt"), sep="\t", quote=FALSE)
100:   write.table(sensi, file=file.path(destDir, "sensitivity.txt"), sep="\t", row.names=FALSE, quote=FALSE)
103:   write.table(perTargCov, file=file.path(destDir, "targetCoverage.txt"), sep="\t", quote=FALSE)
136:   htmlFile <- file.path(destDir, "index.html")
150:   file.copy(cssFile, file.path(destDir, names(cssFile)))
151:   file.copy(system.file("template", "image", biocFile, package="TEQC"), file.path(destDir, "image", biocFile))
167:     imgDir <- file.path(dir, "image")
170:     jpeg(file.path(imgDir, figFile), ...)
172:     png(file.path(imgDir, figFile), ...)
174:     tiff(file.path(imgDir, figFile), ...)
178:     pdf(file.path(imgDir, pdfFile), ...)
183:     hwriteImage(file.path(".", "image", figFile), link=file.path(".", "image", pdfFile))
207:     imgDir <- file.path(dir, "image")
210:     jpeg(file.path(imgDir, figFile), ...)
212:     png(file.path(imgDir, figFile), ...)
214:     tiff(file.path(imgDir, figFile), ...)
218:     pdf(file.path(imgDir, pdfFile), ...)
223:     hwriteImage(file.path(".", "image", figFile), link=file.path(".", "image", pdfFile))
246:     imgDir <- file.path(dir, "image")
249:     jpeg(file.path(imgDir, figFile), ...)
251:     png(file.path(imgDir, figFile), ...)
253:     tiff(file.path(imgDir, figFile), ...)
257:     pdf(file.path(imgDir, pdfFile), ...)
262:     hwriteImage(file.path(".", "image", figFile), link=file.path(".", "image", pdfFile))
289:     imgDir <- file.path(dir, "image")
292:     jpeg(file.path(imgDir, figFile), width=1000, ...)
294:     png(file.path(imgDir, figFile), width=1000, ...)
296:     tiff(file.path(imgDir, figFile),width=1000, ...)
300:     pdf(file.path(imgDir, pdfFile), width=14, ...)
305:     hwriteImage(file.path(".", "image", figFile), link=file.path(".", "image", pdfFile))
335:     imgDir <- file.path(dir, "image")
338:     jpeg(file.path(imgDir, figFile), width=800, height=800, ...)
340:     png(file.path(imgDir, figFile), width=800, height=800, ...)
342:     tiff(file.path(imgDir, figFile), width=800, height=800, ...)
346:     pdf(file.path(imgDir, pdfFile), width=12, height=12, ...)
351:     hwriteImage(file.path(".", "image", figFile), link=file.path(".", "image", pdfFile))
recountmethylation:inst/extdata/scripts/data_analyses.R: [ ]
26: path <- system.file("extdata", "metadata", package = "recountmethylation")
20: savepath <- paste(dfp, env.name, sep = "/")
27: mdpath <- paste(path, list.files(path)[1], sep = "/")
327:   save(ds, file = file.path("data_analyses", "df-l2med-signals.rda"))
28: md <- get(load(mdpath))
Rqc:R/utils.R: [ ]
94:     path <- dirname(file)
99:     data.frame(filename, pair, format, group, reads, total.reads, path, 
cTRAP:R/shinyInterface.R: [ ]
475:                 if (is.function(path)) path <- path()
418:                                         path=".", globalUI=FALSE) {
476:                 ENCODEsamples <- loadENCODEsamples(ENCODEmetadata, path=path)
1194:     inputFile  <- file.path(token, sprintf("input_%s.Rda",  rand))
1195:     outputFile <- file.path(token, sprintf("output_%s.rds", rand))
1380: .predictTargetingDrugsServer <- function(id, x, path=".", globalUI=FALSE,
1405:                 corMatrix, path=path)
1469: .drugSetEnrichmentAnalyserServer <- function(id, x, path=NULL) {
1492:                                            path=path)
1665:                                  file="ENCODEmetadata.rds", path=".") {
1670:         .diffExprENCODEloaderServer(id, metadata, cellLine, gene, path=path)
CONFESS:R/internal_fluo_NBE.R: [ ]
1419:     path <- c(data$UpdatedPath, data$UpdatedPath[1])
2092:   path <- do.call(rbind, res)[, 1]
1493:     path.update <- path[1:(length(path) - 1)]
2432: path.initiator <- function(data, where) {
1381: fixPath <- function(data, groups) {
2060: estimatePath <- function(data, type, start) {
2116: pathUpdater <- function(data, path) {
2246: updateCentroidsPaths <- function(data, estimates, path.type) {
1370: #' It tests whether the path has been appropariately defined and produces an error if not.
1383:     stop("Insert the cell progression path using the labels of Fluo_inspection")
1387:       "Error in cell progression path: you have specified different number of groups than the one estimated"
1396: #' It sort the adjusted (and transfomed) fluorescence signals according to the path progression.
1399: #' @param path.start Integer. A cluster number indicating the starting cluster that algorithm should use to
1400: #'   build the path. The cluster numbers refer to the plot generated by Fluo_inspection(). Default is 1.
1401: #'   If path.type = "circular" the number does not matter. If path.type = "A2Z" the user should inspect the
1402: #'   Fluo_inspection() plot to detect the beginning of the path. If path.type = "other", the function will
1403: #'   not estimate a path. The user has to manually insert the path progression (the cluster numbers) in
1414: orderFluo <- function(data, path.type, updater = FALSE) {
1415:   if (path.type[1] != "circular" & path.type[1] != "A2Z") {
1416:     stop("The path.type is not correctly specified")
1424:     path <- c(1:max(data$Updated.groups), 1)
1435:   for (i in 1:(length(path) - 1)) {
1436:     center1 <- as.numeric(ms[which(ms[, 1] == path[i]), 2:3])
1437:     center2 <- as.numeric(ms[which(ms[, 1] == path[(i + 1)]), 2:3])
1438:     ww <- which(groups == path[(i + 1)])
1462:   for (i in 1:(length(path) - 1)) {
1464:       as.numeric(ms[which(ms[, 1] == path[(length(path) - i + 1)]), 2:3])
1466:       as.numeric(ms[which(ms[, 1] == path[(length(path) - i)]), 2:3])
1467:     ww <- which(groups == path[(length(path) - i)])
1492:   if (path.type[1] == "A2Z") {
1494:     ww <- which(as.numeric(all[, 4]) == path.update[1])
1497:       which(as.numeric(all[, 4]) == path.update[length(path.update)])
1505:   wh <- which(mydata[, 4] == path[length(path)])
1611: #' @param path.type Character vector. A user-defined vector that characterizes the cell progression dynamics.
1612: #'   The first element can be either "circular" or "A2Z" or "other". If "circular" the path progression is
1613: #'   assummed to exhibit a circle-like behavior. If "A2Z" the path is assumed to have a well-defined start
1629:                     path.type,
1643:                          path.type = path.type)
1644:   if (path.type[1] != "other") {
1657:                            path.type = path.type)
2027: #'   It can be either "clockwise" or "anticlockwise" depending on how the path is expected
2049: #' The main function for automatic path estimation .
2053: #'   It can be either "clockwise" or "anticlockwise" depending on how the path is expected
2055: #' @param start Integer. The cluster number that is assigned as the path starting point
2057: #' @return The sorted cluster indices (path)
2093:   path <- rep(path, 2)
2094:   if (length(which(path == start)) == 0) {
2097:   if (start != path[1]) {
2098:     w <- which(path == start)
2099:     path <- path[w[1]:(w[2] - 1)]
2101:     path <- path[1:(length(path) / 2)]
2103:   return(path)
2108: #' A helper that updates the path sorted clusters after re-estimation by change-point analysis.
2110: #' @param data Data matrix. A matrix of centroids with their path progression indices.
2111: #' @param path Numeric vector. The path progression indices.
2113: #' @return The sorted cluster indices (path)
2118:   for (i in 1:length(path)) {
2120:       matrix(rbind(res, data[which(data[, 4] == path[i]),]), ncol = ncol(res))
2142: #' @return The sorted transformed signal differences (path) and the associated change-points
2231: #' It updates the path sorted clusters after re-estimation by change-point analysis.
2236: #' @param path.type Character vector. A user-defined vector that characterizes the cell progression dynamics.
2237: #'   The first element can be either "circular" or "A2Z" or "other". If "circular" the path progression is
2238: #'   assummed to exhibit a circle-like behavior. If "A2Z" the path is assumed to have a well-defined start
2242: #' @return A list of adjusted fluorescence signals and the updated path after the change-point analysis
2258:   if (path.type[1] != "other" & length(estimates[[2]]) > 0) {
2268:       estimatePath(trigs, type = path.type[2], start =
2271:       pathUpdater(data = estimates[[1]], path = data$UpdatedPath)
2421: #' path.initiator
2423: #' It finds the cluster that initiates the progression path.
2427: #'   the starting point of the progression path.
2429: #' @return A starting point for the progression path
2455:     stop("Invalid starting point. Revise init.path parameter!")
2539: ...(7 bytes skipped)...stimates the average difference between the original and the CV estimated pseudotimes. For circular path
2541: #'   maximum pseudotime is 300) in a circular path, two pseudotimes 1 and 300 differ only by 1 and not by 299.
2544: #' @param path.type Character. The input of path.type parameter in pathEstimator().
2552: aveDiff <- function(data, path.type, maxPseudo) {
2553:   if (path.type != "circular") {
2557:   if (path.type == "circular") {
1368: #' FixPath
1390:   return(c(data, list(UpdatedPath = groups)))
1563:   nn <- data$UpdatedPath
2047: #' estimatePath
2106: #' pathUpdater
2267:     data$UpdatedPath <-
1641:     updateCentroidsPaths(data = data,
1655:       updateCentroidsPaths(data = res1[[1]],
2229: #' updateCentroidsPaths
ArrayExpress:R/parseMAGE.r: [ ]
516: 	path = mageFiles$path
30: isOneChannel = function(sdrf,path){
31: 	ph = try(read.AnnotatedDataFrame(sdrf, path = path, row.names = NULL, blank.lines.skip = TRUE, fill = TRUE, varMetadata.char = "$", quote="\""))
39: readPhenoData = function(sdrf,path){
42: 	ph = try(read.AnnotatedDataFrame(sdrf, path = path, row.names = NULL, blank.lines.skip = TRUE, fill = TRUE, varMetadata.char = "$", quote="\""))
105: readAEdata = function(path,files,dataCols,green.only){
108: 	source = getDataFormat(path,files)
121: 		rawdata = try(oligo::read.celfiles(filenames = file.path(path,unique(files))))
123: 			stop("Unable to read cel files in",path)
130: 			dataCols= try(getDataColsForAE1(path,files))
133: 		rawdata = try(read.maimages(files=files,path=path,source="generic",columns=dataCols,annotation=headers$ae1))
138: 		rawdata = try(read.maimages(files=files,path=path,source=source,columns=dataCols,green.only=green.only))
142: 		rawdata = try(read.maimages(files=files,path=path,source="generic",columns=dataCols,green.only=green.only))
149: 		stop("Unable to read data files in",path)
169: readFeatures<-function(adf,path,procADFref=NULL){
173: 	lines2skip = skipADFheader(adf,path,!is.null(procADFref))
174: 	features = try(read.table(file.path(path, adf), row.names = NULL, blank.lines.skip = TRUE, fill = TRUE, sep="\t", na.strings=c('?','NA'), sk...(40 bytes skipped)...
223: readExperimentData = function(idf, path){
224: 	idffile = scan(file.path(path,idf),character(),sep = "\n",encoding="UTF-8")
264: skipADFheader<-function(adf,path,proc=F){
270: 	con = file(file.path(path, adf), "r")	
319: getDataFormat=function(path,files){
326: 		allcnames = scan(file.path(path,files[1]),what = "",nlines = 200, sep = "\t",quiet=TRUE)
329: 			allcnames = scan(file.path(path,files[1]),what = "",nlines = 200, sep = "\t",quiet=TRUE,encoding="latin1")
345: 	allcnames = scan(file.path(path,files[1]),what = "",nlines = 1, sep = "\n",quiet=TRUE)
352: getDataColsForAE1 = function(path,files){
362: 						file.path(system.file("doc", package = "ArrayExpress"),"QT_list.txt"),
375: 	allcnames = scan(file.path(path,files[1]),what = "",nlines = 1, sep = "\t",quiet=TRUE)
430: 		if(!all(sapply(2:length(files), function(i) readLines(file.path(path,files[1]),1) == readLines(file.path(path,files[i]),1))))
518: 	try(file.remove(file.path(path, mageFiles$rawFiles)))
519: 	try(file.remove(file.path(path, mageFiles$processedFiles)))
521: 	try(file.remove(file.path(path, mageFiles$sdrf)))
522: 	try(file.remove(file.path(path, mageFiles$idf)))
523: 	try(file.remove(file.path(path, mageFiles$adf)))
524: 	try(file.remove(file.path(path, mageFiles$rawArchive)))
525: 	try(file.remove(file.path(path, mageFiles$processedArchive)))
AffiXcan:R/AffiXcan.R: [ ]
642:     for(path in tbaPaths) {
643:         tba <- readRDS(path)
6: #' @param tbaPaths A vector of strings, which are the paths to
186: #' @param tbaPaths A vector of strings, which are the paths to
623: #' @param tbaPaths, A vector of strings, which are the paths to
654: #' @param tbaPaths A vector of strings, which are the paths to
1064: #' @param tbaPaths A vector of strings, which are the paths to
38: #'  objects listed in the param tbaPaths. Each of these lists contain two
92: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
102: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
105: affiXcanTrain <- function(exprMatrix, assay, tbaPaths, regionAssoc, cov=NULL,
107:     regionsCount <- overlookRegions(tbaPaths)
131:         pca <- affiXcanPca(tbaPaths, varExplained, scale, regionsCount,
141:             pcs <- affiXcanPcs(tbaPaths, affiXcanTraining, scale, BPPARAM,
194: #' every MultiAssayExperiment RDS object indicated in the param tbaPaths; it is
200: #' of MultiAssayExperiment objects from tbaPaths) of the samples that have to
205: #' listed in the param tbaPaths. Each of these lists contain two objects:
221: #' tbaPaths <- system.file("extdata","training.tba.toydata.rds",
223: #' regionsCount <- overlookRegions(tbaPaths)
235: #' pca <- affiXcanPca(tbaPaths=tbaPaths, varExplained=80, scale=TRUE,
238: affiXcanPca <- function(tbaPaths, varExplained=80, scale=TRUE, regionsCount,
244:     for(i in seq(1,length(tbaPaths))) {
246:         tbaMatrixMAE <- readRDS(tbaPaths[i])
376: #' of MultiAssayExperiment objects from tbaPaths) of the samples that have to
401: #' tbaPaths <- system.file("extdata","training.tba.toydata.rds",
403: #' regionsCount <- overlookRegions(tbaPaths)
416: #' pca <- affiXcanPca(tbaPaths=tbaPaths, varExplained=80, scale=TRUE,
516: #' tbaPaths <- system.file("extdata","training.tba.toydata.rds",
518: #' regionsCount <- overlookRegions(tbaPaths)
531: #' pca <- affiXcanPca(tbaPaths=tbaPaths, varExplained=80, scale=TRUE,
627: #' MultiAssayExperiment RDS object indicated in the param tbaPaths
633: #' testingTbaPaths <- system.file("extdata","testing.tba.toydata.rds",
636: #' regionsCount <- overlookRegions(tbaPaths=testingTbaPaths)
638: overlookRegions <- function(tbaPaths) {
663: #' of MultiAssayExperiment objects from tbaPaths) of the samples that have not
680: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
682: #' testingTbaPaths <- system.file("extdata","testing.tba.toydata.rds",
688: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
691: #' pcs <- affiXcanPcs(tbaPaths=testingTbaPaths, affiXcanTraining=training,
694: affiXcanPcs <- function(tbaPaths, affiXcanTraining, scale, BPPARAM=bpparam(),
700:     for(i in seq(1,length(tbaPaths))) {
703:         tbaMatrixMAE <- readRDS(tbaPaths[i])
746: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
756: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
801: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
811: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
814: #' testingTbaPaths <- system.file("extdata","testing.tba.toydata.rds",
817: #' pcs <- affiXcanPcs(tbaPaths=testingTbaPaths, affiXcanTraining=training,
863: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
873: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
876: #' testingTbaPaths <- system.file("extdata","testing.tba.toydata.rds",
879: #' pcs <- affiXcanPcs(tbaPaths=testingTbaPaths, affiXcanTraining=training,
967: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
977: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
980: #' imputedExpr <- affiXcanImpute(tbaPaths=trainingTbaPaths,
1029: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
1039: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc, cov=trainingCovariates,
1042: #' imputedExpr <- affiXcanImpute(tbaPaths=trainingTbaPaths,
1078: #' trainingTbaPaths <- system.file("extdata","training.tba.toydata.rds",
1088: #' tbaPaths=trainingTbaPaths, regionAssoc=regionAssoc,
1091: #' testingTbaPaths <- system.file("extdata","testing.tba.toydata.rds",
1094: #' exprmatrix <- affiXcanImpute(tbaPaths=testingTbaPaths,
1096: affiXcanImpute <- function(tbaPaths, affiXcanTraining, scale=TRUE,
1098:     regionsCount <- overlookRegions(tbaPaths)
1104:                     tbaPaths refers to ", regionsCount, " regions\n"))
1109:     pcs <- affiXcanPcs(tbaPaths, affiXcanTraining, scale, BPPARAM)
EnMCB:R/utils.R: [ ]
219:           path = getwd(),dpi = 300,units = "in",width = 10, height = 5,
275:            path = getwd(),dpi = 300,units = "in",width = 5, height = 4.5,
388:                     path = getwd(),dpi = 300,units = "in",width = 5, height = 5,
18:   BiocFileCache::bfcadd(ca, rname="IlluminaHumanMethylation450kanno.ilmn12.hg19", fpath=tf,
191:          path = getwd(),dpi = 300,units = "in",width = 5, height = 4.5,
321:          path = getwd(),dpi = 300,units = "in",width = 5, height = 4.5,
8:   if (length(q$rpath)>0) return(readRDS(rev(q$rpath)[1])) # if multiple, use last
savR:R/savR-methods.R: [ ]
270:   path <- location(project)
373:   path <- getInterOpFilePath(project, format)
571:   path <- normalizePath(paste(project@location, "InterOp", format@filename, sep="/"))
611:   path <- getInterOpFilePath(project,format)
519:     filePath <- suppressWarnings(normalizePath(paste(project@location, "InterOp", format@filename, sep="/") ))
585: getInterOpFilePath <- function(project, format) {
271:   if (!file.exists(path))
272:     stop(paste("Project", path, "does not exist."))
285:   path <- normalizePath(paste(reports, "Intensity", sep="/"))
289:         Cairo::Cairo(file=paste(path, "/Chart_", cycle, "_", tolower(base), ".png", sep=""), width=300, height=800, dpi=72, type="png", ...(11 bytes skipped)...
304:   path <- normalizePath(paste(reports, "NumGT30", sep="/"))
307:       Cairo::Cairo(file=paste(path, "/Chart_", cycle, ".png", sep=""), width=300, height=800, dpi=72, type="png", bg="white")
323:   path <- normalizePath(paste(reports, "ByCycle", sep="/"))
326:       Cairo::Cairo(file=paste(path, "/QScore_L", lane, ".png", sep=""), width=800, height=400, dpi=72, type="png", bg="white")
341:   path <- normalizePath(paste(reports, "FWHM", sep="/"))
345:         Cairo::Cairo(file=paste(path, "/Chart_", cycle, "_", tolower(base), ".png", sep=""), width=300, height=800, dpi=72, type="png", ...(11 bytes skipped)...
374:   fh <- file(path, "rb")
572:   fh <- file(path, "rb")
612:   fh <- file(path, "rb")
7:   retval <- new("savProject", location=normalizePath(object))
10:   ri <- normalizePath(paste(object, "RunInfo.xml", sep="/"))
273:   reports <- normalizePath(destination, mustWork=F)
521:     if (file.exists(filePath)) {
586:   return(normalizePath(paste(project@location, "InterOp", format@filename, sep="/")))
12:   retval@runid <- XML::xmlAttrs(XML::xpathApply(runinfo, "/RunInfo/Run")[[1]])["Id"]
13:   retval@number <- as.integer(XML::xmlAttrs(xpathApply(runinfo, "/RunInfo/Run")[[1]])["Number"])
14:   retval@flowcell <- XML::xmlValue(XML::xpathApply(runinfo, "/RunInfo/Run/Flowcell")[[1]])
15:   retval@instrument <- XML::xmlValue(XML::xpathApply(runinfo, "/RunInfo/Run/Instrument")[[1]])
16:   retval@date <- XML::xmlValue(XML::xpathApply(runinfo, "/RunInfo/Run/Date")[[1]])
18:   for (x in XML::xpathApply(runinfo, "/RunInfo/Run/Reads/Read")) {
30:   layout <- XML::xpathApply(runinfo, "/RunInfo/Run/FlowcellLayout")[[1]]
monocle:R/order_cells.R: [ ]
1724:   path <- shortest_paths(g, from = starting_cell, end_cells)
90:     path_vertex <- as.vector(get.all.shortest.paths(net, from = 1, to = i, mode="out")$res[[1]])
412:   FF_path <- unlist(get.shortest.paths(new_subtree, from=as.vector(first_fwd), to=as.vector(last_fwd), mode="out", output="vpath")$vpath)
413:   FR_path <- unlist(get.shortest.paths(new_subtree, from=as.vector(first_fwd), to=as.vector(last_rev), mode="out", output="vpath")$vpath)
414:   RF_path <- unlist(get.shortest.paths(new_subtree, from=as.vector(first_rev), to=as.vector(last_fwd), mode="out", output="vpath")$vpath)
415:   RR_path <- unlist(get.shortest.paths(new_subtree, from=as.vector(first_rev), to=as.vector(last_rev), mode="out", output="vpath")$vpath)
433:   path_weights <- c(FF_weight, FR_weight, RF_weight, RR_weight)
435:   opt_path <- paths[[opt_path_idx]]
459: measure_diameter_path <- function(pq_tree, curr_node, path_lengths)
1741:     path_cells <- names(traverse_res$shortest_path[[1]])
432:   paths <- list(FF_path, FR_path, RF_path, RR_path)
174:   first_diam_path_node_idx <- head(as.vector(diam), n=1)
175:   last_diam_path_node_idx <- tail(as.vector(diam), n=1)
189:     diam_path_names <- V(mst)[as.vector(diam)]$name
434:   opt_path_idx <- head((which(path_weights == min(path_weights))), 1)
91:     pd_subset <- subset(pd, State %in% path_vertex & is.na(scale_pseudotime))
94:     # print(path_vertex)
137: #' @param use_weights Whether to use edge weights when finding the diameter path of the tree.
138: #' @param root_node The name of the root node to use for starting the path finding.
169:   V(new_subtree)[root_node_id]$diam_path_len = length(diam)
177:       (igraph::degree(mst, first_diam_path_node_idx) == 1 &&
178:        igraph::degree(mst, last_diam_path_node_idx) == 1))
186:     #diam_path_vertex_names <- as.vector()
190:     last_bb_point_idx <- which(diam_path_names == last_bb_point)[1]
191:     first_bb_point_idx <- which(diam_path_names == first_bb_point)[1]
243: ...(48 bytes skipped)...x(V(sub_pq$subtree)[v]$name, type=V(sub_pq$subtree)[v]$type, color=V(sub_pq$subtree)[v]$color, diam_path_len=V(sub_pq$subtree)[v]$diam_path_len)
364:   #print ("opt_path:")
417:   # print (FF_path)
418:   # print (FR_path)
419:   # print (RF_path)
420:   # print (RR_path)
422:   FF_weight <- sum(E(new_subtree, path=FF_path)$weight)
423:   FR_weight <- sum(E(new_subtree, path=FR_path)$weight)
424:   RF_weight <- sum(E(new_subtree, path=RF_path)$weight)
425:   RR_weight <- sum(E(new_subtree, path=RR_path)$weight)
437:   # print ("opt_path:")
438:   # print (opt_path)
441:   stopifnot (length(opt_path) == length(q_level_list))
443:   directions <- V(new_subtree)[opt_path]$type
455:   return(list(ql=q_levels, wt=min(path_weights)))
465:     path_lengths[curr_node] = 0
466:     return(path_lengths)
484:     path_lengths[curr_node] = children_count
553: #' @param reverse_main_path Whether to reverse the direction of the trajectory
556: ...(8 bytes skipped)...good_branched_ordering <- function(orig_pq_tree, curr_node, dist_matrix, num_branches, reverse_main_path=FALSE)
574:   branch_node_counts <- V(pq_tree)[type == "Q"]$diam_path_len
721: ...(34 bytes skipped)..._helper(branch_tree, curr_branch, cell_ordering_tree, branch_pseudotimes, dist_matrix, reverse_main_path)
1719: # #' @return a list of shortest path...(46 bytes skipped)...estic distance between initial cell and terminal cells and branch point passes through the shortest path
1726:   return(list(shortest_path = path$vpath, distance = distance, branch_points = intersect(branchPoints, unlist(path$vpath))))
1743:     subset_cell <- c(subset_cell, path_cells)
47: #' @importFrom igraph graph.adjacency V graph.dfs get.all.shortest.paths
140: #' @importFrom igraph graph.empty get.edgelist get.all.shortest.paths
151:     sp <- get.all.shortest.paths(mst, from=V(mst)[root_node])
377: #' @importFrom igraph V vertex edge graph.empty get.shortest.paths E
1055: #' @param num_paths the number of end-point cell states to allow in the biological process.
1065:                        num_paths = NULL,
1084:     if (is.null(num_paths)){
1085:       num_paths = 1
1102: ...(4 bytes skipped)...order_list <- extract_good_branched_ordering(res$subtree, res$root, cellPairwiseDistances(cds), num_paths, FALSE)
1118:     if (is.null(num_paths) == FALSE){
1119:       message("Warning: num_paths only valid for method 'ICA' in reduceDimension()")
1166:     if (is.null(num_paths) == FALSE){
1167:       message("Warning: num_paths only valid for method 'ICA' in reduceDimension()")
1720: #' @importFrom igraph shortest.paths shortest_paths degree
1722:   distance <- shortest.paths(g, v=starting_cell, to=end_cells)
pathVar:R/pipeline.final.R: [ ]
634:     path <- pvalue_results@pwayCounts[[pathway]]
780:     path1 <- pvalue_results@pwayCounts1[[pathway]]
781:     path2 <- pvalue_results@pwayCounts2[[pathway]]
99: pathVarOneSample <- function(dat.mat, pways, test = c("chisq", "exact"), varStat = c("sd", 
131:     pathwayCounts <- lapply(lapply(olap.pways, function(x) table(x, deparse.level = 0)), function(x) if (len...(10 bytes skipped)...
206: pathVarTwoSamplesCont <- function(dat.mat, pways, groups, boot = 1000, varStat = c("sd", "mean", 
290: pathVarTwoSamplesDisc <- function(dat.mat, pways, groups, perc = c(1/3, 2/3), test = c("chisq", 
344:     pathwayCounts1 <- lapply(lapply(olap.pways1, function(x) table(x, deparse.level = 0)), 
354:     pathwayCounts2 <- lapply(lapply(olap.pways2, function(x) table(x, deparse.level = 0)), 
853:     pathDat1 <- as.data.frame(table(mixDat1))
855:     pathDat2 <- as.data.frame(table(mixDat2))
943:     pathname <- sapply(listPath, function(x) if (length(unlist(strsplit(x, "/"))) > 1) {
796:     plotPath1 <- ggplot(path1, aes(x = Cluster, y = Number_of_genes, fill = Cluster)) + geom_bar(stat = "identity", 
800:     plotPath2 <- ggplot(path2, aes(x = Cluster, y = Number_of_genes, fill = Cluster)) + geom_bar(stat = "identity", 
659:         plotPathway <- d + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
738:             plotPathway <- d + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
806:         plotPathway1 <- plotPath1 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
809:         plotPathway2 <- plotPath2 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
871:     plotPathDat1 <- ggplot(path...(136 bytes skipped)...("Number of genes") + theme(legend.position = "none") + ggtitle("Group 1") + xlab("") + ylim(0, max(pathDat1[,2], pathDat2[,2]))
872:     plotPathDat2 <- ggplot(path...(136 bytes skipped)...("Number of genes") + theme(legend.position = "none") + ggtitle("Group 2") + xlab("") + ylim(0, max(pathDat1[,2], pathDat2[,2]))
26: ...(25 bytes skipped)...ptions are TRUE or FALSE. If TRUE then the first column of the tab delimited file is expected to be path IDs. If FALSE, then the first column is expected to be pathway names.
645:     path <- as.data.frame(path)
646:     colnames(path) <- c("Cluster", "Number_of_genes")
653:     d <- ggplot(path, aes(x = Cluster, y = Number_of_genes, fill = Cluster)) + geom_bar(stat = "identity", 
663:             plotPathway <- plotPathway + annotate("text", x = sigCat, y = path[sigCat + 0.1, 
789:     path1 <- as.data.frame(path1)
790:     colnames(path1) <- c("Cluster", "Number_of_genes")
792:     path2 <- as.data.frame(path2)
793:     colnames(path2) <- c("Cluster", "Number_of_genes")
794:     yLimMax <- max(path1[, 2], path2[, 2])
813:             plotPathway1 <- plotPathway1 + annotate("text", x = sigCat, y = path1[sigCat + 
815:             plotPathway2 <- plotPathway2 + annotate("text", x = sigCat, y = path2[sigCat + 
20: #makeDBList put your pathways text file into a list
21: #pway$PATHNAME is the pathway names from the file
22: #pway$PATHID is a vector of pathway ID numbers is there are any. Otherwise it will be a vector filled with NA
23: #pway$GENES is a list of vectors, where each vector are the genes for a single pathway
25: #file is a tab delimited text file, where first and second columns are pathwayID and pathway name. The third (or last column is the genes associated with each pathway, seperated by commas.
33:         pways$PATHNAME <- as.vector(pwayTable[, 2])
34:         pways$PATHID <- as.vector(pwayTable[, 1])
35:         pways$GENES <- list(length(pways$PATHID))
37:         for (i in 1:length(pways$PATHID)) {
43:                 pways$PATHID <- pways$PATHID[-i]
44:                 pways$PATHNAME <- pways$PATHNAME[-i]
49:         pways$PATHNAME <- as.vector(pwayTable[, 1])
50:         pways$PATHID <- rep("NA", length(pways$PATHNAME))
51:         pways$GENES <- list(length(pways$PATHID))
53:         for (i in 1:length(pways$PATHID)) {
59:                 pways$PATHID <- pways$PATHID[-i]
60:                 pways$PATHNAME <- pways$PATHNAME[-i]
64:     names(pways$GENES) <- pways$PATHNAME
69: #pathVarOneSample
73: # 3. For each pathway, we extract the gene in our dataset and in which cluster they belong.
74: # 4. For each pathway, we look how the gene counts in each category and compare it to the reference counts with all th...(59 bytes skipped)...
78: # Output 1: tablePway columns are :pathway name, path...(46 bytes skipped)...or exact test,the percentage of genes from our dataset related to the total number of genes in each pathway, the number of genes from our dataset inside the pathway and the total number of genes inside the pathway
79: #Output 2: NAPways corresponds to the pathway names of the pathway having less than 10 genes for the Chi-Squared or also more than 500 genes for the exact tes.
80: # Output 3: genesInPway correspond to each pathway with the genes from the datasets belonging to it and in which cluster they were classsify.
83: # Output 6: pwayCounts is the genes counts of the each pathway in each cluster.
91: #Input 2: pways contains the pathways of interest (KEGG, REACTOME, etc...) in the same format that makeDBList
103:     # check if any GENES are in the pathway.
106:         stop("None of the genes in the data set are found in the given gene set or pathway")
125:     # olap.pways contains the genes are in each pathway with their cluster number
127:     names(olap.pways) <- pways$PATHNAME
130:     # list of tables of the number of genes in each cluster per pathway
140:     # Chi-Square or Exact test to compare the reference and the pathway distribution
142:         # chisq test and ajustment of the pvalue for each pathway
143:         pvals.pways <- sapply(pathwayCounts, function(x) if (sum(x) >= 10) {
154:         # Exact test and ajustment of the pvalue for each pathway
157:         # We perform the multinomial test on the pathway containing between 10 and 500 genes because a bigger number will involve too many possibilities ...(11 bytes skipped)...
158:         pvals.pways <- sapply(pathwayCounts, function(x) if (sum(x) >= 10 & sum(x) < 500) {
170:     xtab <- data.table(PwayName = pways$PATHNAME[not_na], PwayID = pways$PATHID[not_na], APval = apvals.pways, 
172:         NumOfGenesFromDataSetInPathway = lengths(olap.pways[not_na]), PathwaySize = pways$SIZE[not_na])
176: ...(50 bytes skipped)...ab, NAPways=pval.NA, genesInPway=olap.pways, refProb=pexp, refCounts=pexp * length(mix), pwayCounts=pathwayCounts, numOfClus=nmix, varStat=varStat, genesInClus=mix, var=vs)
181: #pathVarTwoSamplesCont
184: # 2. For each pathway, we extract the gene in our dataset.
185: # 3. For each pathway, we look how its genes are distributed and compare the 2 groups using the bootstrap Kolmogorov-S...(12 bytes skipped)...
189: # Output 1: tablePway columns are :pathway name, pathway IDs, adjusted p-value ffrom the boot KS test, the number of genes from our dataset inside the pathway and the total number of genes inside the pathway.
190: #Output 2: NAPways corresponds to the pathway names of the pathway having no genes inside the dataset.
191: # Output 3: genesInPway correspond to the genes from the dataset belonging to each pathway
200: #Input 2: pways contains the pathways of interest (KEGG, REACTOME, etc...) in the same format that makeDBList
209:     # check if any GENES are in the pathway
212:         stop("None of the genes in the data set are found in the given gene set or pathway")
236:     # olap.pways contains the genes from the dataset in each pathway
238:     names(olap.pways) <- pways$PATHNAME
239:     # We compare the two densities (one for each group) of the genes of each pathway with the Kolmogorov-Smirnow test.       
251:     xtab <- data.table(PwayName = pways$PATHNAME[not_na], PwayID = pways$PATHID[not_na], APval = apvals, 
253:         NumOfGenesFromDataSetInPathway = lengths(olap.pways[not_na]), PathwaySize = pways$SIZE[not_na])
261: #pathVarTwoSamplesDisc
265: # 3. For each pathway, we extract the gene in our dataset and in which cluster they belong.
266: # 4. For each pathway, we look at the gene counts in each category and compare the 2 samples to each other with all th...(60 bytes skipped)...
269: # Output 1: tablePway columns are :pathway name, path...(11 bytes skipped)...justed p-value, the percentage of genes in our dataset related to the total number of genes in each pathway, the number of genes from our dataset inside the pathway and the total number of genes inside the pathway.
270: #Output 2: NAPways corresponds to the pathway names of the pathway having no genes inside the dataset.
271: # Output 3: genesInPway1 corresponds to the genes from the dataset belonging to each pathway in the first sample
272: # Output 4: genesInPway2 corresponds to the genes from the dataset belonging to each pathway in the second sample
273: # Output 5: pwayCounts1 corresponds to a list of tables of the number of genes in each cluster per pathway for group 1
274: # Output 6: pwayCounts2 corresponds to a list of tables of the number of genes in each cluster per pathway for group 2
283: #Input 2: pways contains the pathways of interest (KEGG, REACTOME, etc...) in the same format that makeDBList
294:     # check if any GENES are in the pathway
297:         stop("None of the genes in the data set are found in the given gene set or pathway")
338:     # olap.pways contains the genes from the dataset in each pathway
340:     names(olap.pways1) <- pways$PATHNAME
342:     names(olap.pways2) <- pways$PATHNAME
343:     # list of tables of the number of genes in each cluster per pathway
353:     # list of tables of the number of genes in each cluster per pathway
364:         # chisq test and ajustment of the pvalue for each pathway
365:         pvals.pways <- sapply(pways$PATHNAME, function(x) if (sum(pathwayCounts1[x][[1]]) >= 
367:             exp.val <- pathwayCounts1[x][[1]]  #forgot the.val
368:             chi <- sum((pathwayCounts2[x][[1]] - exp.val)^2/exp.val)
374:         pval.NA <- pways$PATHNAME[-not_na]
377:         # Exact test and ajustment of the pvalue for each pathway
380:         # We perform the multinomial test on the pathway containing between 10 and 500 genes because a bigger number will involve too many possibilities ...(11 bytes skipped)...
381:         pvals.pways <- sapply(pways$PATHNAME, function(x) if (sum(pathwayCounts1[x][[1]]) >= 
382:             10 & sum(pathwayCounts1[x][[1]]) < 500) {
383:             pexp <- pathwayCounts1[x][[1]]/sum(pathwayCounts1[x][[1]])
384:             multinomial.test(as.vector(pathwayCounts2[x][[1]]), as.vector(pexp), useChisq = FALSE)$p.value
391:         pval.NA <- pways$PATHNAME[-not_na]
395:     xtab <- data.table(PwayName = pways$PATHNAME[not_na], PwayID = pways$PATHID[not_na], APval = apvals.pways, 
397:         NumOfGenesFromDataSetInPway = lengths(olap.pways1[not_na]), PathwaySize = pways$SIZE[not_na])
402: ...(36 bytes skipped)...", tablePway=xtab, NAPways=pval.NA, genesInPway1=olap.pways1, genesInPway2=olap.pways2, pwayCounts1=pathwayCounts1, pwayCounts2=pathwayCounts2, groups=groups, groupNames=groupNames, var1=var_1, var2=var_2, varStat=varStat)
409: #It is a function that returns the significant pathway(s),which category(ies) from this pathway are significant and which gene(s) belongs to this(ese) category(ies).
413: # Output 1: genesInSigPways1 contains the genes per significant pathway belonging to the significant category.
414: #Output 2: sigCatPerPway contains the category(ies) per pathway that are significant.
418: #Input 1: pvalue_results is result from the pathVarOneSample function
430:         warning("There are no significant pathways. Quitting significant_category function and returning empty object")
434:     # PathName that were significant in xtab.
436:     # The list of table with the number of genes in each cluster from the significant pathways
442:     # results contain the p-value for each category in each pathway computed with the binomial test.
450:     # For each significant pathway we look which category(ies) is are significant and the genes
477: #It is a function that returns the significant pathways and which genes belongs to these #pathways.
481: # Output 1: genesInSigPways1 contains the genes belonging to each significant pathway
485: #Input 1: pvalue_results is result from the pathVarTwoSamplesCont function
493:         warning("There are no significant pathways. Quitting significant_category function and returning empty object")
497:     # Pathways that were significant in xtab.
499:     # Genes from the dataset inside each significant pathway
507: #It is a function that returns the significant pathways and which genes belong to these pathways
511: # Output 1: genesInSigPways1 contains the genes belonging to each significant pathway in significant categories in the first sample
512: # Output 2: genesInSigPways2 contains the genes belonging to each significant pathway in significant categories in the second sample
513: # Output 3: sigCatPerPway contains the significant categories in each pathway
517: #Input 1: pvalue_results is result from the pathVarTwoSamplesDisc function
527:         warning("There are no significant pathways. Quitting significant_category function and returning empty object")
531:     # PathName that were significant in xtab.
533:     # The list of table with the number of genes in each cluster from the significant pathways
540:     # results contain the p-value for each category in each pathway computed with the binomial
550:     # For each significant pathway we look which category(ies) are significant and the genes belonging to this(ese) category(ies). ...(81 bytes skipped)...
576: ...(77 bytes skipped)...es cases and then use sigOneSample, sigTwoSamplesCont, or sigTwoSamplesDisc to find the significant pathways.
582: #Input 1: pvalue_results is result from the pathVarOneSample, pathVarTwoSamplesCont, or pathVarTwoSamplesDisc function.
602: #It is a function that returns the plot of the reference counts along with the plot of a chosen #pathway. This function is made for output from pathVarOneSample.
605: # plot of the reference and a pathway counts
608: #Input 1: pvalue_results is result from the pathVarOneSample function
609: #Input 2: pathway is the chosen pathway you want to plot.
613: #If sig is not NULL, the function will check if the pathway is a significant one and if yes the
619: plotOneSample <- function(pvalue_results, pathway, sig) {
620:     mp <- pathway
621:     # If the name of the pathway is two long it will cut it into two lines in the plot.
644:     # data frame for the pathway distribution
656:     # If the pathway is one of the significant ones, the title will be in red. and the categories, if any, we be high...(24 bytes skipped)...
657:     if (pathway %in% names(category)) {
658:         sigCat <- category[[pathway]]
670:     # plot the reference and pathway counts side by side
676: ...(34 bytes skipped)... plot of the two densities (one for each group) of the statistics (sd, mad, cv or mean) of a chosen pathway. This function is made for output from pathVarTwoSamplesCont.
682: #Input 1: pvalue_results is result from the pathVarTwoSamplesCont function
683: #Input 2: pathway is the chosen pathway you want to plot.
687: #If sig is not NULL, the function will check if the pathway is a significant one and if yes the title will be printed in red.
690: plotTwoSamplesCont <- function(pvalue_results, pathway, sig) {
691:     mp <- pathway
692:     # If the name of the pathway is two long it will cut it into two lines in the plot.
705:     # If the number of genes of the pathway is less than 3, it is not possible to draw a density and it will return an empty plot with this ...(8 bytes skipped)...
706:     if (xtab[PwayName == pathway, NumOfGenesFromDataSetInPathway] < 3) {
717:         genes <- pvalue_results@genesInPway[[pathway]]
726: ...(0 bytes skipped)...        # Plot of the two densities (one for each group) of the variability of the genes inside the pathway.
736:         # If we included the results of sigTwoSamplesCont, it will verify if the pathway is one of them and if yes the title will be printed in red.
737:         if (pathway %in% significant) {
752: ##It is a function that returns 2 plots of the 2 samples for a chosen pathway. This function is made for output from pathVarTwoSamplesDisc.
755: # plot of the 2 samples for a significant pathway
758: #Input 1: pvalue_results is result from the pathVarTwoSamplesDisc function
759: #Input 2: pathway is the chosen pathway you want to plot.
763: #If sig is not NULL, the function will check if the pathway is a significant one and if yes the title will be printed in red.
766: plotTwoSamplesDisc <- function(pvalue_results, pathway, sig) {
767:     mp <- pathway
768:     # If the name of the pathway is two long it will cut it into two lines in the plot.
791:     # data frame for the pathway distribution
803:     # If the pathway is one of the significant ones, the title will be in red. and the categories, if any, we be high...(24 bytes skipped)...
804:     if (pathway %in% names(category)) {
805:         sigCat <- category[[pathway]]
819:         plotPathway1 <- plotPath1 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
821:         plotPathway2 <- plotPath2 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
824:     # plot the reference and pathway counts side by side
854:     colnames(pathDat1) <- c("Cluster", "Number_of_genes")
856:     colnames(pathDat2) <- c("Cluster", "Number_of_genes")
862:     results <- apply(rbind(pathDat2[,2],pathDat1[,2]/pathDat1[,2]/sum(pathDat1[,2])), 2, function(y) multinomial.test(c(y[1], sum(pathDat2[,2]) - y[1]), prob = c(y[2],1 - y[2]))$p.value)
874:         plotPathDat1 <- plotPathDat1 + annotate("text", x = category, y = pathDat1[category +
876:         plotPathDat2 <- plotPathDat2 + annotate("text", x = category, y = pathDat2[category +
895: ...(46 bytes skipped)...rom the one sample or two samples cases and then use plotOneSample or plotTwoSamples for the chosen pathway.
898: # plot of the results of the one or two samples case for a chosen pathway.
901: #Input 1: pvalue_results is the result from the pathVarOneSample, pathVarTwoSamplesCont, or pathVarTwoSamplesDisc function
902: #Input 2: pathway is the chosen pathway you want to plot.
906: #If sig is not NULL, the function will check if the pathway is a significant one. And they will be highlighted in the resulting plot (see plotOneSample or p...(14 bytes skipped)...
909: plotPway <- function(pvalue_results, pathway, sig = NULL) {
912:         plotOneSample(pvalue_results, pathway, sig)
914:         plotTwoSamplesCont(pvalue_results, pathway, sig)
916:         plotTwoSamplesDisc(pvalue_results, pathway, sig)
923: #Save as a pdf the plots for the one or two samples case of the significant pathway or a chosen list of pathway..
926: # Save as a pdf the plots of the significant pathway or a chosen list of pathway.
929: #Input 1: pvalue_results is the result from the pathVarOneSample, pathVarTwoSamplesCont, or pathVarTwoSamplesDisc function
931: #Input 3: listPath is "significant" if you want to save the plots of the significant pathways or can be a list of names of pathway of interest.
934: #If sig is not NULL, the function will check if the pathway is a significant one. And they will be highlighted in the resulting plot (see plotOneSample or p...(14 bytes skipped)...
937: saveAsPDF <- function(pvalue_results, sig, listPath = "significant") {
938:     # If listPath='significant' we will save as pdf all the plots corresponding to the significant pathway from sig. Other wise it will save the pathways given to listPath.
939:     if (listPath[1] == "significant") {
940:         listPath <- names(sig@genesInSigPways1)
942:     # The name of the file will be the pathname where we replace '/' by '_'
948:     # save as PDF all the pathways significant or given in listPath
949:     for (i in 1:length(pathname)) {
950:         pdf(file = paste(pathname[i], ".pdf", sep = ""), width = 10, height = 7)
951:         plotPway(pvalue_results, listPath[i], sig)
959: #It is a function that returns one list of genes for group 1 and one for group 2 of a chosen pathway having their statistics (sd, mad, cv or mean) inside a chosen interval.
962: # Output 1: genes1 contains the genes belonging to the pathway in the given window for group 1.
963: # Output 2: genes2 contains the genes belonging to the pathway in the given window for group 2.
964: # Output 3: genesAll contains the genes from the dataset belonging to the pathway
967: #Input 1: pvalue_results is result from the pathVarTwoSamplesCont function
968: #Input 2: pathway is the chosen pathway.
973: getGenes <- function(pvalue_results, pathway, window) {
978:     genes <- olap.pways[[pathway]]
981:     # Take the genes from group 1 from the pathway belonging to the window
983:     # Take the genes from group 3 from the pathway belonging to the window
985:     # Take all the genes from the pathway
431:         sig <- new("significantPathway", genesInSigPways1=list(), sigCatPerPway=list(), thresPValue=numeric())
471:     sig <- new("significantPathway", genesInSigPways1=genes, sigCatPerPway=category, thresPValue=pvalue)
494:         sig <- new("significantPathway2", genesInSigPways1=list(), thresPValue=numeric())
501:     sig <- new("significantPathway2", genesInSigPways1=genes, thresPValue=pvalue)
528:         sig <- new("significantPathway3", genesInSigPways1=list(), genesInSigPways2=list(), sigCatPerPway=list(), thresPValue=numeric()...(1 bytes skipped)...
570:     sig <- new("significantPathway3", genesInSigPways1=genes1, genesInSigPways2=genes2, sigCatPerPway=category, thresPValue=pvalue)...(0 bytes skipped)...
667:         plotPathway <- d + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
671:     grid.arrange(arrangeGrob(plotRef, plotPathway, nrow = 1))
742:             plotPathway <- d + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
746:     plot(plotPathway)
825:     grid.arrange(arrangeGrob(plotPathway1, plotPathway2, nrow = 1))
879:         plotPathDat1 <- plotPathDat1 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background...(63 bytes skipped)...
880:         plotPathDat2 <- plotPathDat2 + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background...(63 bytes skipped)...
884:         grid.arrange(arrangeGrob(plotPathDat1, plotPathDat2, nrow = 1))
887:         grid.arrange(arrangeGrob(plotPathDat1, plotPathDat2, nrow = 1))
TrajectoryGeometry:R/TrajectoryGeometry.R: [ ]
796:         path = samplePath(attributes, pseudotime, nWindows = nWindows)
302: pathToSphericalData = function(path,from,to,d,statistic)
431:             randomPath = path
492:         randomPath = matrix(0,nrow=n,ncol=d)
628: pathProgression = function(path,from=1,to=nrow(path),d=ncol(path),
670: samplePath = function(attributes, pseudotime, nWindows = 10){
678:     pathLength = end - start
681:     sampledPath = matrix(, nrow = 0, ncol = ncol(attributes))
1135:     pathLineWidth = 3
45: testPathForDirectionality = function(path,from=1,to=nrow(path),d=ncol(path),
61:     randomPaths = generateRandomPaths(path,
106: projectPathToSphere = function(path,from=1,to=nrow(path),d=ncol(path))
374: generateRandomPaths = function(path,from=1,to=nrow(path),d=ncol(path),
421:     randomPathList = list()
475: generateRandomPathsBySteps = function(path,randomizationParams,N)
489:     randomPathList = list()
564: getDistanceDataForPaths = function(paths,statistic)
1114: plotPathProjectionCenterAndCircle = function(path,
7: #' Test a path for directionality
9: #' This is the core function of this package.  It takes a path, and a
11: #' for the directionality of that path.
13: #' @param path - An n x m matrix representing a series of n points in
15: #' @param from - The starting place along the path which will be
17: #' @param to - The end point of the path.  This defaults to
18: #'     nrow(path).
20: #'     ncol(path)
25: #'     comparison to the given path.
27: #'   pValue - the p-value for the path and statistic in question;
28: #'   sphericalData - a list containing the projections of the path to
39: #' p = testPathForDirectionality(path=straight_path,
42: #' q = testPathForDirectionality(path=crooked_path,from=6,
48:     testPathForDirectionalityTest(path,from,to,d,
53:     path = path[from:to,seq_len(d)]
57:     sphericalData = getSphericalData(path,statistic)
86: #' Project a path onto the unit sphere
88: #' This function takes a path in d dimensional space and projects it onto
92: #' @param path - This is an mxn dimensional matrix. Each row is
94: #' @param from - The starting place along the path which will be
96: #' @param to - The end point of the path.  This defaults to
97: #'     nrow(path).
99: #'     ncol(path)
100: #' @return This returns a projection of the path onto the d-1 sphere
104: #' projection1 = projectPathToSphere(straight_path)
105: #' projection2 = projectPathToSphere(crooked_path,from=6)
108:     projectPathToSphereTest(path,from,to,d)
112:     path = path[from:to,seq_len(d)]
113:     n = nrow(path)
121:         v = path[i,] - path[1,]
150: #' projection = projectPathToSphere(straight_path)
221: #' distances = findSphericalDistance(straight_path_center,
222: #'     straight_path_projection)
253: #' given by the dimensions of the path
255: #' @param path - an m x n matrix.  Each row is considered a point
258: #'     projections of the path to the sphere, the center for those
263: #' sphericalData = getSphericalData(straight_path,'max')
264: getSphericalData = function(path,statistic)
266:     getSphericalDataTest(path,statistic)
269:     to = nrow(path)
270:     d = ncol(path)
272:     return(pathToSphericalData(path,from,to,d,statistic))
277: #' Find the spherical data for a given path
279: #' This function takes a path and returns a list containing
284: #' @param path - This is an mxn dimensional matrix. Each row is
286: #' @param from - The starting place along the path which will be
288: #' @param to - The end point of the path.  This defaults to
289: #'     nrow(path).
291: #'     ncol(path)
294: #'     projections of the path to the sphere, the center for those
299: #' sphericalData = pathToSphericalData(straight_path,from=1,
300: #'                                     to=nrow(straight_path), d=3,
304:     pathToSphericalDataTest(path,from,to,d,statistic)
309:     path = path[from:to,seq_len(d)]
310:     n = nrow(path)
313:     ## Get the projections of the path to the sphere
314:     projections = projectPathToSphere(path)
345: #' Produce random paths modeled on a given path
347: #' This function takes a path and produces N random paths of the same
349: #' permuting the entries in path or by taking steps from the initial
350: #' point of path.  Exact behaviour is controlled by
353: #' @param path - This is an mxn dimensional matrix. Each row is
355: #' @param from - The starting place along the path which will be
357: #' @param to - The end point of the path.  This defaults to
358: #'     nrow(path).
360: #'     ncol(path)
366: #' @return This function returns a list of random paths.  Each path is
371: #' randomPaths = generateRandomPaths(crooked_path,from=6,to=nrow(crooked_path),
372: #'               d=ncol(crooked_path),randomizationParams=randomizationParams,
377:     generateRandomPathsTest(path,from,to,d,randomizationParams,N)
388:     path = path[from:to,seq_len(d)]
391:         return(generateRandomPathsByPermutation(path,
396:         return(generateRandomPathsBySteps(path,
407: ## ' This function produces randomized paths from a given path via
413: ## ' @param path - An n x d matrix.
419:     function(path,randomizationParams,N)
422:     n = nrow(path)
423:     d = ncol(path)
447:         a = as.numeric(path)
450:             b = as.numeric(path)
463: ## ' This function produces randomized paths from a given path by taking
465: ## ' have the same Euclidean length as those of the original path or
467: ## ' requiring the path to stay in the non-negative orthant or allowing
470: ## ' @param path - An n x d matrix.
477:     n = nrow(path)
478:     d = ncol(path)
484:         stepLengths = getStepLengths(path)
493:         randomPath[1,] = path[1,]
515: #' This finds the lengths of the steps along a path
517: #' @param path - This is an mxn dimensional matrix. Each row is
519: #' @param from - The starting place along the path which will be
521: #' @param to - The end point of the path.  This defaults to
522: #'     nrow(path).
524: #'     ncol(path)
525: #' @return This function returns the length of each step in a path.
528: #' stepLengths = getStepLengths(path=crooked_path)
529: #' stepLengths = getStepLengths(path=crooked_path,from=4)
530: getStepLengths = function(path,from=1,to=nrow(path),d=ncol(path))
532:     getStepLengthsTest(path,from,to,d)
536:     path = path[from:to,seq_len(d)]
537:     n = nrow(path)
541:         stepLengths[i] = Norm(path[i+1,] - path[i,])
551: #' for the appropriate center for each path.  Each path
562: #'     generateRandomPaths(path=straight_path,randomizationParam='bySteps',N=5)
604: #' Measure a path's progression
606: #' This function measures the progress of a path in a specified
611: #' @param path - An n x d matrix
612: #' @param from - The point along the path to be taken as the starting
614: #' @param to - The point along the path to be used as the end point.
615: #'     This defaults to nrow(path).
616: #' @param d - The dimension to be used.  This defaults to ncol(path).
620: #'     of the path along the line through its starting point in the
625: #'     pathProgression(straight_path,direction=straight_path_center)
627: #'     pathProgression(crooked_path,from=6,direction=crooked_path_center)
631:     pathProgressionTest(path,from,to,d,direction)
633:     path = path[from:to,seq_len(d)]
635:     distance = numeric(nrow(path)-1)
636:     for(i in 2:nrow(path))
638:         delta = path[i,] - path[1,]
646: #' Sample a path from single cell data
652: #' coordinates of the sampled path. The matrix of attribute values should
657: #' the sampled path give the window number a cell was sampled from.
664: #' @return sampledPath - A path consisting of a matrix of attributes of sampled
675:     ## Set parameters for path.
726: #' and comparing each path to random paths.
731: #' The function returns a list of Answers for each comparison of a sampled path
732: #' to a random path.
746: #'     comparison to the given path (defaults to 1000).
748: #'   information comparing a sampled path to random paths.
750: #'   pValue - the p-value for the path and statistic in question;
751: #'   sphericalData - a list containing the projections of the path to
797:         answers[[i]] = testPathForDirectionality(path, randomizationParams =
835: #'     comparison to the given path (defaults to 1000).
839: #'    entry for each sampled path.
841: #'    sampled path in question
843: #'    pValue - the p-value for the path and statistic in question;
844: #'    sphericalData - a list containing the projections of the path to
1070: #' Plot a path, its projection, its center and its circle
1072: #' This function assumes you have a path in dimension 3 and you have
1075: #' appropriate statistic.  Scales the path to keep it comparable to
1079: #' @param path - A path of dimension 3 in the form of an N x 3 matrix.
1083: #' @param to - Likewise.  It defaults to nrow(path).
1085: #'     path.
1088: #' @param color - The color to use for this path and its associated
1093: #'     path. Defaults to 8.
1095: #'     projected path. Defaults to 8.
1096: #' @param scale - The path will be start (its actual start) at 0 and
1108: #' plotPathProjectionCenterAndCircle(path=straight_path,
1109: #'                                  projection=straight_path_projection,
1110: #'                                  center=straight_path_center,
1111: #'                                  radius=straight_path_radius,
1116:                                             to=nrow(path),
1127:     plotPathProjectionCenterAndCircleTest(path,from,to,projection,
1143:     ## Translate the path to begin at the origin and scale:
1144:     N = nrow(path)
1146:     offset = path[1,]
1149:         path[i,] = path[i,] - offset
1150:         distances[i] = Norm(path[i,])
1152:     path = (scale / max(distances)) * path
1163:     ## Plot the path and mark the relevant portion:
1164:     points3d(path,size=pathPointSize,color=color)
1165:     lines3d(path,lwd=pathLineWidth,color=color)
1167:     points3d(path[from:to,],size=pathPointSize+relevantPortionPointHump,
1169:     lines3d(path[from:to,],lwd=pathLineWidth+relevantPortionLineHump,
4: ## Code for testing directionality in paths:
23: #'     control the production of randomized paths for comparison.
24: #' @param N - The number of random paths to generated for statistical
32: #'     paths;
60:     ## Generate random paths:
66:     ## Compute the distance statistics for random paths:
250: #' This is a simplified wrapper for pathToSphericalData
365: #' @param N - The number of random paths required.
404: ## ' Produce randomized paths by permutation
416: ## ' @param N - The number of paths required.
417: ## ' @return This function returns a list of random paths.
435:                 randomPath[,j] = randomPath[perm,j]
437:             randomPathList[[i]] = randomPath
460: ## ' Produce randomized paths by steps
473: ## ' @param N - The number of paths required.
474: ## ' @return This function returns a list of random paths.
488:     ## Generate the random paths:
496:             randomPath[j+1,] = randomPath[j,] +
501:             idx = randomPath < 0
502:             randomPath[idx] = - randomPath[idx]
505:         randomPathList[[i]] = randomPath
547: #' Produce distance statistics for random paths
549: #' This function takes a list of paths and a choice of
553: #' will be the randomized paths.  It is therefore assumed
556: #' @param paths - A list of paths.  Each of these is an n x d matrix.
561: #' paths =
563: #' distance = getDistanceDataForPaths(paths=paths,statistic='max')
566:     getDistanceDataForPathsTest(paths,statistic)
568:     n = nrow(paths[[1]])
569:     N = length(paths)
573:     ## Iterate over paths:
576:         sphericalData = getSphericalData(paths[[i]],statistic)
668: #' samplePath(chol_attributes, chol_pseudo_time_normalised)
669: #' samplePath(hep_attributes, hep_pseudo_time_normalised)
679:     windowSize = pathLength/nWindows
710:     sampledPath = rbind(sampledPath, chosenAttributes)
717:     rownames(sampledPath) = windowNumber
718:     return(sampledPath)
725: #' This function analyses a single cell trajectory by sampling multiple paths
738: #'     control the production of randomized paths for comparison.
740: #' @param nSamples - The number of sampled paths to generate (default 1000).
745: #' @param N - The number of random paths to generated for statistical
755: #'     paths;
794:     ## Sample paths and test each one for directionality
800:             print(paste(i, "sampled paths analysed"))
818: #'     control the production of randomized paths for comparison.
829: #' @param nSamples - The number of sampled paths to generate (defaults to 1000).
834: #' @param N - The number of random paths to generated for statistical
842: #'    to random paths. The entries consist of:
848: #'     paths;
967: ## Code for plotting paths and their spherical data:
1077: #' called repeatedly to add additional paths in different colors.
1092: #' @param pathPointSize - Sets the size of points which represent the
1100: #'     here when plotting multiple paths.
1104: #'     additional paths to the same figure.
1122:                                             pathPointSize = 8,
1129:                                         pathPointSize,projectionPointSize,
1194: #' metrics for sampled paths to random paths. It can also create plots for
1195: #' comparing two sets of sampled paths by providing the traj2Data argument.
1205: #'  stats - output of wilcox test (paired if comparing sampled to random paths,
1206: #'  unpaired if comparing sampled paths for two different trajectories)
1270:     ## Code for comparing sampled pathways to random pathways
1286:         ## Use paired wilcox test to compare values sampled and random pathways,
1287:         ## as random trajectories are parametised based on the sampled pathways
1317: #'     paths for different trajectory different starting points
1319: #'    comparing sampled paths to random paths for different trajectory starting
67:     distances = getDistanceDataForPaths(randomPaths,statistic)
418: generateRandomPathsByPermutation =
439:         return(randomPathList)
453:             randomPathList[[i]] = matrix(b,nrow=n)
455:         return(randomPathList)
508:     return(randomPathList)
672:     samplePathTest(attributes, pseudotime, nWindows)
TIN:R/correlationPlot.R: [ ]
104:     path<-getwd()
105:     cat("Plot was saved in ",paste(path,"/",fileName,sep=""),"\n")
mdp:R/mdp.R: [ ]
71:         path = directory
497:         path = directory
193:             pathway_results <- pathway_summary(sample_results,
705: pathway_summary <- function(sample_results, path, file_name,
720:     pathway_scores <- data.frame(Geneset = names(sample_results),
726:     top_pathway <- pathway_scores[1:3, "Geneset"]
76:         path = "."
178:                     directory = path,
186:                     directory = path,
194:                                                 path, file_name,
205:                     file = file.path(path, paste0(file_name, "zscore.tsv")),
208:                     file = file.path(path, paste0(file_name, "gene_scores.tsv")),
211:                     file = file.path(path, paste0(file_name, "sample_scores.tsv")),
503:         path = "."
628:         grDevices::pdf(file.path(path, sample_name))
699: #' @param path directory to save images
734:                 directory = path, title = top_pathway,
15: #' @param pathways (optional) \code{list} whose names are pathways and elements are
16: #' genes in the pathway. see details section for more information
41: #' \item Pathways - if genesets are provided, they are ranked according to the
48: #' # run with pathways
49: #' pathway_file <- system.file('extdata', 'ReactomePathways.gmt',
51: #' mypathway <- fgsea::gmtPathways(pathway_file) # load a gmt file
53: #' pathways=mypathway)
56: #' @section Loading pathways:
57: #' a \code{list} of pathways can be loaded from a .gmt file using the
63: mdp <- function(data, pdata, control_lab, directory = "", pathways,
118:     if (!missing(pathways)) {
119:         if (!is.list(pathways)) {
120:             stop("Please provide pathways in a list format (see help for more details")
167:                                             pathways, pdata)
192:         if (!missing(pathways)) {
217:     if (missing(pathways)) {
237:                         pathway_results)
244:                             "pathways")
427: #' Compute sample scores for each pathway
432: #' @param pathways list of pathways
436:                                     test_samples, pathways, pdata) {
443:     if (!missing(pathways)) {
444:         genesets <- c(genesets, pathways)
696: #' print pathways
697: #' generates a summary plot for pathways and sample score plot of best gene set
704: #' for each pathway
723:     pathway_scores <- pathway_scores[order(-pathway_scores$Sig2noise), ]
725:     # find best pathway
727:     top_pathway <- top_pathway[top_pathway != "allgenes" &
728:                                 top_pathway != "perturbedgenes"]
729:     top_pathway <- top_pathway[1]
732:     sample_plot(sample_results[[top_pathway]],
738:     return(pathway_scores)
58: #' \code{fgsea} function using \code{fgsea::gmtPathways('gmt.file.location')}
733:                 filename = paste0(file_name, "bestPathway"),
BrainSABER:R/buildAIBSARNA.R: [ ]
66:     path <- bfcrpath(bfc, url)
70:         file=unz(path, "expression_matrix.csv"),
75:     pd <- read.csv(file=unz(path, "columns_metadata.csv"),
80:     fd <- read.csv(file=unz(path, "rows_metadata.csv"),
flowGraph:R/04_flowgraph_plots.R: [ ]
1574:                         path <- paste0(
1536:             plot_path_ <- paste0(
2: #' @description Creates a cell hierarchy plot given a flowGraph object. If a path is not provided for \code{fg_plot} to save the plot, please use \code{plot_gr} to view plot given t...(28 bytes skipped)...
89: #' @param path A string indicating the path to where the function should save
104: #'  the plot by filling out the \code{path} parameter with a full path to the
117: #'    path=NULL) # set path to a full path to save plot as a PNG
142:     path=NULL, width=9, height=9
279:         if (!is.null(path) & !interactive)
281:                 grepl("[.]png$",path, ignore.case=TRUE),
282:                 path, paste0(path, ".png")),
285:         if (!is.null(path) & interactive & !visNet_plot)
287:                 gp, ifelse(grepl("[.]html$",path, ignore.case=TRUE),
288:                            path, paste0(path, ".html")))
289:         if (!is.null(path) & interactive & visNet_plot)
291:                 gp, file=ifelse(grepl("[.]html$",path, ignore.case=TRUE),
292:                                 path, paste0(path, ".html")),
295:     if (is.null(path)) message("use function plot_gr to plot fg_plot output")
407: #'    path=NULL) # set path to a full path to save plot as a PNG
719: #' @param path A string indicating the path to where the function should save
754:     main=NULL, interactive=FALSE, path=NULL
822:             if (!is.null(path))
824:                     qp, ifelse(grepl("[.]html$",path, ignore.case=TRUE),
825:                                path, paste0(path, ".html")))
829:         if (!is.null(path))
832:                     ifelse(grepl("[.]png$",path, ignore.case=TRUE),
833:                            path, paste0(path, ".png")),
903: #' @param path A string indicating the path to where the function should save
940:     main=NULL, path=NULL
1031:     if (!is.null(path))
1033:             ifelse(grepl("[.]png$",path, ignore.case=TRUE),
1034:                    path, paste0(path, ".png")),
1051:     main=NULL, path=NULL
1063:             main=main, path=path,
1202:     if (!is.null(path)) {
1205:                 "[.]png$",path, ignore.case=TRUE),
1206:                 path, paste0(path, ".png")),
1281: #' @param path A string indicating the path to where the function should save
1316:     main=NULL, interactive=FALSE, path=NULL
1386:         if (!is.null(path))
1389:                     "[.]png$",path, ignore.case=TRUE),
1390:                     path, paste0(path, ".png")), plot=gp)
1426:         if (!is.null(path))
1428:                 gp, ifelse(grepl("[.]html$", path, ignore.case=TRUE),
1429:                            path, paste0(path, ".html")))
1443: #' @param plot_path A string indicating the folder path to where the function
1520:     fg, plot_path, plot_types="node", interactive=FALSE,
1537:                 plot_path, "/", type, "/", paste0(sm, collapse="_"))
1538:             while (dir.exists(plot_path_) & !overwrite)
1539:                 plot_path_ <- paste0(plot_path_,"_")
1540:             dir.create(plot_path_, recursive=TRUE, showWarnings=FALSE)
1551:                     path=paste0(plot_path_, "/pVSdifference.png"))
1567:                     rdir_ <- paste0(plot_path_, "/boxplots")
1580:                             path=path, paired=paired,
1595:                     path=paste0(plot_path_,"/qq.png"),
1605:                         path=paste0(plot_path_,"/cell_hierarchy.png"),
1628:                             paste0(plot_path_,"/cell_hierarchy_",
RBGL:R/interfaces.R: [ ]
308:     path <- f
305: extractPath <- function(s, f, pens) {
307: # linear path from node s to node f
311:     while (path[1] != s) {
312:         if (i > maxl)        # no path available
314:             path <- "NA" 
317:         path <- c(pens[f], path)
321:     as.numeric(path)
373:          # obtain weights in g for path of nodes in char vec nl
394:                           path_detail=as.vector(ans[[i]]), 
182:     ans <- .Call("BGL_dijkstra_shortest_paths_D", 
365:                    nG[extractPath(nodeind(thiss), nodeind(thisf[j]), curdi)]
410:     ans <- .Call("BGL_johnson_all_pairs_shortest_paths_D", 
428:     ans <- .Call("BGL_floyd_warshall_all_pairs_shortest_paths_D", 
450:     ans <- .Call("BGL_bellman_ford_shortest_paths", 
478:     ans <- .Call("BGL_dag_shortest_paths", 
BiRewire:R/BiRewire.R: [ ]
635:     			PATH<-paste(path,'/',i,'/',sep='')
710:     			PATH<-paste(path,'/',i,'/',sep='')
916:     			PATH<-paste(path,'/',i,'/',sep='')
601: birewire.sampler.bipartite<-function(incidence,K,path,max.iter="n", accuracy=0.00005,verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
617: 		if(!file.exists(path))
619:     					dir.create(path) 
636: 				if(!file.exists(PATH))
638:       					dir.create(PATH)
647: ...(21 bytes skipped)...LUTO(as.simple_sparse_array(as.matrix(get.incidence(incidence,names=TRUE,sparse=FALSE))),file=paste(PATH,'network_',(i-1)*1000+j,sep=''))
650: 										write.table(get.incidence(incidence,names=TRUE,sparse=FALSE),file=paste(PATH,'network_',(i-1)*1000+j,sep=''),append=F)
656: ...(4 bytes skipped)...						write_stm_CLUTO(as.simple_sparse_array(as.matrix(incidence,names=TRUE,names=TRUE)),file=paste(PATH,'network_',(i-1)*1000+j,sep=''))
659: 										write.table(incidence,file=paste(PATH,'network_',(i-1)*1000+j,sep=''),append=FALSE)
676: birewire.sampler.undirected<-function(adjacency,K,path,max.iter="n", accuracy=0.00005,verbose=TRUE,MAXITER_MUL=10,exact=FALSE,write.sparse=TRUE)
692: 		if(!file.exists(path))
694:     					dir.create(path) 
711: 				if(!file.exists(PATH))
713:       					dir.create(PATH)
722: ...(21 bytes skipped)...LUTO(as.simple_sparse_array(as.matrix(get.adjacency(adjacency,names=TRUE,sparse=FALSE))),file=paste(PATH,'network_',(i-1)*1000+j,sep=''))
725: 										write.table(get.adjacency(adjacency,sparse=FALSE,names=TRUE),file=paste(PATH,'network_',(i-1)*1000+j,sep=''),append=F)
731: 										write_stm_CLUTO(as.simple_sparse_array(as.matrix(adjacency)),file=paste(PATH,'network_',(i-1)*1000+j,sep=''))
734: 										write.table(adjacency,file=paste(PATH,'network_',(i-1)*1000+j,sep=''),append=FALSE)
891: birewire.sampler.dsg<-function(dsg,K,path,delimitators=list(negative='-',positive='+'),exact=FALSE,verbose=TRUE, max.iter.pos='n',max.iter.ne...(59 bytes skipped)...
901: 		if(!file.exists(path))
903:     					dir.create(path) 
917: 				if(!file.exists(PATH))
919:       					dir.create(PATH)
925:     						dsg=birewire.rewire.dsg(dsg=dsg,delimitators=delimitators,exact=exact,path=paste(PATH,'network_',(i-1)*1000+j,'.sif',sep=''),
947: ...(22 bytes skipped)...unction(dsg,exact=FALSE,verbose=1,max.iter.pos='n',max.iter.neg='n',accuracy=0.00005,MAXITER_MUL=10,path=NULL,delimitators=list(positive='+',negative= '-'),check_pos_neg=FALSE,in_sampler=FALSE)
963: 	if(!is.null(path))
975: ...(144 bytes skipped)... return the DSG (in order to not interrupt the chain) but it will not be saved (if you pass a valid path")	
980: 			birewire.save.dsg(g=birewire.build.dsg(dsg,delimitators),file=path)
1105: birewire.load.dsg<-function(path)
1109: 		return(unique(read.table(path,stringsAsFactors=F)))
oligoClasses:R/methods-GenomeAnnotatedDataFrame.R: [ ]
259:   path <- system.file("extdata", package=pkgname)
260:   if(path=="") stop("Are you sure ", pkgname, " is installed?")
262:   snpBuilds <- list.files(path, pattern="snpProbes_")
SPIA:R/spia.R: [ ]
111:     path<-names(datp)[i]
62:   path.names<-NULL
51:   datpT=.myDataEnv[["path.info"]]
79:     path.names<-c(path.names,datpT[[jj]]$title)
84:   names(path.names)<-names(datpT)
86:   tor<-lapply(datp,function(d){sum(abs(d))})==0 | hasR | is.na(path.names)
88:   path.names<-path.names[!tor]
112:     M<-datp[[path]]
203:       cat(paste("Done pathway ",i," : ",substr(path.names[names(datp)[i]],1,30),"..",sep=""))
215:   Name=path.names[names(datp)]
1: spia<-function(de=NULL,all=NULL,organism="hsa",data.dir=NULL,pathids=NULL,nB=2000,plots=FALSE,verbose=TRUE,beta=NULL,combine="fisher"){
33:       cat("The KEGG pathway data for your organism is not present in the extdata folder of the SPIA package!!!")
53:   if (!is.null(pathids)){
54:     if( all(pathids%in%names(datpT))){
55:       datpT=datpT[pathids]
57:       stop( paste("pathids must be a subset of these pathway ids: ",paste(names(datpT),collapse=" "),sep=" "))
123:       KEGGLINK[i]<-paste("http://www.genome.jp/dbget-bin/show_pathway?",organism,names(datp)[i],"+",gnns,sep="")
133:         plot(X,pfs-X,main=paste("pathway ID=",names(datp)[i],sep=""),
186:           plot(density(pfstmp,bw=bwidth),cex.lab=1.2,col="black",lwd=2,main=paste("pathway ID=",names(datp)[i],"  P PERT=",round(pb[i],5),sep=""),
190:           plot(as.numeric(names(pfsTab)), as.numeric(pfsTab), cex.lab=1.2,col="black",main=paste("pathway ID=",names(datp)[i],"  P PERT=",round(pb[i],5),sep=""),
206:   }#end for each pathway
rtracklayer:R/ucsc.R: [ ]
1597:     path <- ucscURLTable[key]
364:   label_path <- "//select[@name = 'hgta_track']/option/text()"
366:   track_path <- "//select[@name = 'hgta_track']/option/@value"
365:   labels <- sub("\n.*$", "", sapply(getNodeSet(doc, label_path), xmlValue))
367:   tracks <- unlist(getNodeSet(doc, track_path))
1572:             upload <- fileUpload(path(object), "text/plain")
1598:     if (is.na(path))
1601:         path <- paste0(path, '?redirect="manual"')
1603:     paste(object@url, path, sep="")
isobar:R/ProteinGroup-class.R: [ ]
424:                       host="www.ebi.ac.uk",path="/uniprot/biomart/martservice")
biodb:R/BiodbConn.R: [ ]
734:     path <- cch$getFilePath(self$getCacheId(), name='download', ext=ext)
147: #' Get the path to the persistent cache file.
727: #' Gets the path where the downloaded content is written.
728: #' @return The path where the downloaded database is written.
736:     logDebug0('Download path of ', self$getId(), ' is "', path, '".')
738:     return(path)
743: #' @param src Path to the downloaded file.
151: #' containing the paths to the cache files corresponding to the requested
156:     fp <- c$getFilePath(self$getCacheId(), entry.id, self$getEntryFileExt())
729: getDownloadPath=function() {
793:         if ( ! file.exists(self$getDownloadPath()))
795:                 self$getDownloadPath())
RepViz:R/plotGeneTrack.R: [ ]
125:                                  host = "grch37.ensembl.org", path = "/biomart/martservice",
130:                                  host = "grch38.ensembl.org", path = "/biomart/martservice",
138:                                  host = "grch37.ensembl.org", path = "/biomart/martservice",
biocViews:R/repository.R: [ ]
14:         path <- packagesPaths[[type]]
181:     DESCRIPTION_path <- file.path(tmp_pkgdir, "DESCRIPTION")
182:     CITATION_path <- file.path(tmp_pkgdir, "inst", "CITATION")
183:     paths <- c(DESCRIPTION_path, CITATION_path)
193:     DESCRIPTION_tpath <- paste0(pkgname, "/DESCRIPTION")
194:     CITATION_tpath <- paste0(pkgname, "/inst/CITATION")
648:         cPath <- reposInfo[, ctype]
649:         buildPkgPath <- function(pkgs, vers) {
899:     cssPath <- system.file(file.path("css", paste(cssName, ".in", sep="")),
918:     cssPath <- system.file(file.path("css", paste(cssName, ".in", sep="")),
11:     packagesPaths <- file.path(reposRoot, contribPaths)
195:     tpaths <- c(DESCRIPTION_tpath, CITATION_tpath)
20:         message("- write_PACKAGES() to ", path, " ... ", appendLF=FALSE)
21:         t <- system.time(write_PACKAGES(path, type=type))[["elapsed"]]
55:     pkgDir <- file.path(unpackDir, pkg, subDir)
65:     ## reposRoot - Top level path for CRAN-style repos
75:         destDir <- file.path(reposRoot, "manuals")
88:             pkgDir <- file.path(unpackDir, pkg, "man")
89:             RCmd <- file.path(Sys.getenv("R_HOME"), "bin", "R")
104:     tarballs <- list.files(file.path(reposRoot, srcContrib),
130:         refmanDir <- file.path(reposRootPath, refman.dir, pkg, refmanSubDir)
147:         unpack(tarball, unpackDir, file.path(pkg, fileName))
150:     tarballs <- list.files(file.path(reposRoot, srcContrib),
180:     tmp_pkgdir <- file.path(tmpdir, pkgname)
191:     ## Note that the path separator is **always** / in a tarball, even
192:     ## on Windows, so do NOT use file.path() here.
210:     if (!file.exists(DESCRIPTION_path))  # should never happen
216:     if (file.exists(CITATION_path)) {
218:         citation <- try(readCitationFile(CITATION_path, meta=description),
233:     destfile <- file.path(destdir, "citation.html")
280:         file.path(reposRoot, srcContrib),
292:         .write_citation_as_HTML(pkgname, citation, file.path(destDir, pkgname))
300:     ## reposRoot - Top level path for CRAN-style repos
314:       destDir <- file.path(reposRoot, "news")
324:         srcDir <- file.path(srcDir, pkg)
325:         destDir <- file.path(destDir, pkg)
328:         destFile <- file.path(destDir, "NEWS")
332:     tarballs <- list.files(file.path(reposRoot, srcContrib),
354:     ## reposRoot - Top level path for CRAN-style repos
364:         destDir <- file.path(reposRoot, "vignettes")
367:         cleanUnpackDir(tarball, unpackDir, subDir=file.path("inst", "doc"))
374:     tarballs <- list.files(file.path(reposRoot, srcContrib),
388:     ## reposRoot - Top level path for CRAN-style repos
398:       destDir <- file.path(reposRoot, "vignettes")
420:     tarballs <- list.files(file.path(reposRoot, srcContrib),
444:         filedir <- file.path(reposRootPath, dir, pkg)
445:         file <- file.path(filedir, filename)
458:         vigDir <- file.path(reposRootPath, vignette.dir, pkg, vigSubDir)
481:             files <- file.path(reposRootPath, files)
535:     fn <- file.path(reposRootPath, "REPOSITORY")
541:     reposInfo <- read.dcf(file.path(reposRootPath, "REPOSITORY"))
562:     out <- file(file.path(dir, fname), "wt")
564:     ##outgz <- gzfile(file.path(dir, gzname), "wt")
601:     ## Read REPOSITORY file for contrib path info
612:         pkg.dir <- file.path(reposRootPath, reposInfo[, os])
641:     ## Integrate version and archive file path info for the different contrib
642:     ## paths in this repos.  We duplicate the source path info here, but that
660:         packagesFile <- file.path(reposRootPath, cPath, "PACKAGES")
663:                     file.path(reposRootPath, cPath),
664:                     "\nSkipping this contrib path.")
675:                     file.path(reposRootPath, cPath),
676:                     "\nSkipping this contrib path.")
692:     ## Add vignette path info
783:                    desc <- tools:::.read_description(file.path(meatPath, missing_pkgs[i], "DESCRIPTION"))
858:     viewsFile <- file.path(reposRoot, "VIEWS")
893:     writePackageDetailHtml(pkgList, file.path(reposRoot, "html"),
901:     res <- try(copySubstitute(cssPath, file.path(reposRoot, cssName),
912:         f <- file.path(htmlDir, htmlFilename(pkg))
920:     res <- try(copySubstitute(cssPath, file.path(htmlDir, cssName),
935:     f <- file.path(reposRoot, htmlFilename(repos))
940:     con <- file(file.path(dir, "SYMBOLS"), open="w")
964:         tarballs <- list.files(file.path(dir, "src/contrib"),
1: genReposControlFiles <- function(reposRoot, contribPaths, manifestFile=NA, meatPath=NA)
10:     ## Write PACKAGES files for all contrib paths
28:             write_VIEWS(reposRoot, manifestFile=manifestFile, meatPath=meatPath)
127: getRefmanLinks <- function(pkgList, reposRootPath, refman.dir) {
184:     status <- unlink(paths)
441: getFileExistsAttr <- function(pkgList, reposRootPath, dir, filename) {
452: getFileLinks <- function(pkgList, reposRootPath, vignette.dir, ext,
472: getDocumentTitles <- function(docs, ext="pdf", src=c("Rnw", "Rmd"), reposRootPath, fun) {
530: write_REPOSITORY <- function(reposRootPath, contribPaths)
539: read_REPOSITORY <- function(reposRootPath)
585: ##   meatPath <- "~biocbuild/bbs-3.14-bioc/MEAT0"
587: ##   write_VIEWS(reposRoot, manifestFile=manifestFile, meatPath=meatPath)
588: write_VIEWS <- function(reposRootPath, fields = NULL,
590:                         manifestFile=NA, meatPath=NA
602:     reposInfo <- read_REPOSITORY(reposRootPath)
609:     convertToMat <- function(reposRootPath, reposInfo, os, fields, verbose){
628:     dbMat = convertToMat(reposRootPath, reposInfo, os, fields, verbose)
632:             dbMat2 = convertToMat(reposRootPath, reposInfo, os, fields, verbose)
658:             paste(cPath, "/", pkgs, "_", vers, ext, sep="")
683:         dbMat[dbMatIdx, col] <- buildPkgPath(cDat[cDatGood, "Package"],
693:     vigs <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "pdf")
694:     vtitles <- getDocumentTitles(vigs, reposRootPath=reposRootPath, fun=getPdfTitle)
696:     rfiles <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "R")
698:     htmlDocs <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "html", TRUE)
700:     htmlTitles <- getDocumentTitles(htmlDocs, ext="html", src=c("Rmd", "Rhtml"), reposRootPath, getHtmlTitle)
717:     readmes <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "readmes", "README")
718:     news <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "news", "NEWS")
719:     install <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "install", "INSTALL")
720:     license <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "licenses",
780:             if (!is.na(meatPath)){
823:     .write_repository_db(dbMat, reposRootPath, "VIEWS")
8:     t <- system.time(write_REPOSITORY(reposRoot, contribPaths))[["elapsed"]]
12:     names(packagesPaths) <- names(contribPaths)
13:     for (type in names(packagesPaths)) {
196:     status <- untar(tarball, tpaths, exdir=tmpdir)
523:         res <- xpathApply(doc, "//title", xmlValue)
532:     contrib <- as.list(contribPaths)
533:     names(contrib) <- gsub("-", ".", names(contribPaths))
534:     contrib[["provides"]] <- paste(names(contribPaths), collapse=", ")
GSCA:inst/shiny/server.R: [ ]
357:                         path <- system.file("extdata",package=paste0(input$Summarycompselect,"Expr"))
716:                                           path <- system.file("extdata",package=paste0(input$Summarycompselect,"Expr"))
358:                         load(paste0(path,"/geneid.rda"))
378:                                     load(paste0(path,"/quality.rda"))
388:                                     load(paste0(path,"/quality.rda"))
475:                               path <- system.file("extdata",package=paste0(input$Summarycompselect,"Expr"))
482:                                           tmpgeneexpr <- rbind(tmpgeneexpr,t(h5read(paste0(path,"/data",h5id,".h5"),"expr",index=list(NULL,match(currenth5gene,h5gene))))/1000)
485:                                     tmpgeneexpr <- t(h5read(paste0(path,"/data.h5"),"expr",index=list(NULL,match(currentgeneset[,2],Maindata$geneid))))/1000
724: ...(9 bytes skipped)...                                                   tmpgeneexpr <- rbind(tmpgeneexpr,t(h5read(paste0(path,"/data",h5id,".h5"),"expr",index=list(NULL,match(currenth5gene,h5gene))))/1000)
727:                                                 tmpgeneexpr <- t(h5read(paste0(path,"/data.h5"),"expr",index=list(NULL,match(currentgeneset[,2],Maindata$geneid))))/1000
118:                         tmpfile <- read.table(GenesetFileHandle$datapath,header=input$InputGenesetheader,sep=input$InputGenesetsep,quote=input$InputGenesetquote,stringsAsFa...(30 bytes skipped)...
401:                         tmptab <- read.table(input$Summaryuploadtabfile$datapath,stringsAsFactors=F,blank.lines.skip=TRUE)
405: ...(8 bytes skipped)...                Maindata$uploadgeneexpr <- as.matrix(read.table(input$Summaryuploadgeneexprfile$datapath,stringsAsFactors=F,blank.lines.skip=TRUE,row.names=1))
1917:                               tmp <- read.table(input$GSCAinteractiveload$datapath)
1946: ...(35 bytes skipped)... updateTextInput(session,"Formulainputtext","Input Formula",readLines(input$GSCAinteractiveload$datapath))
2412:                         Utidata$Maindata <- Utidata$rawdata <- read.table(UtiFileHandle$datapath,header=input$Utiheader,sep=input$Utisep,quote=input$Utiquote,stringsAsFactors=F,blank.lines.skip=TR...(15 bytes skipped)...
HiCBricks:R/Brick_functions.R: [ ]
2002:     Path <- Create_Path(c(Root.folders['matrices'],chr,chr))
498:         Bintable.group.path <- Create_Path(
1361:     Group.path <- Create_Path(c(Reference.object$hdf.matrices.root,chr1,chr2))
1456:     Group.path <- Create_Path(c(Reference.object$hdf.matrices.root,chr,chr))
2522:     Group.path <- Create_Path(c(Reference.object$hdf.matrices.root,
2585:     Group_path <- Create_Path(c(Reference_object$hdf.matrices.root, 
2678:     Group.path <- Create_Path(c(Reference.object$hdf.matrices.root, chr1,
205:     Config_filepath <- .make_configuration_path(output_directory)
895:     Brick_filepath <- BrickContainer_get_path_to_file(Brick,
964:     Brick_filepath <- BrickContainer_get_path_to_file(Brick, 
1339:     Brick_filepath <- BrickContainer_get_path_to_file(Brick, 
1434:     Brick_filepath <- BrickContainer_get_path_to_file(Brick, 
1849:     Brick_filepath <- BrickContainer_get_path_to_file(Brick = Brick, 
2034:     Brick_filepath <- BrickContainer_get_path_to_file(Brick = Brick, 
2524:     Brick_filepath <- BrickContainer_get_path_to_file(Brick = Brick, 
2587:     Brick_filepath <- BrickContainer_get_path_to_file(Brick = Brick, 
2676:     Brick_filepath <- BrickContainer_get_path_to_file(Brick = Brick, 
703:     Brick_paths <- BrickContainer_get_path_to_file(Brick = Brick,
760:     Brick_filepaths <- BrickContainer_list_files(Brick = Brick, 
812:     Brick_filepaths <- BrickContainer_get_path_to_file(Brick,
18: #' A string containing the path to the file to load as the binning table for
141: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
143: #' out_dir <- file.path(tempdir(), "Creator_test")
145: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
178:             "without an explicit path", "definition!", "If you want to create",
180:             "please provide", "the complete path. Or, you can",
182:             paste("file.path(getwd())", sep = ""), 
300: #' the function will provide the path to the created/tracked HDF file.
306: #' out_dir <- file.path(tempdir(),"mcool_test_dir")
307: #' dir.create(path = out_dir)
311: #' destfile = file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool"))
313: #' mcool <- file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool")
332:         stop("mcool must be provided as mcool= /path/to/something")
339:         mcool.version <- GetAttributes(Path = Create_Path(
355:         mcool.version <- GetAttributes(Path = NULL, File=mcool, 
391: #' out_dir <- file.path(tempdir(),"mcool_test_dir")
392: #' dir.create(path = out_dir)
397: #' destfile = file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool"))
399: #' mcool <- file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool")
452: #' out_dir <- file.path(tempdir(), "mcool_test_dir")
453: #' dir.create(path = out_dir)
457: #' destfile = file.path(out_dir, "H1-hESC-HiC-4DNFI7JNCNFB.mcool"))
459: #' mcool <- file.path(out_dir, "H1-hESC-HiC-4DNFI7JNCNFB.mcool")
476:     mcool.version <- GetAttributes(Path = NULL, File=mcool,
502:         Bintable.group.path <- Create_Path(Bintable.group)
504:     Handler <- ._Brick_Get_Something_(Group.path = Bintable.group.path,
517: #' A string specifying the path to the Brick store created with 
534: #' Bintable_path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
537: #' out_dir <- file.path(tempdir(), "HiCBricks_chrominfo_test")
541: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable_path, 
670: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
673: #' out_dir <- file.path(tempdir(), "add_ranges_test")
677: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
709:     bplapply(Brick_paths, function(Brick_path){
710:         ._Brick_Add_Ranges_(Brick = Brick_path,
711:         Group.path = Create_Path(c(Reference.object$hdf.ranges.root,
739: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
742: #' out_dir <- file.path(tempdir(), "list_matrices_test")
746: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
766:             Path = Create_Path(
794: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
797: #' out_dir <- file.path(tempdir(), "list_rangekeys_test")
801: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
815:         Group.path = Create_Path(Reference.object$hdf.ranges.root),
836: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
839: #' out_dir <- file.path(tempdir(), "list_rangekeys_exists_test")
843: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
876: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
879: #' out_dir <- file.path(tempdir(), "list_ranges_mcols_test")
883: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
936: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
939: #' out_dir <- file.path(tempdir(), "list_get_ranges_test")
943: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
971:         chromosomes <- ._Brick_Get_Something_(Group.path = Create_Path(
980:             Group.path = Create_Path(
985:         Lengths <- ._Brick_Get_Something_(Group.path = Create_Path(
995:     Dataset <- ._Brick_Get_Something_(Group.path = Create_Path(
1020:                     Group.path = Create_Path(
1038:                     Group.path = Create_Path(c(
1071: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1074: #' out_dir <- file.path(tempdir(), "list_get_bintable_test")
1077: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1134: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1137: #' out_dir <- file.path(tempdir(), "fetch_range_index_test")
1140: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1232: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"),
1235: #' out_dir <- file.path(tempdir(), "region_position_test")
1238: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1303: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1306: #' out_dir <- file.path(tempdir(), "matrix_load_test")
1309: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1314: #' Matrix_file <- system.file(file.path("extdata", 
1367:         Matrix.file = matrix_file, delim = delim, Group.path = Group.path, 
1400: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1403: #' out_dir <- file.path(tempdir(), "matrix_load_dist_test")
1406: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1411: #' Matrix_file <- system.file(file.path("extdata", 
1462:         Matrix.file = matrix_file, delim = delim, Group.path = Group.path,
1481: #' @param mcool \strong{Required}. Path to an mcool file.
1504: #' out_dir <- file.path(tempdir(),"mcool_load_test")
1505: #' dir.create(path = out_dir)
1509: #' destfile = file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool"))
1511: #' mcool <- file.path(out_dir,"H1-hESC-HiC-4DNFI7JNCNFB.mcool")
1568:     RetVar <- .process_mcool(Brick = Brick, mcool_path = mcool, 
1585: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1588: #' out_dir <- file.path(tempdir(), "matrix_isdone_test")
1591: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1596: #' Matrix_file <- system.file(file.path("extdata", 
1629: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1632: #' out_dir <- file.path(tempdir(), "matrix_issparse_test")
1635: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1640: #' Matrix_file <- system.file(file.path("extdata", 
1681: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1684: #' out_dir <- file.path(tempdir(), "matrix_maxdist_test")
1687: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1692: #' Matrix_file <- system.file(file.path("extdata", 
1736: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1739: #' out_dir <- file.path(tempdir(), "matrix_exists_test")
1742: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1747: #' Matrix_file <- system.file(file.path("extdata", 
1775: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1778: #' out_dir <- file.path(tempdir(), "matrix_minmax_test")
1781: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1786: #' Matrix_file <- system.file(file.path("extdata", 
1821: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1824: #' out_dir <- file.path(tempdir(), "matrix_dimension_test")
1827: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1832: #' Matrix_file <- system.file(file.path("extdata", 
1851:     Extents <- ._GetDimensions(group.path = Create_Path(
1853:         dataset.path = Reference.object$hdf.matrix.name,
1870: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1873: #' out_dir <- file.path(tempdir(), "matrix_filename_test")
1876: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1881: #' Matrix_file <- system.file(file.path("extdata", 
1936: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
1939: #' out_dir <- file.path(tempdir(), "val_by_dist_test")
1942: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
1947: #' Matrix_file <- system.file(file.path("extdata", 
2040:         diag(._Brick_Get_Something_(Group.path = Path, Brick = Brick_filepath,
2087: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2090: #' out_dir <- file.path(tempdir(), "get_matrix_coords_test")
2093: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2098: #' Matrix_file <- system.file(file.path("extdata", 
2200: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2203: #' out_dir <- file.path(tempdir(), "get_matrix_test")
2206: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2211: #' Matrix_file <- system.file(file.path("extdata", 
2309: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2312: #' out_dir <- file.path(tempdir(), "get_row_vector_test")
2315: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2320: #' Matrix_file <- system.file(file.path("extdata", 
2463: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2466: #' out_dir <- file.path(tempdir(), "get_vector_val_test")
2472: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2477: #' Matrix_file <- system.file(file.path("extdata", 
2526:     Vector <- ._Brick_Get_Something_(Group.path = Group.path, 
2550: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2553: #' out_dir <- file.path(tempdir(), "get_vector_val_test")
2558: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2563: #' Matrix_file <- system.file(file.path("extdata", 
2589:     dataset_handle <- ._Brick_Get_Something_(Group.path = Group_path, 
2625: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2628: #' out_dir <- file.path(tempdir(), "get_matrix_mcols_test")
2631: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2636: #' Matrix_file <- system.file(file.path("extdata", 
2680:     Vector <- ._Brick_Get_Something_(Group.path = Group.path, 
2694: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2697: #' out_dir <- file.path(tempdir(), "list_matrix_mcols_test")
2700: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2717: #' BrickContainer, a string of length 1 as resolution and a path specifying
2724: #' @param out_file Path to the output file to write.
2735: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2738: #' out_dir <- file.path(tempdir(), "write_file")
2741: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2746: #' Matrix_file <- system.file(file.path("extdata", 
2755: #' out_file = file.path(out_dir, "example_out.txt"), 
2768:         stop(out_file, " already exists at path")
2820: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2823: #' out_dir <- file.path(tempdir(), "get_vector_val_test")
2828: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2833: #' Matrix_file <- system.file(file.path("extdata", 
2870: #' @param table_file Path to the file that will be loaded
2887: #' Bintable.path <- system.file(file.path("extdata", "Bintable_100kb.bins"), 
2890: #' out_dir <- file.path(tempdir(), "get_vector_val_test")
2895: #' My_BrickContainer <- Create_many_Bricks(BinTable = Bintable.path, 
2900: #' Matrix_file <- system.file(file.path("extdata", 
2909: #' out_file = file.path(out_dir, "example_out.txt"), 
2914: #' table_file = file.path(out_dir, "example_out.txt"), 
188:     output_directory <- normalizePath(output_directory)
219:     if(file.exists(Config_filepath)){
223:         Container <- load_BrickContainer(Config_filepath)
282:         Config_filepath)
283:     .write_configuration_file(Container, Config_filepath)
907:     mcol.df <- .prepare_ranges_metadata_mcols(Brick = Brick_filepath, 
973:         Brick = Brick_filepath,
982:             Brick = Brick_filepath,
987:         Brick = Brick_filepath,
997:         Brick = Brick_filepath, 
1022:                 Brick = Brick_filepath, Name = FUN_name, Start = m.start, 
1040:                         rangekey)), Brick = Brick_filepath,
1341:     if(length(Brick_filepath) == 0){
1366:     RetVar <- ._ProcessMatrix_(Brick = Brick_filepath, 
1436:     if(length(Brick_filepath) == 0){
1461:     RetVar <- ._Process_matrix_by_distance(Brick = Brick_filepath,
1854:         File = Brick_filepath, return.what = "size")
2527:         Brick = Brick_filepath, Name = Reference.object$hdf.matrix.name, 
2590:         Brick = Brick_filepath, Name = Reference_object$hdf.matrix.name, 
2681:         Brick = Brick_filepath, Name = what, return.what = "data")
2781:             Brick_filepath = a_row$filepath,
763:     chr1.list <- lapply(seq_len(nrow(Brick_filepaths)), function(i){
764:         Row <- Brick_filepaths[i,]
770:             File = Row$filepaths,
816:         Brick = Brick_filepaths[1], return.what = "group_handle")
GeneGeneInteR:R/PLSPM.R: [ ]
207:     Path = inner_results[[2]]
1162:   Path = path_matrix
2176:     Path <- pathmod[[2]]
48:   my.path <- rbind(Gene1,Gene2)
209:     Path_effects = get_effects(Path)
363: check_path <- function(path_matrix)
1173:     path_lm = summary(lm(Y_lvs[,k1] ~ Y_lvs[,k2]))
1202:   path_effects = as.list(seq_len(lvs-1))
2177:     path.orig <- as.vector(Path[path_matrix==1])
2179:     Path.efs <- get_effects(Path)
2186:     path.labs <- NULL
2175:     pathmod <- get_paths(path_matrix, Y.lvs)
2194:     PATHS <- matrix(NA, bootnum, sum(path_matrix))
1805: get_path_scheme <- function(path_matrix, LV)
1156: get_paths <-  function(path_matrix, Y_lvs, full=TRUE)
1207:     indirect_paths = matrix(c(0,0,0,0), 2, 2)
1208:     total_paths = Path
55:   try(mod1 <- plspm(XCases,my.path,my.blocks, modes = my.modes), silent=TRUE)
59:   	res <- list(statistic=NA,p.value=NA,method="Partial Least Squares Path Modeling",parameter=list.param)
64:   try(mod0 <- plspm(XControls,my.path,my.blocks, modes = my.modes),silent=TRUE)
68:   	res <- list(statistic=NA,p.value=NA,method="Partial Least Squares Path Modeling",parameter=list.param)
91: 		try(mod1 <- plspm(XCases,my.path,my.blocks, modes = my.modes), silent=TRUE)
93: 		try(mod0 <- plspm(XControls,my.path,my.blocks, modes = my.modes),silent=TRUE)
110: #	res <- list(statistic=stat,p.value=pval,method="Partial Least Squares Path Modeling",parameter=list.param)
123: 		method="Gene-based interaction based on Partial Least Squares Path Modeling",
138:   function(Data, path_matrix, blocks, modes = NULL, scaling = NULL,  
146:     valid = check_args(Data=Data, path_matrix=path_matrix, blocks=blocks, 
153:     path_matrix = valid$path_matrix
167:     gens = get_generals(MV, path_matrix)
188:       weights = get_weights(X, path_matrix, blocks, specs)
194:       weights = get_weights_nonmetric(X, path_matrix, blocks, specs)
203:     # Path coefficients and total effects
205:     inner_results = get_paths(path_matrix, LV)
241:     inner_summary = get_inner_summary(path_matrix, blocks, specs$modes,
245:     gof = get_gof(communality, R2, blocks, path_matrix)
259:         bootstrap = get_boots(MV, path_matrix, blocks, specs, br)
264:     model = list(IDM=path_matrix, blocks=blocks, specs=specs,
270:                path_coefs = Path, 
274:                effects = Path_effects,
289:   cat("Partial Least Squares Path Modeling (PLS-PM)", "\n")
294:   cat("\n3  $path_coefs     ", "path coefficients matrix")
314:   function(Data, path_matrix, blocks, scaling, modes, scheme,
319:     path_matrix = check_path(path_matrix)
327:     good_model = check_model(path_matrix, blocks)
331:          path_matrix = path_matrix,
365:   if (is_not_matrix(path_matrix))
366:     stop("\n'path_matrix' must be a matrix.")
368:   if (!is_square_matrix(path_matrix))
369:     stop("\n'path_matrix' must be a square matrix.")
371:   if (nrow(path_matrix) == 1)
372:     stop("\n'path_matrix' must have more than one row")
374:   if (!is_lower_triangular(path_matrix))
375:     stop("\n'path_matrix' must be a lower triangular matrix")
378:   for (j in seq_len(ncol(path_matrix))) 
380:     for (i in seq_len(nrow(path_matrix)))
382:       if (length(intersect(path_matrix[i,j], c(1,0))) == 0)
383:         stop("\nElements in 'path_matrix' must be '1' or '0'")
387:   if (lacks_dimnames(path_matrix)) {
388:     LV_names = paste("LV", seq_len(ncol(path_matrix)), sep = "")
389:     dimnames(path_matrix) = list(LV_names, LV_names)
391:   if (has_rownames(path_matrix) && lacks_colnames(path_matrix)) {
392:     colnames(path_matrix) = rownames(path_matrix)
394:   if (has_colnames(path_matrix) && lacks_rownames(path_matrix)) {
395:     rownames(path_matrix) = colnames(path_matrix)
399:   path_matrix
458: check_model <- function(path_matrix, blocks)
460:   # compatibility between path_matrix and blocks
461:   if (length(blocks) != nrow(path_matrix))
462:     stop("\nNumber of rows in 'path_matrix' different from length of 'blocks'.")
687:   SCHEMES = c("centroid", "factorial", "path")
884: get_generals <- function(MV, path_matrix)
890:        lvs = nrow(path_matrix),
891:        lvs_names = rownames(path_matrix))
1035: get_weights <- function(X, path_matrix, blocks, specs)
1037:   lvs = nrow(path_matrix)
1055:                 "centroid" = sign(cor(Y) * (path_matrix + t(path_matrix))),
1056:                 "factorial" = cor(Y) * (path_matrix + t(path_matrix)),
1057:                 "path" = get_path_scheme(path_matrix, Y))
1083:     dimnames(W) = list(colnames(X), rownames(path_matrix))    
1158:   lvs_names = colnames(path_matrix)
1159:   endogenous = as.logical(rowSums(path_matrix))
1164:   R2 = rep(0, nrow(path_matrix))
1171:     k2 = which(path_matrix[k1,] == 1)
1174:     Path[k1,k2] = path_lm$coef[-1,1]
1175:     residuals[[aux]] = path_lm$residuals  
1176:     R2[k1] = path_lm$r.squared
1177:     inn_val = c(path_lm$r.squared, path_lm$coef[,1])
1180:     rownames(path_lm$coefficients) = inn_labels
1181:     results[[aux]] <- path_lm$coefficients
1184:     # paste(rep("path_",length(k2)),names(k2),sep=""))
1192:   list(results, Path, R2, residuals)
1195: get_effects <- function(Path)
1198:   lvs = nrow(Path)
1199:   lvs_names = rownames(Path)
1203:   path_effects[[1]] = Path
1212:       path_effects[[k]] = path_effects[[k-1]] %*% Path        
1215:     for (k in 2:length(path_effects)) {
1216:       indirect_paths = indirect_paths + path_effects[[k]]        
1218:     total_paths = Path + indirect_paths
1227:         direct = c(direct, Path[i,j])
1325:   function(path_matrix, blocks, modes, communality, redundancy, R2)
1328:     exo_endo = rep("Exogenous", nrow(path_matrix))
1329:     exo_endo[rowSums(path_matrix) != 0] = "Endogenous"
1330:     avg_comu = rep(0, nrow(path_matrix))
1331:     avg_redu = rep(0, nrow(path_matrix))
1332:     AVE = rep(0, nrow(path_matrix))
1334:     for (k in seq_len(nrow(path_matrix)))
1352:                row.names = rownames(path_matrix))
1355: get_gof <- function(comu, R2, blocks, path_matrix)
1357:   lvs = nrow(path_matrix)
1359:   endo = rowSums(path_matrix)
1392: get_weights <- function(X, path_matrix, blocks, specs)
1394:   lvs = nrow(path_matrix)
1412:                 "centroid" = sign(cor(Y) * (path_matrix + t(path_matrix))),
1413:                 "factorial" = cor(Y) * (path_matrix + t(path_matrix)),
1414:                 "path" = get_path_scheme(path_matrix, Y))
1440:     dimnames(W) = list(colnames(X), rownames(path_matrix))    
1478:   function(X, path_matrix, blocks, specs)
1480:     lvs = nrow(path_matrix)
1541:     link = t(path_matrix) + path_matrix
1556:                   "path" = get_path_scheme(path_matrix, Y))
1751:       dimnames(W) = list(colnames(X), rownames(path_matrix))
1752:       dimnames(Y) = list(rownames(X), rownames(path_matrix))
1808:   E = path_matrix
1810:   for (k in seq_len(ncol(path_matrix))) 
1813:     follow <- path_matrix[k,] == 1
1817:     predec <- path_matrix[,k] == 1
2141:   function(DM, path_matrix, blocks, specs, br)
2146:     lvs = nrow(path_matrix)
2147:     lvs.names = rownames(path_matrix)
2151:     endo = sign(rowSums(path_matrix))
2162:       out.ws = get_weights(X, path_matrix, blocks, specs)
2168:       out.ws = get_weights_nonmetric(X, path_matrix, blocks, specs)
2190:         if (path_matrix[i,j]==1) 
2191:           path.labs <- c(path.labs, paste(lvs.names[j],"->",lvs.names[i]))
2195:     TOEFS <- matrix(NA, bootnum, nrow(Path.efs))
2207:         w.boot = get_weights(X.boot, path_matrix, blocks, specs)
2215:         w.boot = get_weights_nonmetric(X.boot, path_matrix, blocks, specs)
2225:       pathmod <- get_paths(path_matrix, Y.boot)
2228:       PATHS[i,] <- as.vector(P.boot[path_matrix==1])
2249:     # Path coefficients
2250:     colnames(PATHS) = path.labs
2251:     PB = get_boot_stats(PATHS, path.orig)
2256:     colnames(TOEFS) = Path.efs[, 1]
2257:     TE = get_boot_stats(TOEFS, Path.efs[,4]) 
1214:     indirect_paths = matrix(0, lvs, lvs)
1228:         indirect = c(indirect, indirect_paths[i,j])
1229:         total = c(total, total_paths[i,j])
2178:     r2.orig <- pathmod[[3]][endo==1]
2226:       P.boot <- pathmod[[2]]
2230:       RSQRS[i,] <- pathmod[[3]][endo==1]
2262:          paths = PB, 
MesKit:R/phyloTreeAnno.R: [ ]
672:    path <- list()
570:    trunkPath <- rev(c(mainTrunk,rootNode))
674:       subPath <- c()
509:    ## label represents the common evolution path of samples
688:       path[[name]] <- subPath
695:    result <- path[[names(which.max(distanceTable))]]
571:    if(length(trunkPath) > 0){
572:      # subdat_list <- lapply(2:length(trunkPath), function(i){
573:      #   x1 <- treeData[treeData$end_num == trunkPath[i-1],]$x2
574:      #   y1 <- treeData[treeData$end_num == trunkPath[i-1],]$y2
577:      #   distance <- treeEdge[treeEdge$endNum == trunkPath[i],]$length
589:      #                                    'node' = trunkPath[i-1],'end_num' = trunkPath[i])
596:       for(i in 2:length(trunkPath)){
597:          x1 <- treeData[treeData$end_num == trunkPath[i-1],]$x2
598:          y1 <- treeData[treeData$end_num == trunkPath[i-1],]$y2
601:          distance <- treeEdge[treeEdge$endNum == trunkPath[i],]$length
613:                                           'node' = trunkPath[i-1],'end_num' = trunkPath[i])
682:          subPath <- append(subPath,end)
ReactomeContentService4R:R/getContent.R: [ ]
13:   path <- "data/discover"
92:   path <- "data/eventsHierarchy"
115:   path <- "data/orthology"
151:   path <- "data/participants"
254:   path <- "data/pathways/low/entity"
324:   path <- "data/person"
364:   path <- "search/facet"
410:   path <- "data/query/enhanced"
452:   path <- "data/schema"
542:   path <- "search/query"
586:   path <- "data/species"
261:   pathways <- .retrieveData(url, as="text")
272:     top.pathways <- foreach(id=pathways$dbId, .export=c(".retrieveData", ".checkStatus"), .combine=dfcomb) %dopar% {
253: getPathways <- function(id, species=NULL, allForms=FALSE, top.level=FALSE) {
332:     authoredPathways <- .retrieveData(ap.url, as="text")
14:   url <- file.path(getOption("base.address"), path, event.id)
61:     url <- file.path(getOption("base.address"), "data/complex", id, 
64:     url <- file.path(getOption("base.address"), "data/complexes", resource, id)
66:     url <- file.path(getOption("base.address"), "data/entity", id, retrieval)
94:   url <- file.path(getOption("base.address"), path, taxon.id)
118:   url <- file.path(getOption("base.address"), path, id, "species", species.id)
154:   url <- file.path(getOption("base.address"), path, event.id) #all participants
162:     url <- file.path(url, "participatingPhysicalEntities")
164:     url <- file.path(url, "referenceEntities")
166:     # in a different path/method - /data/pathway/{id}/containedEvents
167:     url <- file.path(getOption("base.address"), "data/pathway", event.id, "containedEvents")
256:   url <- file.path(getOption("base.address"), path, id)
257:   if (allForms) url <- file.path(url, "allForms")
274:       ancestors.url <- file.path(getOption("base.address"), "data/event", id, "ancestors")
327:     url <- file.path(getOption("base.address"), path, id)
331:     ap.url <- file.path(url, "authoredPathways")
338:       tmp.url <- file.path(getOption("base.address"), path, id, attribute)
371:   url <- file.path(getOption("base.address"), path)
411:   url <- file.path(getOption("base.address"), path, id)
453:   url <- file.path(getOption("base.address"), path, class)
457:   cnt.url <- file.path(url, "count")
484:   if (minimised) url <- file.path(url, "min")
485:   if (reference) url <-file.path(url, "reference")
543:   url <- file.path(getOption("base.address"), paste0(path, "?query=", gsub("\\s", "%20", query)))
589:                 file.path(getOption("base.address"), path, "main"),
590:                 file.path(getOption("base.address"), path, "all"))
75: #' Events (Pathways and Reactions) in Reactome are organized in a hierarchical 
129: #' Data in Reactome are organized in a hierarchical manner - Pathways contain Reactions, 
136: ...(11 bytes skipped)...g{ReferenceEntities}: retrieves the ReferenceEntities for all PhysicalEntities in every constituent Pathway/Reaction
139: #' @param event.id a stable or db id of an Event (pathways and reactions)
168:     msg <- "'Events' are found in the 'hasEvent' attribute of Pathways"
234: #' Pathway related queries
238: #' @param id a stable or db id of a PhysicalEntity or Event present in the pathways
240: #' @param allForms if set to \code{TRUE}, all low level pathways that contain the given PhysicalEntity (not Event) in all forms returned
241: #' @param top.level if set to \code{TRUE}, only top-level pathways returned
242: #' @return a dataframe containing requested pathways
263:   # map to top level pathways
281:     rownames(top.pathways) <- seq(1, nrow(top.pathways))
282:     return(top.pathways)
284:     return(pathways)
330:     # add authored pathways if any
532: #' searchQuery(query="Biological oxidation", species="Mus musculus", types=c("Pathway", "Reaction"))
576: #' either manually curated or computationally inferred pathways
137: #' - \strong{EventsInPathways}: recursively retrieves all the Events contained in any given Event
140: ...(26 bytes skipped)...ipants to be retrieved, including "AllInstances", "PhysicalEntities", "ReferenceEntities", "EventsInPathways"
144: #' getParticipants("R-HSA-69306", "EventsInPathways")
150:                                                   "ReferenceEntities", "EventsInPathways")) {
165:   } else if (retrieval == "EventsInPathways") {
236: #' To get the Events that contain the given PhysicalEntity or Event (i.e. subpathway).
244: #' getPathways("R-HSA-199420", "Homo sapiens")
245: #' @rdname getPathways
277:       ancestors[ancestors$schemaClass == "TopLevelPathway",]
333:     if (length(authoredPathways) != 0) all.info[["authoredPathways"]] <- authoredPathways
maigesPack:R/plot-methods.R: [ ]
190:         Path <- list(Type1=new("graphNEL", vertices, edgeL=arestas1),
326:         Path <- new("graphNEL", vertices, edgeL=arestas)
167:     graphPath <- function(data=NULL, cuttoffPvalue) {
309:     graphPath <- function(data=NULL, cuttoffCor=NULL, cuttoffP=NULL) {
194:         return(Path)
327:         return(Path)
287:     graph <- graphPath(x, cutPval)
426:         graph <- graphPath(x, cutCor, NULL)
431:         graph <- graphPath(x, NULL, cutPval)
hca:R/lol.R: [ ]
132:     path <- ls(x, all.names = FALSE)
208:     path <- lol_path(x)
290:     path <- lol_path(x)
272: lol_path <- function(x) x[["path"]]
172:     paths <- lol_path(x)
1: .lol_visit_impl <- function(x, path, index, dict)
5: .lol_visit_impl.default <- function(x, path, index, dict) {
6:     dict[[path]] <- append(dict[[path]], list(index))
7:     attr(dict[[path]], "leaf") <- TRUE
15: .lol_visit_impl.list <- function(x, path, index, dict) {
18:     dict[[path]] <- append(dict[[path]], list(index))
19:     attr(dict[[path]], "leaf") <- FALSE
29:     ## logic for building out path names
30:     ## starting with current node of the nested list and extending the path by
32:     if (identical(path, ".")) {
33:         path <- nms
36:             path <- paste0(path, nms)
38:             path <- paste0(path, ".", nms)
44:         .lol_visit_impl(x[[i]], path[[i]], append(index, i), dict)
48:     function(lol, dict, path = .lol_path(dict), class = "lol")
53:         list(lol = lol, dict = dict, path = path),
75: #'     path, number of occurrences, and leaf status of each unique
76: #'     path.
129: .lol_path <-
133:     is_leaf <- .lol_is_leaf(x)[path]
135:         path = path,
136:         n = unname(.lol_lengths(x)[path]),
139:     arrange(tbl, .data$path)
142: .lol_valid_path <-
143:     function(x, path)
145:     ok <- .is_character_0(path) || path %in% lol_path(x)$path
146:     ok || stop("'path' not in 'x':\n", "  path: '", path, "'")
153: #' @param path character(1) from the tibble returned by `lol_path(x)`.
156: #'     to contain just the elements matching `path` as 'top-level'
164:     function(x, path = character())
168:         .is_character_0(path) || .is_scalar_character(path),
169:         .lol_valid_path(x, path)
173:     idx <- paths$path[startsWith(paths$path, path)]
174:     paths <- paths[paths$path %in% idx,]
175:     dict <-  .lol_dict(x)[paths$path]
190: #'     of rows in `lol_path()`.
209:     ## FIXME: don't allow filtering on 'path$path'
210:     path <- filter(path, ...)
211:     dict <- .lol_dict(x)[path$path]
213:     .lol(.lol_lol(x), dict, path, class(x))
219: #'     corresponding to a single `path`.
222: #'     corresponds to an element found at `path` in the list-of-lists
227:     function(x, path)
231:         .is_scalar_character(path),
232:         .lol_valid_path(x, path)
235:     value <- lapply(.lol_dict(x)[[path]], function(idx) lol[[idx]])
236:     names(value) <-  rep(path, length(value))
257:     function(x, path)
259:     value <- lol_lpull(x, path)
265: #' @description `lol_path()` returns a tibble representing the paths
269: #' plol |> lol_path()
293:         "# number of distinct paths: ", NROW(path), "\n",
297:         "# lol_path():\n",
300:     print(path, ...)
17:     ## building out the various paths
67: #'     individual paths from across the list-of-lists.
74: #'     paths through the list, as well as a tibble summarizing the
177:     .lol(.lol_lol(x), dict, paths, class(x))
183: #' @description `lol_filter()` filters available paths based on
295:         "# number of leaf paths: ", sum(is_leaf), "\n",
methylPipe:R/Allfunctions.R: [ ]
223:       path <- paste0(files_location,"/",all_files[[i]])
28:     filename <- file.path(output_folder,
31:     filename <- file.path(output_folder,
58:     all_files <- list.files(path = files_location, pattern = ".sam")
63:     output.files[[read.context]] <- file.path(output_folder,
66:     read.files <- file.path(files_location, all_files)
97:         asBam(file.path(files_location, all_files[i]), destination=file.path(temp_folder, sample_name[i]), overwrite=TRUE)
101:     bam.files <- file.path(path = temp_folder, paste(sample_name, ".bam", sep=""))
112:             filename <- file.path(output_folder, paste0(sample_name[[i]],"_uncov", ".Rdata"))
220:     all_files <- list.files(path = files_location, pattern = ".txt")
224:       temp_data <- fread(path,nrows=10)
227:         cmd <- paste("sed -i 's/\"//g'",path)
229:         cmd <- paste("sed -i 's/^/chr/'",path) 
268:     Tabix_files <- list.files(path = files_location, pattern = "_tabix.txt")
11:     output_folder <- normalizePath(output_folder)  
50:     files_location <- normalizePath(files_location)
51:     output_folder <- normalizePath(output_folder)
132:   files_location <- normalizePath(files_location)
186: BSprepare <-  function(files_location, output_folder, tabixPath, bc=1.5/100) {
191:     if(!is.character(tabixPath))
192:         stop('tabixPath has to be of class character ..')
193:     if(!file.exists(paste(tabixPath, '/tabix', sep='')))
194:         stop('tabix not found at tabixPath ..')
195:     if(!file.exists(paste(tabixPath, '/bgzip', sep='')))
196:         stop('bgzip not found at tabixPath ..')
198:     files_location <- normalizePath(files_location)
199:     output_folder <- normalizePath(output_folder)
200:     tabixPath <- normalizePath(tabixPath)
276:         str <- paste0(tabixPath, '/bgzip ', output_folder, "/", filetb_name,"_out.txt")
280:         str <- paste(tabixPath, '/tabix -s 1 -b 2 -e 2 -f ', fileoutgz, sep='')
SeqArray:R/Internal.R: [ ]
697:     path <- name.gdsn(node, TRUE)
175: .var_path <- function(var.name, prefix)
173: # Variable path
700:         varname <- .var_path(substring(varname, 2L), "@")
701:     fullvarname <- paste(path, varname, sep="/")
709:         if (path == "genotype")
712:             varname2 <- path
726:             if (path == "genotype")
BEclear:R/imputeMissingDataForBlock.R: [ ]
83:   path <- paste(dir, filename, sep = "/")
84:   save(D1, file = path)
exomeCopy:R/main_functions.R: [ ]
199:   path <- viterbiPath(nm.fit$par,fx.par,data,nstates,stFn,trFn,emFn)
105:   V.path <- matrix(0,nrow=nstates,ncol=T)
90: viterbiPath <- function(par,fx.par,data,nstates,stFn,trFn,emFn) {
106: ...(78 bytes skipped)...start.probs=as.double(start.probs),A=as.double(A),emit.probs=as.double(emit.probs),V=as.double(V),V.path=as.integer(V.path),path=as.integer(numeric(T)),trans.prob=as.double(numeric(nstates^2)),trans.prob.max=as.double(numeric(ns...(57 bytes skipped)...
107:   return(viterbi.call$path + 1)
201:   log.odds <- log(emit.probs[cbind(path,seq(path))]+1e-6) - log(emit.probs[normal.state,]+1e-6)
203:   fit <- new("ExomeCopy",sample.name=sample.name,type=type,path=Rle(path),ranges=granges(gr),O.norm=as.numeric(O/mu.hat),log.odds=log.odds,fx.par=fx.par,init.par=init.par,f...(89 bytes skipped)...
ompBAM:R/ompBAM.R: [ ]
144:     path <- file.path(dir, pkg)
65:     proj_path <- .check_ompBAM_path(path)
172: .check_ompBAM_path <- function(path) {   
178:         proj_path <- normalizePath(path)
49: #' @param path The path to the desired directory in which to set up a new
53: #' path <- file.path(tempdir(), "myPkgName")
54: #' use_ompBAM(path)
58: use_ompBAM <- function(path = ".") {
66:     proj_name <- basename(proj_path)   
68:     usethis::create_package(proj_path, open = FALSE)
69:     usethis::proj_set(proj_path, force = TRUE)
71:     makevars <- file.path(proj_path, "src", "Makevars.in")
72:     makevars_win <- file.path(proj_path, "src", "Makevars.win")
73:     configure <- file.path(proj_path, "configure")
74:     configure.win <- file.path(proj_path, "configure.win")
75:     example_code <- file.path(proj_path, "src/ompBAM_example.cpp")
76:     R_import_file <- file.path(proj_path, "R/ompBAM_imports.R")
82:     file.copy(system.file(file.path('examples', 'ompBAMExample', "src", 
84:     file.copy(system.file(file.path('examples', 'ompBAMExample', "src", 
87:     file.copy(system.file(file.path('examples','ompBAMExample',"configure"), 
89:     file.copy(system.file(file.path('examples','ompBAMExample',"configure.win"),
92:     file.copy(system.file(file.path('extdata', 'ompBAM_example.cpp'), 
97:     .omp_use_dependency("Rcpp", "Imports", proj_path)
98:     .omp_use_dependency("zlibbioc", "Imports", proj_path)
99:     .omp_use_dependency("ompBAM", "LinkingTo", proj_path)
100:     .omp_use_dependency("Rcpp", "LinkingTo", proj_path)
101:     .omp_use_dependency("zlibbioc", "LinkingTo", proj_path)
103:     end_msg <- paste(proj_name, "successfully created in", proj_path)
121: #' # The directory containing the source code is given by the path here
123: #' print(system.file(file.path('examples', "ompBAMExample"), 
137:     from <- system.file(file.path('examples', pkg), package = 'ompBAM')
146:     devtools::load_all(path)
149: #' Returns the path of a test BAM file
157: #' @param dataset Returns the path to either the "Unsorted" or "scRNAseq" BAM.
158: #' @return A file path to the specified BAM file.
165:         system.file(file.path('extdata', 'THP1_ND_1.bam'), package = 'ompBAM'))
167:         system.file(file.path('extdata', 'MGE_E35_1.bam'), package = 'ompBAM'))
171: # Sanity checks on provided path for smooth package creation.
173:     if(!dir.exists(dirname(path))) {
174:         errormsg <- paste(dirname(path), "needs to exist")
177:     if(dir.exists(path)) {
180:         proj_path <- file.path(normalizePath(dirname(path)), basename(path))
182:     makevars <- file.path(proj_path, "src", "Makevars")
183:     makevars_win <- file.path(proj_path, "src", "Makevars.win")
191:     example_code <- file.path(proj_path, "src/ompBAM_example.cpp")
199:     R_import_file <- file.path(proj_path, "R/ompBAM_imports.R")
207:     return(proj_path)
228: .omp_use_dependency <- function(package, type, proj_path) {
233:     deps <- desc::desc_get_deps(proj_path)
243:         desc::desc_set_dep(package, type, file = proj_path)
263:             desc::desc_del_dep(package, existing_type, file = proj_path)
264:             desc::desc_set_dep(package, type, file = proj_path)
ELMER:R/plots.R: [ ]
924:   readr::write_delim(pairs, path = filename, append = TRUE)
614:         write_tsv(cbind(as.data.frame(pairs)[,c(1:3,6)],corretlation.tab),path = file.name.table)
628:         write_tsv(cbind(as.data.frame(pairs)[,c(1:3,6)],corretlation.tab),path = file.name.table)
974:       filename <- file.path(dir,track.names[idx])
976:       filename <- file.path(dir,paste0(sample,".bw"))
994: #' dir(path = "analysis",
1068:                   ret <- summarizeTF(path = x,
1103:                         function(path){
1104:                           TF <- readr::read_csv(dir(path = path, pattern = ".significant.TFs.with.motif.summary.csv",
1106:                           motif <- readr::read_csv(dir(path = path, pattern = ".motif.enrichment.csv",
1129:                           function(path){
1130:                             TF <- readr::read_csv(dir(path = path, 
1133:                             motif <- readr::read_csv(dir(path = path, 
1141:                             TF.meth.cor <- get(load(dir(path = path, pattern = ".TFs.with.motif.pvalue.rda", recursive = T, full.names = T)))
1184:                              function(path){
1185:                                TF <- readr::read_csv(dir(path = path, 
1189:                                motif <- readr::read_csv(dir(path = path, 
1199:                                TF.meth.cor <- get(load(dir(path = path, 
1213:                                TF.meth.cor$analysis <- path
ChemmineR:R/AllClasses.R: [ ]
1734: 	path <- conMA(x, exclude="H")
1979:             path <- .linearCon(x=con)
1800: 	conpath <- t(sapply(path, function(x) x[c(1, length(x))]))
1812: 	pathlist <- cyclist$path
1813: 	conpath <- cyclist$conpath
1814: 	pathlistnew <- list() 
1735: 	noconnect <- rowSums(path) != 0 # Removes atoms with no connections
1736: 	path <- path[noconnect, noconnect]
1737: 	if(all(dim(path) == 0)) { return(path) } 
1738: 	term <- which(rowSums(path > 0)==1)
1740: 		path <- path[-term,-term]
1741: 		if(any(dim(path) == 0) | is.vector(path)) { break() }
1742: 		term <- which(rowSums(path > 0)==1)
1744: 	return(path)
1779: .update <- function(con, path) {
1780: 	## Remove non-terminal atoms in each path
1781: 	center_atoms <- unique(unlist(lapply(path, function(x) x[-c(1, length(x))])))
1791: 		path <- c(path, remainbonds)
1792: 		names(path) <- seq(along=path)
1794: 	## Collect complete rings and remove them from path object
1795: 	index <- unlist(lapply(path, function(y) any(duplicated(y))))
1796: 	rings <- path[index]
1797: 	path <- path[!index]
1798: 	names(path) <- seq(along=path)
1799: 	## Connection list for path component
1806: 	return(list(con=con, conpath=conpath, path=path, rings=rings))
1850: 		## Collect complete rings and remove them from path object
1980:             cyclist <- .update(con=con, path=path)
13: .sdfDownload <- function(mypath="ftp://ftp.ncbi.nih.gov/pubchem/Compound/CURRENT-Full/SDF/", myfile="Compound_00650001_00675000.sdf...(7 bytes skipped)...
14: 	system(paste("wget ", mypath, myfile, sep=""))
17: # .sdfDownload(mypath="ftp://ftp.ncbi.nih.gov/pubchem/Compound/CURRENT-Full/SDF/", myfile="Compound_00650001_00675000.sdf...(6 bytes skipped)...
1747: ## (b) Function to return the longest possible linear bond paths where:
1801: 	ends <- unique(as.vector(conpath))
1802: 	conpath <- lapply(ends, function(x) as.numeric(names(which(rowSums(conpath==x) > 0))))
1803: 	names(conpath) <- ends
1804: 	conpath <- conpath[sapply(conpath, length) > 1] # removes ends that occur only once 
1816: 	## Loop to join linear paths/fragments stored in pathlist
1817: 	for(i in names(conpath)) {
1818: 		if(length(conpath) == 0 | !any(names(conpath) == i)) { next() }
1819: 		pos <- t(combn(conpath[[i]], m=2))
1821: 			p1 <- pathlist[[pos[j,1]]]
1822: 			p2 <- pathlist[[pos[j,2]]]
1827: 				pathlistnew[[length(pathlistnew)+1]] <- c(rev(p2[-1]), p1)
1830: 				pathlistnew[[length(pathlistnew)+1]] <- c(p1, rev(p2[-length(p2)]))
1833: 				pathlistnew[[length(pathlistnew)+1]] <- c(p2, p1[-1])
1836: 				pathlistnew[[length(pathlistnew)+1]] <- c(p1, p2[-1])
1840: 		if(length(pathlistnew) == 0) { next() }
1842: 		dups <- duplicated(sapply(pathlistnew, function(x) paste(sort(unique(x)), collapse="_")))
1843: 		pathlistnew <- pathlistnew[!dups]
1846: 			l <- sapply(pathlistnew, length)
1847: 			pathlistnew <- pathlistnew[l <= upper]
1848: 			if(length(pathlistnew) == 0) { next() }
1851: 		index <- unlist(lapply(pathlistnew, function(y) any(duplicated(y[c(1, length(y))]))))
1852: 		rings[[length(rings)+1]] <- pathlistnew[index]
1853: 		pathlistnew <- pathlistnew[!index]
1854: 		## Remove paths with internal duplicates 
1855: 		if(length(pathlistnew) > 0) {
1856: 			index <- unlist(lapply(pathlistnew, function(y) any(duplicated(y))))
1857: 			pathlistnew <- pathlistnew[!index]
1859: 		## Update pathlist and conpath
1860: 		pathlist <- c(pathlist[-conpath[[i]]], pathlistnew)
1861: 		dups <- duplicated(sapply(pathlist, function(x) paste(sort(unique(x)), collapse="_")))
1862: 		pathlist <- pathlist[!dups]
1863: 		names(pathlist) <- seq(along=pathlist)
1864: 		conpath <- t(sapply(pathlist, function(x) x[c(1, length(x))]))
1865: 		ends <- unique(as.vector(conpath))
1866: 		conpath <- lapply(ends, function(x) as.numeric(names(which(rowSums(conpath==x) > 0))))
1867: 		names(conpath) <- ends
1868: 		conpath <- conpath[sapply(conpath, length) > 1] # removes ends that occur only once
1869: 		pathlistnew <- list()
snapcount:R/basic_query_functions.R: [ ]
273:     path <- paste(compilation, paste0(endpoint, "?"), sep = "/")
319:     paste0(pkg_globals$snaptron_host, path, paste(query, collapse = "&"))
TPP2D:R/import_funcs.R: [ ]
348:   Experiment <- Path <- Compound <- NULL
570:  Path <- label <- conc <- Compound <- Experiment <- 
371:   givenPaths <- NULL
253:                "Experiment", "Path", "Path", 
254:                "Path", "Condition", "Replicate", 
334: #' @param infoTable character string of a file path to
372:   if (any("Path" %in% colnames(infoTable))) {
373:     if (all(infoTable$Path == "") || all(is.na(infoTable$Path))) {
374:       message("Removing empty 'Path' column from config table")
375:       infoTable <- infoTable %>% select(-Path)
378:       givenPaths <- infoTable$Path
443: #' @param configTable character string of a file path to a config table
485:   files <- configTable$Path
511:                   "RefCol", "Path", "Condition")
573:   if(any(grepl("Path", colnames(configWide)))){
575:       dplyr::select(-Path) %>%
756: #' @param configTable character string of a file path to a config table
433:       expCond = infoTable$Condition, files = givenPaths, 
mAPKL:R/mAPKL.R: [ ]
64:     path <- as.integer(dataType)
54: ## path : 6-ratio data without normalization    or
69:     cluster_analysis <- cluster.Sim(ordIntensities_f[,start:end], path, min.clu,
nempi:other/TCGA.r: [ ]
23: path <- "mutclust/"
31:     if (file.exists(paste0(path, type, "_final.rda")) & !newmut & !newllr & !newsave) {
32:         load(paste0(path, type, "_final.rda"))
39:         if (file.exists(paste0(path, type, "_meth.rda"))) {
40:             load(paste0(path, type, "_meth.rda"))
80:             save(meth, file = paste0(path, type, "_meth.rda"))
86:         if (file.exists(paste0(path, type, "_cnv.rda"))) {
87:             load(paste0(path, type, "_cnv.rda"))
102:             save(cnv, file = paste0(path, type, "_cnv.rda"))
108:         if (file.exists(paste0(path, type, "_query.rda"))) {
109:             load(paste0(path, type, "_query.rda"))
128:             save(data, file = paste0(path, type, "_query.rda"))
137:         if (file.exists(paste0(path, type, "_mut.rda"))) {
138:             load(paste0(path, type, "_mut.rda"))
155:             save(mut, file = paste0(path, type, "_mut.rda"))
159:         if (file.exists(paste0(path, type, "_clin.rda"))) {
160:             load(paste0(path, type, "_clin.rda"))
163:             save(clinical, file = paste0(path, type, "_clin.rda"))
167:         if (file.exists(paste0(path, type, "_mut0.rda")) & !newmut) {
168:             load(paste0(path, type, "_mut0.rda"))
234:             save(M0, Mtype0, file = paste0(path, type, "_mut0.rda"))
263:         if (file.exists(paste0(path, type, "_llr.rda")) & !newllr) {
264:             load(paste0(path, type, "_llr.rda"))
345:             save(tmp, DF, file = paste0(path, type, "_llr.rda"))
381:         save(clinical, D, M, Mtype, DF, class, meth, cnv, file = paste0(path, type, "_final.rda"))
406: path <- "mutclust/"
408: load(paste0(path, type, "_final.rda"))
545: path <- ""
552:     load(paste0(path, type, "_nempi.rda"))
570:     load(paste0(path, type, "_nempi.rda"))
588:     load(paste0(path, type, "_nempi.rda"))
611:     load(paste0(path, type, "_nempi.rda"))
629:     load(paste0(path, type, "_nempi.rda"))
683: ## save(nempires, knnres, rfres, mfres, svmres, nnres, Rho, D2, Pmut, Pmeth, Pcnv, file = paste0(path, type, "_nempi.rda"))
685: path <- "mutclust/"; type <- "TCGA-BRCA"
687: load(paste0(path, type, "_nempi.rda"))
908: load(paste0(path, type, "_nempi.rda"))
ISAnalytics:R/internal-functions.R: [ ]
1383:             path = project_folder, recurse = TRUE,
1841:                 path = association_file,
3655:                                 path = report_path,
1326:     path_cols <- .path_cols_names()
2250:     path_col_names <- .path_cols_names()
1622:     stats_paths <- purrr::pmap_dfr(temp, function(...) {
1710:     stats_paths <- .stats_report(association_file,
359:     corr_fold <- fs::path(dir, "fs")
363:         proj_fold <- fs::path(corr_fold, proj)
364:         quant_fold <- fs::path(proj_fold, "quantification")
369:             pool_fold <- fs::path(quant_fold, .y)
381:                 file = fs::path(pool_fold, paste(prefix,
388:                 file = fs::path(pool_fold, paste(prefix,
399:             proj_fold <- fs::path(corr_fold, proj)
400:             iss_fold <- fs::path(proj_fold, "iss")
403:                 pool_fold <- fs::path(iss_fold, .y)
411:                         file = fs::path(pool_fold, filename),
439:     err_fold <- fs::path(dir, "fserr")
447:         proj_fold <- fs::path(err_fold, proj)
448:         quant_fold <- fs::path(proj_fold, "quantification")
467:             pool_fold <- fs::path(quant_fold, .y)
480:                     file = fs::path(pool_fold, paste(prefix,
488:                 file = fs::path(pool_fold, paste(prefix,
499:             proj_fold <- fs::path(err_fold, proj)
500:             iss_fold <- fs::path(proj_fold, "iss")
509:                 pool_fold <- fs::path(iss_fold, .y)
518:                             file = fs::path(pool_fold, filename),
550: #' @importFrom fs path_ext
551: #' @importFrom tools file_path_sans_ext
553: .check_file_extension <- function(file_path) {
555:     last <- fs::path_ext(file_path)
559:         file_path[compressed] <- tools::file_path_sans_ext(
560:             file_path[compressed]
562:         last <- fs::path_ext(file_path)
858: .read_with_fread <- function(path, additional_cols, annotated, sep) {
887:         file = path,
924: .read_with_readr <- function(path, additional_cols, annotated, sep) {
949:         file = path,
984: .import_single_matrix <- function(path,
1015:     is_compressed <- fs::path_ext(path) %in% .compressed_formats()
1018:         compression_type <- fs::path_ext(path)
1031:     peek_headers <- readr::read_delim(path,
1053:             path = path, additional_cols = additional_cols,
1058:             path = path, additional_cols = additional_cols,
1182: .read_af <- function(path, date_format, delimiter) {
1185:     file_ext <- .check_file_extension(path)
1199:         headers_peek <- readr::read_delim(path,
1207:         headers_peek <- readxl::read_excel(path, n_max = 0)
1228:             df <- readr::read_delim(path,
1238:             df <- readxl::read_excel(path,
1306: # - root_folder: Path to the root folder
1309: # ProjectID - ConcatenatePoolIDSeqRun - PathToFolderProjectID - Found - Path -
1310: # Path_quant - Path_iss (NOTE: headers are dynamic!)
1334:                 fs::path(
1335:                     fs::path(root_folder),
1346:             !!path_cols$project := NA_character_,
1347:             !!path_cols$quant := NA_character_,
1348:             !!path_cols$iss := NA_character_
1352:         project_folder <- fs::path(
1353:             fs::path(root_folder),
1357:             paste0(fs::path(
1359:                 fs::path(cur[[concat_pool_col]])
1375:             paste0(fs::path(
1377:                 fs::path(cur[[concat_pool_col]])
1391:             path = project_folder, recurse = TRUE,
1401:                     !!path_cols$project := project_folder,
1402:                     !!path_cols$quant := quant_found,
1403:                     !!path_cols$iss := iss_found
1434: .manage_association_file <- function(af_path,
1444:         path = af_path,
1575: # Finds automatically the path on disk to each stats file.
1582: # Path_iss (or designated dynamic name), stats_files, info
1587:     path_iss_col) {
1590:             dplyr::all_of(c(proj_col, pool_col, path_iss_col))
1598:     if (all(is.na(temp[[path_iss_col]]))) {
1605:         if (is.na(temp_row[[path_iss_col]])) {
1613:         files <- fs::dir_ls(temp_row[[path_iss_col]],
1695: # - path_iss_col: name of the column that contains the path
1704:     path_iss_col,
1714:         path_iss_col = path_iss_col
1833: .pre_manage_af <- function(association_file, import_af_args, report_path) {
1834:     if (!is.null(report_path) && !fs::is_dir(report_path)) {
1835:         report_path <- fs::path_dir(report_path)
1837:     ## Import association file if provided a path
1842:                 report_path = report_path,
1848:     if (!.path_cols_names()$quant %in% colnames(association_file)) {
1849:         rlang::abort(.af_missing_path_error(.path_cols_names()$quant),
1850:             class = "missing_path_col"
1854:         dplyr::filter(!is.na(.data[[.path_cols_names()$quant]]))
2239: #' @importFrom fs dir_ls as_fs_path
2255:             .data[[path_col_names$quant]]
2278:             matches <- fs::dir_ls(temp_row[[path_col_names$quant]],
2325: # @param dupl The tibble containing quantification types and path to the files
2373: # * Removing files not found (files for which Files_count$Found == 0 and Path
2550: #' @importFrom fs as_fs_path
2589:                     dplyr::mutate(Files_found = fs::as_fs_path(
2609:                     dplyr::mutate(Files_found = fs::as_fs_path(
2691: # * Removing files not found (files for which Files_count$Found == 0 and Path
2874:             list(path = x),
3594:     report_path) {
3641:                         fs::dir_create(report_path)
3671:                                 path = report_path,
4063: # @param file_path The file path as a string
4064: #' @importFrom fs dir_create path_wd path
4069: .write_recalibr_map <- function(map, file_path) {
4070:     if (!fs::file_exists(file_path)) {
4071:         ext <- fs::path_ext(file_path)
4074:             fs::dir_create(file_path)
4076:             tmp_filename <- fs::path(file_path, gen_filename)
4078:             tmp_filename <- fs::path_ext_remove(file_path)
4080:                 ext <- paste(fs::path_ext(tmp_filename), ext, sep = ".")
4081:                 tmp_filename <- fs::path_ext_remove(tmp_filename)
4099:     } else if (fs::is_dir(file_path)) {
4101:         tmp_filename <- fs::path(file_path, gen_filename)
4103:         tmp_filename <- file_path
4897:                 x = "Did you provide the correct path?"
4914:                 x = "Did you provide the correct path?"
549: # Returns the file format for each of the file paths passed as a parameter.
1317:         rlang::abort(.af_missing_pathfolder_error(proj_fold_col))
1417: # containing paths to project folder, quant folders and iss folders
1597:     # If paths are all NA return
1677:     stats_paths
1709:     # Obtain paths
1716:     stats_paths <- stats_paths %>%
1718:     if (all(is.na(stats_paths$stats_files))) {
1719:         stats_paths <- stats_paths %>%
1725:         return(list(stats = NULL, report = stats_paths))
1735:             tasks = length(stats_paths$stats_files),
1741:             tasks = length(stats_paths$stats_files),
1764:         BiocParallel::bplapply(stats_paths$stats_files,
1780:     stats_paths <- stats_paths %>%
1782:     stats_paths <- purrr::pmap_dfr(stats_paths, function(...) {
1799:     stats_paths <- stats_paths %>%
1801:     stats_dfs <- stats_dfs[stats_paths$Imported]
1804:         return(list(stats = NULL, report = stats_paths))
1811:     list(stats = stats_dfs, report = stats_paths)
2854: # @param files Files_found table where absolute paths of chosen files