Skip to content

Commit

Permalink
functions to read names from folder to get the types
Browse files Browse the repository at this point in the history
  • Loading branch information
josura committed Oct 21, 2024
1 parent 73ab551 commit 42b85ae
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion scripts/R/temporalSingleCell/create_input_fluxes_teesside.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,31 @@ for (i in 1:length(moduleIDS)){
edgesList <- moduleInfo %>% select(M_id, C_in, C_out) %>% as.data.frame()
```

# get the list of different graphs from an input folder containing the graphs generated from the pathways

```{r}
# get the list of different graphs from an input folder containing the graphs generated from the pathways
getGraphs <- function(inputFolder){
graphs <- list()
files <- list.files(inputFolder)
types <- sapply(files, function(x) strsplit(x, ".")[[1]][2])
graphNames <- sapply(files, function(x) strsplit(x, ".")[[1]][1])
finalGraphNames <- list()
for (i in 1:length(files)){
file <- files[i]
type <- types[i]
graphName <- graphNames[i]
if (type == "csv"){
finalGraphNames <- c(finalGraphNames, graphName)
}
}
return (finalGraphNames)
}
```

# functions to create the input graph
```{r}
createGraph <- function(edgesList, moduleMapToGeneList){
createGraphs <- function(edgesList, moduleMapToGeneList){
graph <- list()
for (i in 1:nrow(edgesList)){
edge <- edgesList[i,]
Expand Down

0 comments on commit 42b85ae

Please sign in to comment.