Found 49973 results in 5358 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")){
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)
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
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()
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)...
GBScleanR:R/Methods-GbsrGenotypeData.R: [ ]
424:               path <- paste0("annotation/info/", var)
449:                   path <- paste0("annotation/format/AD/", "norm")
525:               path <- ifelse(.existGdsNode(object, node),
1308:                   path <- .getNodeIndex(object, node)
1420:               path <- paste0("annotation/format/AD/", node)
1521:               path <- .getNodeIndex(object, "annotation/format/AD/norm")
18: ## Get the index of the specified path in the GDS file.
20: .getNodeIndex <- function(object, path){
21:     return(index.gdsn(.getGdsfmtObj(object), path))
83: .existGdsNode <- function(object, path){
84:     return(exist.gdsn(.getGdsfmtObj(object), path))
426:               if(!.existGdsNode(object, path)){
427:                   warning("No data at ", path)
430:               info_node <- .getNodeIndex(object, path)
451:                   path <- paste0("annotation/format/AD/", "filt.data")
453:                   path <- paste0("annotation/format/AD/", "data")
455:               if(!.existGdsNode(object, path)){
458:               ad_node <- .getNodeIndex(object, path)
529:               genotype_node <- .getNodeIndex(object, path)
1327:                                                path,
1336:                                               path,
1346: .countGenotypeScan <- function(object, path, sel, has_flipped, valid_flipped){
1347:     df <- apply.gdsn(path, 1, selection=sel, as.is="list",
1380: .countGenotypeSnp <- function(object, path, sel, has_flipped, valid_flipped){
1381:     df <- apply.gdsn(path, 2, selection=sel, as.is="list",
1421:               if(.existGdsNode(object, path)){
1422:                   path <- .getNodeIndex(object, path)
1437:                                            path,
1446:                                           path,
1454: .countReadScan <- function(object, path, sel, has_flipped, valid_flipped){
1455:     df <- apply.gdsn(path, 1, selection=sel, as.is="list",
1478: .countReadSnp <- function(object, path, sel, has_flipped, valid_flipped){
1479:     df <- apply.gdsn(path, 2, sum, sel, "list")
1526:                                                path,
1536:                                               path,
1570:                                path,
1575:     df <- apply.gdsn(path, 1, selection=sel, as.is="list",
1615:                               path,
1620:     df <- apply.gdsn(path, 2, selection=sel, as.is="list",
2509:                   stop("Failed to create a new file to the following path \n",
VarCon:inst/extdata/app.R: [ ]
235:   path <- reactiveValues(
240:   path2 <- reactiveValues(
244:   path3 <- reactiveValues(
24:   uploadReferenceDNA <- eventReactive(path$pth,{
26:     testFASTA <- strsplit(path$pth,"\\.")[[1]]
28:       referenceDnaStringSet2 <- readDNAStringSet(path$pth, format="fasta",use.names=TRUE)
34:       load(path$pth)
42:   uploadTranscriptTable <- eventReactive(path3$pth3,{
45:     testCSV <- strsplit(path3$pth3,"\\.")[[1]]
47:       transCoord <- read.csv(path3$pth3, sep=";")
48:     }else{ transCoord <- readRDS(path3$pth3)}
78:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
99:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
126:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
145:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
176:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
205:     gene2transcript <- read.csv(path2$pth2, sep=";", stringsAsFactors=FALSE)
251:     path$pth <- file.choose()
255:     path2$pth2 <- file.choose()
259:     path3$pth3 <- file.choose()
234:   ## Define reactive paths
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, 
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='')
ORFik:R/experiment.R: [ ]
296:   for (path in filepaths) {
42:       cbu.path <- "/export/valenfs/data/processed_data/experiment_tables_for_R/"
240:     cbu.path <- "/export/valenfs/data/processed_data/experiment_tables_for_R/"
925:     cbu.path <- "/export/valenfs/data/processed_data/experiment_tables_for_R/"
287: findFromPath <- function(filepaths, candidates, slot = "auto") {
511: filepath <- function(df, type, basename = FALSE) {
515:   paths <- lapply(df$filepath, function(x, df, type) {
652:       paths <- filepath(df, type)
368:     reversePaths <- df$reverse[!(df$reverse %in% c("", "paired-end"))]
7: #' @param file relative path to a ORFik experiment. That is a .csv file following
10: #' also be full path to file, then in.dir argument is ignored.
13: #' it to disc. Does not apply if file is not a path, but a data.frame. Also
14: #' does not apply if file was given as full path.
30: #' # save.experiment(df, file = "path/to/save/experiment")
32: #' # read.experiment("path/to/save/experiment")
34: #' # read.experiment("experiment", in.dir = "path/to/save/")
43:       if (file.exists(pasteDir(cbu.path, basename(file))))
44:         file <- pasteDir(cbu.path, basename(file))
109: #' @param txdb A path to TxDb (prefered) or gff/gtf (not adviced, slower)
111: #' @param fa A path to fasta genome/sequences used for libraries, remember the
178: #' # Save with: save.experiment(df, file = "path/to/save/experiment.csv")
241:     if (dir.exists(cbu.path)) { # This will only trigger on CBU server @ UIB
243:       message(cbu.path)
244:       saveDir <- cbu.path
263: #' #save.experiment(df, file = "path/to/save/experiment.csv")
265: #' #save.experiment(df, file = "path/to/save/experiment")
280: #' @param filepaths path to all files
297:     hit <- names(unlist(sapply(candidates, grep, x = path)))
300:     hitRel <- names(unlist(sapply(candidates, grep, x = gsub(".*/", "", path))))
841:       fext[compressed] <-file_ext(file_path_sans_ext(files[compressed],
914: #' ## Path above is default path, so no dir argument needed
918: #' #list.experiments(dir = "MY/CUSTOM/PATH)
923:   experiments <- list.files(path = dir, pattern = "\\.csv")
926:     if (dir.exists(cbu.path)) { # If on UIB SERVER
927:       dir <- cbu.path
928:       experiments <- list.files(path = dir, pattern = "\\.csv")
24: #' df <- read.experiment(filepath) # <- valid ORFik .csv file
207:     df[4,] <- c("libtype", "stage", "rep", "condition", "fraction","filepath",
214:     df[4,] <- c("libtype", "stage", "rep", "condition", "fraction","filepath")
217:   # set file paths
220:   df[5:(5+length(files)-1), 1] <- findFromPath(files, libNames(), libtype)
223:   df[5:(5+length(files)-1), 2] <- findFromPath(files, stages, stage)
225:   df[5:(5+length(files)-1), 3] <- findFromPath(files, repNames(), rep)
227:   df[5:(5+length(files)-1), 4] <- findFromPath(files, conditionNames(), condition)
229:   df[5:(5+length(files)-1), 5] <- findFromPath(files, fractionNames(), fraction)
365:   files <- df$filepath
366:   if (length(df$filepath) == 0) stop("df have no filepaths!")
436: #' Get variable name per filepath in experiment
498: #' Get relative paths instead of full. Only use for inspection!
499: #' @return a character vector of paths, or a list of character with 2 paths per,
506: #' filepath(df, "default")
508: #' # filepath(df, "bedo")
510: #' # filepath(df, "pshifted")
516:     i <- which(df$filepath == x)
519:       out.dir <- paste0(dirname(df$filepath[1]), "/pshifted/")
549:       out.dir <- paste0(dirname(df$filepath[1]), "/",type,"/")
565:     if (is.null(input)) stop("filepath type not valid!")
569:   if (all(lengths(paths) == 1)) {
570:     paths <- unlist(paths)
572:   return(paths)
653:       libs <- bplapply(seq_along(paths),
654:                        function(i, paths, df, chrStyle, param, strandMode, varNames) {
656:         fimport(paths[i], chrStyle, param, strandMode)
657:       }, BPPARAM = BPPARAM, paths = paths, chrStyle = chrStyle, df = df,
698: #' dirname(df$filepath[1]),
726:                        out.dir = dirname(df$filepath[1]),
768:                        remove.file_ext(df$filepath[i], basename = TRUE),
284: #' else must be a character vector of length 1 or equal length as filepaths.
289:     if(length(slot) != 1 & length(slot) != length(filepaths)) {
369:     files <- c(files, reversePaths)
388:     stop("Duplicated filepaths in experiment!")
488: #' Get filepaths to ORFik experiment
492: #' default filepaths without warning. \cr
isobar:R/ProteinGroup-class.R: [ ]
424:                       host="www.ebi.ac.uk",path="/uniprot/biomart/martservice")
R453Plus1Toolbox:R/methods-AVASet.R: [ ]
270:                 path = file.path(dirname, s, r)
370:                 path = file.path(dirname, s, r)
774: 	    path = unique(c(subset(RData, sample==s)$currentPath, subset(RData, sample==s)$currentPath))
23: 	dir_root = file.path(dirname, "Amplicons")
24: 	dir_results = file.path(dir_root,"Results")
25: 	dir_projectDef = file.path(dir_root,"ProjectDef")
26: 	dir_variants = file.path(dir_results, "Variants")
27: 	dir_align = file.path(dir_results, "Align")
37:             | !file.exists(file.path(dir_variants, "currentVariantDefs.txt"))
38:             | !file.exists(file.path(dir_projectDef, "ampliconsProject.txt"))
95:       doAmplicon = file.path(avaBin, "doAmplicon")
217:               file_sample = file.path(dirname, file_sample)
218:               file_amp = file.path(dirname, file_amp)              
219:               file_reference = file.path(dirname, file_reference)
220:               file_variant = file.path(dirname, file_variant)
221:               file_variantHits = file.path(dirname, file_variantHits)
271:                 files = list.files(path)
281:                   amps_align[[i]]= readLines(file.path(path, file))
325:               file_sample = file.path(dirname, file_sample)
326:               file_amp = file.path(dirname, file_amp)              
327:               file_reference = file.path(dirname, file_reference)
371:                 files = list.files(path)
381:                   amps_align[[i]]= readLines(file.path(path, file))
675:     text = readLines(file.path(dir_projectDef, "ampliconsProject.txt"))
689:     	warning(paste("sample information missing in", file.path(dir_projectDef, "ampliconsProject.txt")))
757: 	    	warning(paste("Read data or MID entries missing in", file.path(dir_projectDef, "ampliconsProject.txt")))
775: 	    if(!any(is.na(path))){
776: 	        path = sapply(strsplit(path, split="\\."), function(x)x[1])
777: 	        ptp = paste(substr(path, 1, nchar(path)-2), collapse=",")
778: 	        lane = paste(substr(path, nchar(path)-1, nchar(path)), collapse=",")
822:         variantDefs=read.table(file=file.path(dir_variants, "currentVariantDefs.txt"), sep="\t",
902:             if(file.exists(file.path(dir_variants, s_id))){
903:                 detections = dir(file.path(dir_variants, s_id), pattern=".txt$", ignore.case=FALSE)
905:                     det = read.table(file.path(dir_variants, s_id, d), sep="\t",
949:         pfLines=readLines(file.path(dir_projectDef, "ampliconsProject.txt"))
997:         pfLines=readLines(file.path(dir_projectDef, "ampliconsProject.txt"))
1052:             thisSampleDir=file.path(dir_align, samples$SampleID[s])
1055:                 thisRefDir=file.path(thisSampleDir, r)
1056:                 alignFile=file.path(thisRefDir, paste(samples$SampleID[s],
700:             	"annotation", "currentPath", "name", "originalPath", "readDataGroup", "sequenceBlueprint"),
760: 	    	RData = data.frame(sample=samples, currentPath=rep(NA, numSamples), 
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))
PoTRA:R/PoTRA_corN.R: [ ]
76:             path<-data.frame(matrix(0,length.intersect,(Num.sample.normal+Num.sample.case)))
56:         graph.path<-igraph.from.graphNEL(g)    
42:     pathwaynames <- c()
40:     length.pathway<-c()
58:         #plot(graph.path, edge.arrow.size=.5, vertex.color="gold", vertex.size=5, 
66:         graph.path<-induced_subgraph(graph.path, as.character(intersect(unlist(nodelist),unlist(genelist_reformatted))))
67:         #plot(graph.path)   
82:                 path[j,]<-mydata[which(genelist_reformatted==a[j]),]  #collect expression data of genes for a specific pathway across normal and tumor samples.
87:             cor.normal <- apply(path[,1:Num.sample.normal], 1, function(x) { apply(path[,1:Num.sample.normal], 1, function(y) { cor.test(x,y)[[3]] })})
103:             cor.case <- apply(path[,(Num.sample.normal+1):(Num.sample.normal+Num.sample.case)], 1, function(x) { apply(path[,(Num.sample.normal+1):(Num.sample.normal+Num.sample.case)], 1, function(y) { cor.test(x,y)[[3]] })...(2 bytes skipped)...
1: #' The PoTRA analysis is based on topological ranks of genes in biological pathways. PoTRA can be used to detect pathways involved in disease. The PoTRA package contains one function for creating the PoTRA results obj...(4 bytes skipped)...
7: #' @param Pathway.database The pathway database, such as KEGG, Reactome, Biocarta and PharmGKB. 
14: ...(29 bytes skipped)...ta=mydata, genelist=genelist, Num.sample.normal=Num.sample.normal, Num.sample.case=Num.sample.case, Pathway.database=Pathway.database, PR.quantile=PR.quantile)
16: #' Pathway.database (options): 
17: #' humanKEGG=pathways('hsapiens','kegg')
18: #' humanReactome=pathways('hsapiens','reactome')
19: #' humanBiocarta=pathways('hsapiens','biocarta')
20: #' humanPharmGKB=pathways('hsapiens','pharmgkb')
22: #' Pathway.database=humanKEGG
23: #' Pathway.database=humanReactome
24: #' Pathway.database=humanBiocarta
25: #' Pathway.database=humanPharmGKB
28: PoTRA.corN <- function(mydata,genelist,Num.sample.normal,Num.sample.case,Pathway.database,PR.quantile) {
44:     #humanPharmGKB <- pathways("hsapiens", "pharmgkb")
45:     #humanBiocarta <- pathways("hsapiens", "biocarta")
46:     #humanKEGG <- pathways("hsapiens", "kegg")
48:     for (x in 1:length(Pathway.database[1:length(Pathway.database)])){
51:         p0 <-Pathway.database[[x]]
52:         pathwaynames[x] <- p0@title
54:         g<-pathwayGraph(p) 
65:         length.pathway[x]<-length.intersect
74:             #collect expression data of genes for a specific pathway across normal and tumor samples.
162:     return(list(Fishertest.p.value=Fishertest,KStest.p.value=kstest,LengthOfPathway=length.path...(62 bytes skipped)...rOfHubGenes.case=TheNumOfHubGene.case,TheNumberOfEdges.normal=E.normal,TheNumberOfEdges.case=E.case,PathwayName=pathwaynames))
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())
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))
spikeLI:R/collapse.R: [ ]
18:         path <- system("pwd",TRUE);
20:                 {postscript(paste(path,paste("/",probe_set[1],sep=""),sep=""));}
21:         else    {postscript(paste(path,paste("/",filename,sep=""),sep=""));}
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",
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
SMITE:R/SMITE.R: [ ]
1277:                             path <- goseq::goseq(pwf, "hg19", "knownGene",
1196:             PATHID2NAME <- AnnotationDbi::as.list(reactome.db::reactomePATHID2NAME)
1210:             pathways <- KEGGREST::keggList("pathway", "hsa") ## returns the list of human pathways
1279:                             path <- cbind(path,(as.character(sapply(
1280:                                 path$category, function(i){PATHID2NAME[[i]]}))))
1281:                             colnames(path)[6] <- "cat_name"
1282:                             subset(path, path$over_represented_pvalue < p_thresh)
1189:                 AnnotationDbi::as.list(reactome.db::reactomeEXTID2PATHID)
1201:             link_kegg<- KEGGREST::keggLink("pathway", "hsa") ## returns pathways for each kegg gene
1202:             list_link <- split(unname(link_kegg), names(link_kegg)) ## combines each pathway into list object for each gene
1211:             PATHID2NAME <- as.list(pathways)
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)
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)
peakPantheR:R/methods_peakPantheRAnnotation.R: [ ]
1724:             device = "png", path = saveFolder, dpi = 100, width = 21,
1853:     path_cpdMeta <- paste(saveFolder, "/", annotationName,
1871:     path_specMeta <- paste(saveFolder, "/", annotationName,
1883:         path_var <- paste(saveFolder, "/", annotationName, "_", i, ".csv",
1918:     path_summary <- paste(saveFolder, "/", annotationName, "_summary.csv",
1116:     .filepath <- x@filepath[i]
1863:     tmp_filepath <- filepath(object)
2045:     .spectraPaths <- resSpectra$spectraPaths
2182: resetAnnot_spectraPathMetadata <- function(previousAnnotation, spectraPaths,
2186:         .spectraPaths <- filepath(previousAnnotation)
1076:     return(tools::file_path_sans_ext(basename(object@filepath)))
1386: #' @param saveFolder (str) Path of folder where annotationParameters_summary.csv
1399: #' spectraPaths <- c('./path/file1', './path/file2', './path/file3')
1610: #' @param saveFolder (str) Path of folder where annotationParameters_summary.csv
1703:     # @param saveFolder (str) Path where plots will be saved
1727:         # output path
1758: #' @param saveFolder (str) Path of folder where the annotation result csv will
1855:     utils::write.csv(tmp_outCpdMeta, file = path_cpdMeta, row.names = FALSE,
1858:     if (verbose) { message("Compound metadata saved at ", path_cpdMeta) }
1873:     utils::write.csv(tmp_outSpecMeta, file = path_specMeta, row.names = FALSE,
1876:     if (verbose) { message("Spectra metadata saved at ", path_specMeta) }
1885:         utils::write.csv(tmp_var, file = path_var, row.names = TRUE,
1889:             message("Peak measurement \"", i, "\" saved at ", path_var)
1920:     utils::write.csv(tmp_summary, file = path_summary, row.names = TRUE,
1923:     if (verbose) { message("Summary saved at ", path_summary) }
24:             length(object@filepath), " samples. \n", sep = "")
53: # @filepath length. Slot type is not checked as \code{setClass} enforces it.
78: #' # Paths to spectra files
119: #' # Paths to spectra files
160: #' # Paths to spectra files
206: #' # Paths to spectra files
253: #' # Paths to spectra files
286: # filepath
287: setGeneric("filepath", function(object, ...) standardGeneric("filepath"))
288: #' filepath accessor
290: #' @return (str) A character vector of file paths, of length number of spectra
293: #' @aliases filepath
300: #' # Paths to spectra files
319: #' filepath(annotation)
324: setMethod("filepath", "peakPantheRAnnotation", function(object) {
325:     object@filepath
343: #' # Paths to spectra files
386: #' # Paths to spectra files
430: #' # Paths to spectra files
472: #' # Paths to spectra files
512: #' # Paths to spectra files
552: #' # Paths to spectra files
593: #' # Paths to spectra files
636: #' # Paths to spectra files
695: #' # Paths to spectra files
742: #' # Paths to spectra files
788: #' # Paths to spectra files
817: #' nbSamples accessor established on filepath
828: #' # Paths to spectra files
852:     return(length(object@filepath))
868: #' # Paths to spectra files
913: #' # Paths to spectra files
946:     nbSample <- length(object@filepath)
953:         rownames(tmpAnnotation) <- object@filepath
961:         rownames(tmpAnnotation) <- object@filepath
977:     rownames(tmpAnnotation) <- object@filepath
1000: #' # Paths to spectra files
1041: #' filename accessor by spliting filepath
1052: #' # Paths to spectra files
1134:         FIR = .FIR, uROI = .uROI, filepath = .filepath,
1214: #' # Paths to spectra files
1398: #' # Paths to spectra files
1416: #' savePath        <- tempdir()
1419: #' outputAnnotationParamsCSV(emptyAnnotation, saveFolder=savePath, verbose=TRUE)
1488: #' # Paths to spectra files
1627: #' # Paths to spectra files
1652: #' savePath1       <- tempdir()
1653: #' outputAnnotationDiagnostic(annotation, saveFolder=savePath1, savePlots=FALSE,
1771: #' # Paths to spectra files
1796: #' savePath1       <- tempdir()
1797: #' outputAnnotationResult(annotation, saveFolder=savePath1,
1867:     tmp_outSpecMeta <- data.frame(filepath = tmp_filepath,
1941: #' the slots (\code{filepath} (from \code{spectraPaths}), \code{ROI},
1947: #' @param spectraPaths NULL or a character vector of spectra file paths, to set
1972: #' (\code{cpdID}, \code{cpdName}, \code{ROI}, \code{filepath}, \code{TIC},
1984: #' # Paths to spectra files
2188:             message("  Previous \"filepath\" value kept")
2415: #' # Paths to spectra files
80: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
95: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
121: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
136: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
162: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
177: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
208: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
223: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
255: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
270: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
302: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
317: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
345: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
360: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
388: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
403: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
432: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
447: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
474: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
489: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
514: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
529: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
554: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
569: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
595: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
610: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
638: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
653: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
697: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
712: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
744: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
759: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
790: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
805: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
830: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
845: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
870: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
885: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
915: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
930: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1002: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1017: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1054: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1069: #' annotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1216: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1231: #' emptyAnnotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1412: #' emptyAnnotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1490: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1505: #' emptyAnnotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1629: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1644: #' emptyAnnotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1773: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
1788: #' emptyAnnotation <- peakPantheRAnnotation(spectraPaths=spectraPaths,
1931:     function(previousAnnotation, spectraPaths = NULL, targetFeatTable = NULL,
1939: #' \code{spectraPaths}) or compounds (\code{targetFeatTable}) are passed, the
1986: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
2000: #' smallAnnotation  <- peakPantheRAnnotation(spectraPaths=spectraPaths, 
2011: #' newSpectraPaths  <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
2015: #'                                     spectraPaths=newSpectraPaths,
2026:     function(previousAnnotation, spectraPaths, targetFeatTable, uROI, FIR,
2042:     # spectraPaths, spectraMetadata
2043:     resSpectra <- resetAnnot_spectraPathMetadata(previousAnnotation,
2044:                                         spectraPaths, spectraMetadata, verbose)
2061:     # Create new object In all case (old or new value) spectraPaths and
2063:     peakPantheRAnnotation(spectraPaths = .spectraPaths,
2181: # resetAnnotation spectraPaths, spectraMetadata
2185:     if (all(is.null(spectraPaths))) {
2208:         .spectraPaths <- spectraPaths
2210:             message("  New \"spectraPaths\" value set")
2229:     return(list(spectraPaths = .spectraPaths,
2417: #' spectraPaths <- c(system.file('cdf/KO/ko15.CDF', package = 'faahKO'),
2431: #' smallAnnotation  <- peakPantheRAnnotation(spectraPaths=spectraPaths,
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_")
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"),
scde:R/functions.R: [ ]
5439:             path <- env[['PATH_INFO']]
6044:             path <- env[['PATH_INFO']]
2147:                 pathsizes <- unlist(tapply(vi, gcll, length))
5059: pathway.pc.correlation.distance <- function(pcc, xv, n.cores = 10, target.ndf = NULL) {
6173:                        pathcl <- ifelse(is.null(req$params()$pathcl), 1, as.integer(req$params()$pathcl))
1877: pagoda.pathway.wPCA <- function(varinfo, setenv, n.components = 2, n.cores = detectCores(), min.pathway.size = 10, max.pathway.size = 1e3, n.randomizations = 10, n.internal.shuffles = 0, n.starts = 10, center = TRUE, batch....(55 bytes skipped)...
5558: t.view.pathways <- function(pathways, mat, matw, env, proper.names = rownames(mat), colcols = NULL, zlim = NULL, labRow = NA, vhc = ...(145 bytes skipped)...
5684: pagoda.show.pathways <- function(pathways, varinfo, goenv = NULL, n.genes = 20, two.sided = FALSE, n.pc = rep(1, length(pathways)), colcols = NULL, zlim = NULL, showRowLabels = FALSE, cexCol = 1, cexRow = 1, nstarts = 10, ce...(117 bytes skipped)...
5698: c.view.pathways <- function(pathways, mat, matw, goenv = NULL, batch = NULL, n.genes = 20, two.sided = TRUE, n.pc = rep(1, length(pathways)), colcols = NULL, zlim = NULL, labRow = NA, vhc = NULL, cexCol = 1, cexRow = 1, nstarts = 50, ...(93 bytes skipped)...
461: ##' @param name URL path name for this app
5443:             switch(path,
6047:             switch(path,
1: ##' Single-cell Differential Expression (with Pathway And Gene set Overdispersion Analysis)
6: ##' The scde package also contains the pagoda framework which applies pathway and gene set overdispersion analysis
9: ##' See vignette("pagoda") for a brief tutorial on pathway and gene set overdispersion analysis to identify and characterize cell subpopulations.
1292: ...(39 bytes skipped)...lowed for the estimated adjusted variance (capping of adjusted variance is recommended when scoring pathway overdispersion relative to randomly sampled gene sets)
1789: ##' such as ribosomal pathway variation) and subtracts it from the data so that it is controlled
1815: ##' cc.pattern <- pagoda.show.pathways(ls(go.env)[1:2], varinfo, go.env, show.cell.dendrogram = TRUE, showRowLabels = TRUE)  # Look at...(30 bytes skipped)...
1845: ##' @param min.pathway.size minimum number of observed genes that should be contained in a valid gene set
1846: ##' @param max.pathway.size maximum number of observed genes in a valid gene set
1847: ...(103 bytes skipped)...ith each gene set (can be kept at 5 or 10, but should be increased to 50-100 if the significance of pathway overdispersion will be determined relative to random gene set models)
1873: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
1901:         gsl <- gsl[gsl.ng >= min.pathway.size & gsl.ng<= max.pathway.size]
1905:         message("processing ", length(gsl), " valid pathways")
1954: ##' @param pwpca result of the pagoda.pathway.wPCA() call with n.randomizations > 1
1965: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2148:                 names(pathsizes) <- pathsizes
2151:                     rsdv <- unlist(lapply(names(pathsizes), function(s) {
2156:                     return(data.frame(n = as.integer(pathsizes), var = unlist(sdv), round = i, rvar = rsdv))
2160:                 data.frame(n = as.integer(pathsizes), var = unlist(sdv), round = i)
2216: ##' @param pwpca output of pagoda.pathway.wPCA()
2242: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2393:     # determine genes driving significant pathways
2435: ##' @param pwpca output of pagoda.pathway.wPCA()
2453: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2460:     pclc <- pathway.pc.correlation.distance(c(pwpca, clpca$cl.goc), tam$xv, target.ndf = 100, n.cores = n.cores)
2521: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2603: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2654: ##' @param tamr Combined pathways that show similar expression patterns. Output of \code{\link{pagoda.reduce.redundancy}}
2655: ##' @param row.clustering Dendrogram of combined pathways clustering
2667: ##' pwpca <- pagoda.pathway.wPCA(varinfo, go.env, n.components=1, n.cores=10, n.internal.shuffles=50)
2724: ##' @param tamr Combined pathways that show similar expression patterns. Output of \code{\link{pagoda.reduce.redundancy}}
2725: ##' @param tam Combined pathways that are driven by the same gene sets. Output of \code{\link{pagoda.reduce.loading.redundancy}}...(0 bytes skipped)...
2728: ...(15 bytes skipped)...a Weighted PC magnitudes for each gene set provided in the \code{env}. Output of \code{\link{pagoda.pathway.wPCA}}
2732: ##' @param row.clustering Dendrogram of combined pathways clustering. Default NULL.
2733: ##' @param title Title text to be used in the browser label for the app. Default, set as 'pathway clustering'
2739: ...(47 bytes skipped)... env, pwpca, clpca = NULL, col.cols = NULL, cell.clustering = NULL, row.clustering = NULL, title = "pathway clustering", zlim = c(-1, 1)*quantile(tamr$xv, p = 0.95)) {
2764:     # prepare pathway df
3559: .onUnload <- function(libpath) {
3560:     library.dynam.unload("scde", libpath, verbose = TRUE)
5108:         #set scale at top pathway?
5560:     lab <- which(proper.names %in% na.omit(unlist(mget(pathways, envir = env, ifnotfound = NA))))
5564:         lab <- which(proper.names %in% pathways)
5569:     #table(rownames(mat) %in% mget(pathways, envir = env))
5660: ##' View pathway or gene weighted PCA
5662: ##' Takes in a list of pathways (or a list of genes), runs weighted PCA, optionally showing the result.
5663: ##' @param pathways character vector of pathway or gene names
5665: ##' @param goenv environment mapping pathways to genes
5668: ...(5 bytes skipped)...param n.pc optional integer vector giving the number of principal component to show for each listed pathway
5681: ##' @param ... additional arguments are passed to the \code{c.view.pathways}
5687:     x <- c.view.pathways(pathways, varinfo$mat, varinfo$matw, goenv, batch = varinfo$batch, n.genes = n.genes, two.sided = two.si...(213 bytes skipped)...
5695: # takes in a list of pathways with a list of corresponding PC numbers
5696: # recalculates PCs for each individual pathway, weighting gene loading in each pathway and then by total
5697: # pathway variance over the number of genes (rough approximation)
5699:     # are these genes or pathways being passed?
5701:         x <- pathways %in% ls(goenv)
5703:         x <- rep(FALSE, length(pathways))
5705:     if(sum(x) > 0) { # some pathways matched
5707:         message("WARNING: partial match to pathway names. The following entries did not match: ", paste(pathways[!x], collapse = " "))
5709:         # look up genes for each pathway
5710:         pathways <- pathways[x]
5711:         p.genes <- mget(pathways, goenv, ifnotfound = NA)
5713:         x <- pathways %in% rownames(mat)
5716: ...(9 bytes skipped)...       message("WARNING: partial match to gene names. The following entries did not match: ", paste(pathways[!x], collapse = " "))
5718:             p.genes <- list("genes" = pathways[x])
5719:             pathways <- c("genes");
5720:         } else { # neither genes nor pathways are passed
5721:             stop("ERROR: provided names do not match either gene nor pathway names (if the pathway environment was provided)")
5728:     # recalculate wPCA for each pathway
5729:     ppca <- pagoda.path...(130 bytes skipped)...s), n.cores = 1, n.randomizations = 0, n.starts = 2, n.components = max(n.pc), verbose = FALSE, min.pathway.size = 0, max.pathway.size = Inf, n.internal.shuffles = 0)
5731:     if(length(ppca) > 1) { # if more than one pathway was supplied, combine genes using appropriate loadings and use consensus PCA (1st PC) as a patte...(2 bytes skipped)...
5733:         scaled.gene.loadings <- unlist(lapply(seq_along(pathways), function(i) {
5734:             gl <- ppca[[pathways[i]]]$xp$rotation[, n.pc[i], drop = TRUE]*as.numeric(ppca[[pathways[i]]]$xp$sd)[n.pc[i]]/sqrt(ppca[[pathways[i]]]$n)
5735:             names(gl) <- rownames(ppca[[pathways[i]]]$xp$rotation)
5777:     } else { # only one pathway was provided
5970: ##' @field results Output of the pathway clustering and redundancy reduction
5972: ##' @field pathways
5983:     fields = c('results', 'genes', 'pathways', 'mat', 'matw', 'goenv', 'renv', 'name', 'trim', 'batch'),
5986:         initialize = function(results, pathways, genes, mat, matw, goenv, batch = NULL, name = "pathway overdispersion", trim = 1.1/ncol(mat)) {
5995:             pathways <<- pathways
6012:                 gcl <- t.view.pathways(genes, mat = mat, matw = matw, env = goenv, vhc = results$hvc, plot = FALSE, trim = ltrim)
6058: ...(21 bytes skipped)...                <link rel = "stylesheet" type = "text/css" href = "http://pklab.med.harvard.edu/sde/pathcl.css" / >
6064: ...(10 bytes skipped)...                           <script type = "text/javascript" src = "http://pklab.med.harvard.edu/sde/pathcl.js" > </script >
6072:                    '/pathcl.json' = { # report pathway clustering heatmap data
6126:                    '/pathwaygenes.json' = { # report heatmap data for a selected set of genes
6133:                        x <- c.view.pathways(gsub("^#PC\\d+# ", "", pws), mat, matw, goenv = goenv, n.pc = n.pcs, n.genes = ngenes, two.side...(75 bytes skipped)...
6134:                        #x <- t.view.pathways(gsub("^#PC\\d+# ", "", pws), mat, matw, env = goenv, vhc = results$hvc, plot = FALSE, trim = lt...(14 bytes skipped)...
6174:                        ii <- which(results$ct == pathcl)
6251:                    '/pathways.json' = {
6252:                        lgt <- pathways
snapcount:R/basic_query_functions.R: [ ]
273:     path <- paste(compilation, paste0(endpoint, "?"), sep = "/")
319:     paste0(pkg_globals$snaptron_host, path, paste(query, collapse = "&"))
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")
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)
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", 
crlmm:R/cnrma-functions.R: [ ]
42: 	path <- system.file("extdata", package=pkgname)
1391: 	path <- system.file("extdata", package=pkgname)
43: 	##multiple.builds <- length(grep("hg19", list.files(path)) > 0)
44: 	snp.file <- list.files(path, pattern="snpProbes_hg")
47: 		snp.file <- list.files(path, pattern="snpProbes.rda")
51: 			snp.file <- list.files(path, pattern="snpProbes_hg")
61: ##		load(file.path(path, "snpProbes.rda"))
62: ##	} else load(file.path(path, paste("snpProbes_", genome, ".rda", sep="")))
63: 	load(file.path(path, snp.file))
71: 		load(file.path(path, cn.file))
73: 		##			load(file.path(path, "cnProbes.rda"))
74: 		##		} else load(file.path(path, paste("cnProbes_", genome, ".rda", sep="")))
1392: 	load(file.path(path, "cnProbes.rda"))
1393: 	load(file.path(path, "snpProbes.rda"))
1465: 				   path,
1468: 	load(file.path(path, "snpFile.rda"))
1470: 	load(file.path(path, "cnFile.rda"))
PloGO2:inst/script/WGCNA_proteomics.R: [ ]
106: path <- system.file("files", package="PloGO2")
107: allDat = read.csv(file.path(path,"rice.csv") )
108: Group = read.csv(file.path(path, "group_rice.csv") ) [,2]
megadepth:R/install.R: [ ]
146:         path <- Sys.getenv("APPDATA", "")
175:         path <- file.path(d, exec)
206:     path <- NULL # cache the path to megadepth
182:     path2 <- Sys.which(cmd)
143: bin_paths <- function(dir = "Megadepth",
15: #' found via the environment variable \code{PATH}.
17: #' If you want to install Megadepth to a custom path, you can set the global
35: #' @importFrom xfun is_windows is_macos same_path
75:     exec <- file.path(tempdir(), exec_name)
144:     extra_path = getOption("megadepth.dir")) {
147:         path <- if (fs::dir_exists(path)) {
148:             file.path(path, dir)
151:         path <- "~/Library/Application Support"
152:         path <- if (fs::dir_exists(path)) file.path(path, dir)
153:         path <- c("/usr/local/bin", path)
155:         path <- c("~/bin", "/snap/bin", "/var/lib/snapd/snap/bin")
157:     path <- c(extra_path, path, pkg_file(dir, mustWork = FALSE))
159:     path <- path[path != ""]
162:         path <- c(tempdir(), path)
164:     path
167: # find an executable from PATH, APPDATA, system.file(), ~/bin, etc
176:         if (utils::file_test("-x", path)) {
179:             path <- ""
183:     if (path == "" || xfun::same_path(path, path2)) {
184:         if (path2 == "") {
187:         return(cmd) # do not use the full path of the command
189:         if (path2 != "") {
194:                 path,
196:                 path2,
202:     normalizePath(path)
208:         if (is.null(path)) {
209:             path <<- find_exec(
215:         path
109:     dirs <- bin_paths()
139:     message("megadepth has been installed to ", normalizePath(destdir))
158:     # remove empty paths potentially created by pkgfile
169:     for (d in bin_paths(dir)) {
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
TIN:R/correlationPlot.R: [ ]
104:     path<-getwd()
105:     cat("Plot was saved in ",paste(path,"/",fileName,sep=""),"\n")
MetaboSignal:R/General_internal_functions.R: [ ]
185:     path = all_paths[maxBW, ]
140:     path_individual = as.character(row)
278: path_as_network = function(path) {
123:   shortpath = rownames(as.matrix(unlist(ASP)))
347:     pathM = convertTable(response)
122: ASP_paths = function (ASP) {
360:     all_pathsGM_names = all_pathsGM
341: MS_FindPathway = function(match = NULL, organism_code = NULL) {
141:     BW = sapply(path_individual, get_bw_score, BW_matrix)
180:     ## Get global BW score for each path
186:     path = as.character(path)
187:     all_paths = matrix(path, ncol = length(path))
277: ##################### path_as_network ######################
280:     for (i in 1:(length(path) - 1)) {
281:         edge = c(path[i], path[i + 1])
348:     colnames(pathM) = c("path_ID", "path_Description")
17: #metabolite is a substrate. It is used to calculate shortest paths with SP mode.
121: ####################### ASP_paths #######################
124:   return(shortpath)
150: BW_ranked_SP = function (all_paths, BW_matrix, networkBW_i, mode) {
152:     all_nodes = unique(as.vector(all_paths))
181:     Global_BW_score = sapply (split(all_paths, row(all_paths)), get_global_BW_score,
189:     return(all_paths)
342:     file = paste("http://rest.kegg.jp/list/pathway/", organism_code, sep = "")
345:         stop("A valid organism_code is required for KEGG_entry = pathway")
349:     rownames(pathM) = NULL
351:         target_matrix = pathM
352:         target_column = pathM[, 2]
355:     } else (return(pathM))
359: network_names = function(all_pathsGM, organism_code) {
361:     all_nodes = unique(as.vector(all_pathsGM[, 1:2]))
365:         all_pathsGM_names[all_pathsGM_names == all_nodes[i]] = all_names[i]
367:     return(all_pathsGM_names)
340: #################### MS_FindPathway ####################
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, 
Rqc:R/utils.R: [ ]
94:     path <- dirname(file)
99:     data.frame(filename, pair, format, group, reads, total.reads, path, 
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)...
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)
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) {
898:     cssPath <- system.file(file.path("css", paste(cssName, ".in", sep="")),
917:     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
659:         packagesFile <- file.path(reposRootPath, cPath, "PACKAGES")
662:                     file.path(reposRootPath, cPath),
663:                     "\nSkipping this contrib path.")
674:                     file.path(reposRootPath, cPath),
675:                     "\nSkipping this contrib path.")
691:     ## Add vignette path info
782:                    desc <- tools:::.read_description(file.path(meatPath, missing_pkgs[i], "DESCRIPTION"))
857:     viewsFile <- file.path(reposRoot, "VIEWS")
892:     writePackageDetailHtml(pkgList, file.path(reposRoot, "html"),
900:     res <- try(copySubstitute(cssPath, file.path(reposRoot, cssName),
911:         f <- file.path(htmlDir, htmlFilename(pkg))
919:     res <- try(copySubstitute(cssPath, file.path(htmlDir, cssName),
934:     f <- file.path(reposRoot, htmlFilename(repos))
939:     con <- file(file.path(dir, "SYMBOLS"), open="w")
963:         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)
657:             paste(cPath, "/", pkgs, "_", vers, ext, sep="")
682:         dbMat[dbMatIdx, col] <- buildPkgPath(cDat[cDatGood, "Package"],
692:     vigs <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "pdf")
693:     vtitles <- getDocumentTitles(vigs, reposRootPath=reposRootPath, fun=getPdfTitle)
695:     rfiles <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "R")
697:     htmlDocs <- getFileLinks(dbMat[, "Package"], reposRootPath, vignette.dir, "html", TRUE)
699:     htmlTitles <- getDocumentTitles(htmlDocs, ext="html", src=c("Rmd", "Rhtml"), reposRootPath, getHtmlTitle)
716:     readmes <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "readmes", "README")
717:     news <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "news", "NEWS")
718:     install <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "install", "INSTALL")
719:     license <- getFileExistsAttr(dbMat[, "Package"], reposRootPath, "licenses",
779:             if (!is.na(meatPath)){
822:     .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=", ")
MOGAMUN:R/MOGAMUN_FUN.R: [ ]
1232:     for (Path in Dirs) {
1233:         PathForPlots <- ExperimentsPath <- paste0(Path, "/") # path for plots
1659:     GeneralPath <- ExperimentDir
1666:         ExpPath <- paste0(GeneralPath, "/", d, "/")
1289:     # get all files in the path that match the pattern
1763: #         ExperimentsPath - path to the results
1234:         Population <- GetIndividualsAllRuns(ExperimentsPath) # get results
1249:             SimilarityBetweenRunsBoxplot(PathForPlots, Nodes1stRank_AllRuns)
1253:         AccPF <- ObtainAccParetoFront(PathForPlots, Inds1stRank_AllRuns, 
1258:         FilterNetworks(ExperimentsPath, LoadedData, AccPF) 
1265:         SaveFilteredAccPF(DiversePopulation, ExperimentsPath, Threshold) 
1278: # INPUT:  ExperimentsPath - folder containing the results to be processed 
1280: GetIndividualsAllRuns <- function(ExperimentsPath) {
1290:     ResFiles <- list.files(ExperimentsPath, pattern = PatResFiles)
1295:         con <- base::file(paste0(ExperimentsPath, ResFiles[counter]), open="r")
1328: # INPUTS: PathForPlots - folder to save the plot
1331: SimilarityBetweenRunsBoxplot <- function(PathForPlots, Nodes1stRank_AllRuns) {
1362:     svg(paste0(PathForPlots, "A_Boxplot_similarities_between_runs.svg"))
1372: # INPUTS: PathForPlots - folder to save the plot
1378: ObtainAccParetoFront <- function(PathForPlots, Inds1stRank_AllRuns, 
1389:         svg(paste0(PathForPlots, "A_ScatterPlot_AccPF_ALL_INDS.svg"))
1397:         svg(paste0(PathForPlots, "A_ScatterPlot_AccPF_LEGEND_ALL_INDS.svg"))
1409:     svg(paste0(PathForPlots, "A_ScatterPlot_AccPF.svg"))
1466: # INPUTS: ExperimentsPath - folder to save the filtered networks
1471: FilterNetworks <- function(ExperimentsPath, LoadedData, AccPF) {
1495:         write.table(MyFilteredNetwork, file = paste0(ExperimentsPath, 
1501:     myDataFiles <- list.files(ExperimentsPath, pattern = '_FILTERED.csv')
1508:         data <- read.table(paste0(ExperimentsPath, myDataFiles[i]), 
1516:     write.table(myFullListOfInteractions, file = paste0(ExperimentsPath, 
1614: #         ExperimentsPath - folder to save the filtered networks
1617: SaveFilteredAccPF <- function(DiversePopulation, ExperimentsPath, Threshold) {
1621:         write(paste(Ind, collapse=" ", sep=""), file = paste0(ExperimentsPath, 
1643:     write.csv(AllNodesDF_Acc, paste0(ExperimentsPath, 
1662:     Dirs <- list.dirs(GeneralPath, recursive = FALSE, full.names = FALSE)
1669:         Network <- read.csv( paste0(ExpPath, 
1698:         CreateActiveModules(d, ExpPath)
1703:                 filename = paste0(ExpPath, "A_Acc_PF_", d))
1704:         } else { saveSession(filename = paste0(ExpPath, "A_Acc_PF_", d)) }
1765: CreateActiveModules <- function(d, ExperimentsPath) {
1772:         read.csv(paste0(ExperimentsPath, list.files(ExperimentsPath,
1799: MogamunBody <- function(RunNumber, LoadedData, BestIndsPath) {
1800:     BestIndsFile <- paste0(BestIndsPath, "_Run_", RunNumber, ".txt")
1829:         file = paste0(BestIndsPath,"StatisticsPerGeneration_Run", RunNumber, 
DMRforPairs:R/functions.R: [ ]
457:     path = "figures"
450:     dir.create(file.path(getwd(), experiment.name))
452:     dir.create(file.path(paste(getwd(), experiment.name, sep = "/"), 
456:     setwd(file.path(getwd(), experiment.name))
485:                 path = path)
487:             tested$Figure[cr] = paste("<a href=\"./", path, "/", 
490:             tested$Statistics[cr] = paste("<a href=\"./", path, "/", 
493:             write.table(file = paste("./", path, "/", tested$regionID[cr], 
507:                 scores = FALSE, path = path)
509:             tested$Figure[cr] = paste("<a href=\"./", path, "/", 
512:             tested$Statistics[cr] = paste("<a href=\"./", path, "/", 
519:             write.table(file = paste("./", path, "/", tested$regionID[cr], 
533:                 scores = FALSE, path = path)
539:             tested$Figure[cr] = paste("<a href=\"./", path, "/", 
542:             tested$Statistics[cr] = paste("<a href=\"./", path, "/", 
545:             write.table(file = paste("./", path, "/", tested$regionID[cr], 
606:             path, "/", tested_4html_selected$ID, ".png\" height=\"63\" width=\"125\">", 
624:             path, "/", tested_4html_selected$ID, ".png\" height=\"63\" width=\"125\">", 
639:     regionID, clr = NA, annotate = TRUE, scores = TRUE, path) {
642:     path = paste("./", path, "/", sep = "")
651:         clr = clr, annotate = annotate, scores = scores, path = path)
656:     annotate = TRUE, path) {
659:     path = paste("./", path, "/", sep = "")
673:             annotate = annotate, scores = TRUE, path = path)
679:     ID = "CustomRegion", clr = NA, annotate = TRUE, path) {
680:     path = paste("./", path, "/", sep = "")
693:             annotate = annotate, scores = TRUE, path = path)
699:     ID = NA, clr = NA, annotate = TRUE, scores = NA, path) {
730:     png(paste(path, ID, ".png", sep = ""), width = 500, height = 250)
750:     pdf(paste(path, ID, ".pdf", sep = ""), width = 10, height = 10)
ACE:R/ACE.R: [ ]
134: 		  readCounts <- QDNAseq::binReadCounts(bins, path = inputdir)
960:         if (dirname(filename)==".") {newpath <- file.path(outputdir,filename)}
131: 		  currentdir <- file.path(outputdir,paste0(b,"kbp"))
136: 		    saveRDS(readCounts, file = file.path(outputdir, paste0(b, "kbp-raw.rds")))
146: 		  saveRDS(copyNumbersSegmented, file = file.path(outputdir,paste0(b,"kbp.rds")))
157: 			currentdir <- file.path(outputdir,paste0(substr(files[f],0,nchar(files[f])-4)))
159: 			copyNumbersSegmented <- readRDS(file.path(inputdir,files[f]))
166: 	write.table(parameters, file=file.path(outputdir,"parameters.tsv"), quote = FALSE, sep = "\t", na = "", row.names = FALSE)
182: 	  qdir <- file.path(currentdir,paste0(q,"N"))
189:   	dir.create(file.path(qdir,"likelyfits"))  
258:   		fp <- file.path(qdir,pd$name[a])
263:   		dir.create(file.path(fp,"graphs"))
284:   		imagefunction(file.path(fp,paste0(pd$name[a],"_errorlist.",imagetype)))
320:   		  fn <- file.path(fp,"graphs",paste0(pd$name[a], " - ",q,"N fit ", m, ".",imagetype))
348:   		      imagefunction(file.path(qdir,"likelyfits",paste0(pd$name[a],"_bestfit_",q,"N.",imagetype)),width=10.5)
350:   		      imagefunction(file.path(qdir,"likelyfits",paste0(pd$name[a],"_bestfit_",q,"N.",imagetype)),width=720)
358:   		      imagefunction(file.path(qdir,"likelyfits",paste0(pd$name[a],"_lastminimum_",q,"N.",imagetype)),width=10.5)
360:   		      imagefunction(file.path(qdir,"likelyfits",paste0(pd$name[a],"_lastminimum_",q,"N.",imagetype)),width=720)
377:   		  pdf(file.path(fp,paste0("summary_",pd$name[a],".pdf")),width=10.5)
382:   		    imagefunction(file.path(fp,paste0("summary_",pd$name[a],".",imagetype)), width = 720)
386:     		  imagefunction(file.path(fp,paste0("summary_",pd$name[a],".",imagetype)), width = 2160, height = 480*ceiling(length(plots)/3...(3 bytes skipped)...
399:     	  pdf(file.path(qdir,"summary_likelyfits.pdf"),width=10.5)
402:       	pdf(file.path(qdir,"summary_errors.pdf"))
406:     	  imagefunction(file.path(qdir,paste0("summary_likelyfits.",imagetype)), width = 2160, height = 480*length(pd$name))
409:       	imagefunction(file.path(qdir,paste0("summary_errors.",imagetype)), width = 1920, height = 480*ceiling(length(pd$name)/4))
415:   	    pdf(file.path(qdir,"summary_errors.pdf"))
419:   	    imagefunction(file.path(qdir,paste0("summary_errors.",imagetype)), width = 1920, height = 480*ceiling(length(pd$name)/4))
425:   	write.table(fitpicker, file=file.path(qdir,paste0("fitpicker_",q,"N.tsv")), quote = FALSE, sep = "\t", na = "", row.names = FALSE)
830: # frequency in percentage). It can also be a file path to a tab-delimited
832: # by getadjustedsegments. Again, this can be either a data frame or a file path
1003:       copyNumbersSegmented <- readRDS(file.path(inputdir,files[1]))
1005:     if(missing(modelsfile)){models <- try(read.table(file.path(inputdir,"models.tsv"), header = TRUE, comment.char = "", sep = "\t"))
1009:       if (dir.exists(file.path(inputdir,"variantdata"))) {
1010:         variantdata <- file.path(inputdir,"variantdata")
1072:           if (!dir.exists(file.path(outputdir,"newplots"))) {dir.create(file.path(outputdir,"newplots"))}
1074:             imagefunction(file.path(outputdir,"newplots",paste0(pd$name[a],".",imagetype)),width=10.5)
1078:             imagefunction(file.path(outputdir,"newplots",paste0(pd$name[a],".",imagetype)), width=720)
1091:           variantfile <- file.path(variantdata,paste0(prefix,pd$name[a],postfix,varext))
1092:           folder <- file.path(outputdir,"variantdata")
1104:           if (!dir.exists(file.path(outputdir,"segmentfiles"))) {dir.create(file.path(outputdir,"segmentfiles"))}
1105:           fn <- file.path(outputdir,"segmentfiles",paste0(pd$name[a],"_segments.",segext))
961:         else {newpath <- sub(dirname(filename),outputdir,filename)}
962:         fn <- gsub(".csv","_ACE.csv",newpath)
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)))
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
epivizrStandalone:R/startStandalone.R: [ ]
95:                               path=paste0("/", index_file), 
217:   path <- NULL
92:   server <- epivizrServer::createServer(static_site_path = webpath, non_interactive=non_interactive, ...)
219:   server <- epivizrServer::createServer(static_site_path = webpath, non_interactive=non_interactive, ...)
84:   webpath <- system.file("www", package = "epivizrStandalone")
215:   webpath <- ""
222:                               path=path, 
ISAnalytics:R/internal-functions.R: [ ]
1379:             path = project_folder, recurse = TRUE,
1837:                 path = association_file,
3648:                                 path = report_path,
1322:     path_cols <- .path_cols_names()
2246:     path_col_names <- .path_cols_names()
1618:     stats_paths <- purrr::pmap_dfr(temp, function(...) {
1706:     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)
1030:     peek_headers <- readr::read_delim(path,
1051:             path = path, additional_cols = additional_cols,
1056:             path = path, additional_cols = additional_cols,
1178: .read_af <- function(path, date_format, delimiter) {
1181:     file_ext <- .check_file_extension(path)
1195:         headers_peek <- readr::read_delim(path,
1203:         headers_peek <- readxl::read_excel(path, n_max = 0)
1224:             df <- readr::read_delim(path,
1234:             df <- readxl::read_excel(path,
1302: # - root_folder: Path to the root folder
1305: # ProjectID - ConcatenatePoolIDSeqRun - PathToFolderProjectID - Found - Path -
1306: # Path_quant - Path_iss (NOTE: headers are dynamic!)
1330:                 fs::path(
1331:                     fs::path(root_folder),
1342:             !!path_cols$project := NA_character_,
1343:             !!path_cols$quant := NA_character_,
1344:             !!path_cols$iss := NA_character_
1348:         project_folder <- fs::path(
1349:             fs::path(root_folder),
1353:             paste0(fs::path(
1355:                 fs::path(cur[[concat_pool_col]])
1371:             paste0(fs::path(
1373:                 fs::path(cur[[concat_pool_col]])
1387:             path = project_folder, recurse = TRUE,
1397:                     !!path_cols$project := project_folder,
1398:                     !!path_cols$quant := quant_found,
1399:                     !!path_cols$iss := iss_found
1430: .manage_association_file <- function(af_path,
1440:         path = af_path,
1571: # Finds automatically the path on disk to each stats file.
1578: # Path_iss (or designated dynamic name), stats_files, info
1583:     path_iss_col) {
1586:             dplyr::all_of(c(proj_col, pool_col, path_iss_col))
1594:     if (all(is.na(temp[[path_iss_col]]))) {
1601:         if (is.na(temp_row[[path_iss_col]])) {
1609:         files <- fs::dir_ls(temp_row[[path_iss_col]],
1691: # - path_iss_col: name of the column that contains the path
1700:     path_iss_col,
1710:         path_iss_col = path_iss_col
1829: .pre_manage_af <- function(association_file, import_af_args, report_path) {
1830:     if (!is.null(report_path) && !fs::is_dir(report_path)) {
1831:         report_path <- fs::path_dir(report_path)
1833:     ## Import association file if provided a path
1838:                 report_path = report_path,
1844:     if (!.path_cols_names()$quant %in% colnames(association_file)) {
1845:         rlang::abort(.af_missing_path_error(.path_cols_names()$quant),
1846:             class = "missing_path_col"
1850:         dplyr::filter(!is.na(.data[[.path_cols_names()$quant]]))
2235: #' @importFrom fs dir_ls as_fs_path
2251:             .data[[path_col_names$quant]]
2274:             matches <- fs::dir_ls(temp_row[[path_col_names$quant]],
2321: # @param dupl The tibble containing quantification types and path to the files
2369: # * Removing files not found (files for which Files_count$Found == 0 and Path
2546: #' @importFrom fs as_fs_path
2585:                     dplyr::mutate(Files_found = fs::as_fs_path(
2605:                     dplyr::mutate(Files_found = fs::as_fs_path(
2687: # * Removing files not found (files for which Files_count$Found == 0 and Path
2870:             list(path = x),
3587:     report_path) {
3634:                         fs::dir_create(report_path)
3664:                                 path = report_path,
4056: # @param file_path The file path as a string
4057: #' @importFrom fs dir_create path_wd path
4062: .write_recalibr_map <- function(map, file_path) {
4063:     if (!fs::file_exists(file_path)) {
4064:         ext <- fs::path_ext(file_path)
4067:             fs::dir_create(file_path)
4069:             tmp_filename <- fs::path(file_path, gen_filename)
4071:             tmp_filename <- fs::path_ext_remove(file_path)
4073:                 ext <- paste(fs::path_ext(tmp_filename), ext, sep = ".")
4074:                 tmp_filename <- fs::path_ext_remove(tmp_filename)
4092:     } else if (fs::is_dir(file_path)) {
4094:         tmp_filename <- fs::path(file_path, gen_filename)
4096:         tmp_filename <- file_path
4701:                 x = "Did you provide the correct path?"
4718:                 x = "Did you provide the correct path?"
549: # Returns the file format for each of the file paths passed as a parameter.
1313:         rlang::abort(.af_missing_pathfolder_error(proj_fold_col))
1413: # containing paths to project folder, quant folders and iss folders
1593:     # If paths are all NA return
1673:     stats_paths
1705:     # Obtain paths
1712:     stats_paths <- stats_paths %>%
1714:     if (all(is.na(stats_paths$stats_files))) {
1715:         stats_paths <- stats_paths %>%
1721:         return(list(stats = NULL, report = stats_paths))
1731:             tasks = length(stats_paths$stats_files),
1737:             tasks = length(stats_paths$stats_files),
1760:         BiocParallel::bplapply(stats_paths$stats_files,
1776:     stats_paths <- stats_paths %>%
1778:     stats_paths <- purrr::pmap_dfr(stats_paths, function(...) {
1795:     stats_paths <- stats_paths %>%
1797:     stats_dfs <- stats_dfs[stats_paths$Imported]
1800:         return(list(stats = NULL, report = stats_paths))
1807:     list(stats = stats_dfs, report = stats_paths)
2850: # @param files Files_found table where absolute paths of chosen files
ribor:R/helper_functions.R: [ ]
163:     path  <- path(ribo.object)
66:     ribo.path <- ribo
11: #' file.path <- system.file("extdata", "HEK293_ingolia.ribo", package = "ribor")
12: #' sample <- Ribo(file.path)
18:     return(h5read(path(ribo.object),
25:     row.names <- h5read(path(ribo.object),
27:     lengths   <- h5read(path(ribo.object),
50: #' @param ribo a path to the ribo file or a 'Ribo' object
58: #' file.path <- system.file("extdata", "HEK293_ingolia.ribo", package = "ribor")
59: #' sample <- Ribo(file.path, rename = rename_default)
65:     #ensure that the ribo path is retrieved
68:         ribo.path <- path(ribo)
73:     original <- h5read(ribo.path, 
113: get_content_info <- function(ribo.path) {
114:     file_info     <- h5ls(ribo.path, recursive = TRUE, all = FALSE)
126:     ls <- h5ls(ribo.path)
135:         attribute      <- h5readAttributes(ribo.path, name)
164:     attribute <- h5readAttributes(path, "/")
264:                             path,
267:     experiment <- strsplit(path, split="/")[[1]][3]
268:     output <- t(h5read(file=file, index=index, name=path))