Skip to content

Commit

Permalink
dynwrapv2
Browse files Browse the repository at this point in the history
  • Loading branch information
zouter committed Mar 12, 2019
1 parent 0fc17ef commit 9093dc3
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 128 deletions.
47 changes: 26 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
language: r
dist: trusty
bioc_required: true
sudo: true
os:
- linux
- linux
cache:
directories:
- $HOME/.cache # hdf5, singularity
- $HOME/R/Library
- "$HOME/.cache"
- "$HOME/R/Library"
services:
- docker
env:
- CONTAINER=docker
- CONTAINER=singularity
addons:
apt:
packages:
- libssh-dev # PRISM > ssh > libssh-dev
- docker
before_install:
- git clone https://github.com/dynverse/travis_scripts.git
- source travis_scripts/hdf5.sh
- if [ "$CONTAINER" == "singularity" ]; then source travis_scripts/singularity.sh; fi
- openssl aes-256-cbc -K $encrypted_d8a2d8b1d6fc_key -iv $encrypted_d8a2d8b1d6fc_iv
-in credentials.enc -out credentials -d
- source credentials
- source <(curl -sSL https://raw.githubusercontent.com/dynverse/travis_scripts/master/helper.sh)
install:
- R -e 'if ("devtools" %in% rownames(installed.packages())) update.packages(oldPkgs = "devtools", ask = FALSE) else install.packages("devtools")'
- R -e 'devtools::install_github("dynverse/dynwrap", dep = TRUE, upgrade = TRUE)'
- R -e 'devtools::install_github("dynverse/dyntoy", upgrade = TRUE)'
- R -e 'devtools::install_github("dynverse/dyneval", dep = TRUE, upgrade = TRUE)'
- set -e
- update_docker
- install_hdf5
- install_cran remotes
- install_github_withdeps dynverse/dynwrap@singularity3 dynverse/dyntoy
script:
- if [ "$CONTAINER" == "singularity" ]; then source travis_scripts/test_singularity_image.sh; fi
- if [ "$CONTAINER" == "docker" ]; then source travis_scripts/test_docker_image.sh; fi
- source version
- build_docker
- test_docker
after_success:
- push_docker
jobs:
include:
- stage: cache
script:
- echo Do not build or test docker since this is a cache warmup
after_success:
- echo Do not push docker since this is a cache warmup
- stage: build
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM dynverse/dynwrap:r
FROM dynverse/dynwrapr:v0.1.0

RUN R -e 'devtools::install_cran("SLICER")'
ARG GITHUB_PAT

LABEL version 0.1.6
RUN R -e 'devtools::install_cran("SLICER")'

ADD . /code
COPY definition.yml run.R example.h5 /code/

ENTRYPOINT Rscript /code/run.R
ENTRYPOINT ["/code/run.R"]
22 changes: 0 additions & 22 deletions Singularity

This file was deleted.

Binary file added credentials.enc
Binary file not shown.
112 changes: 59 additions & 53 deletions definition.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,68 @@
id: slicer
docker_repository: dynverse/ti_slicer
singularity_collection: 1581
container_url: https://github.com/dynverse/ti_slicer
name: SLICER
source: tool
platform: R
doi: 10.1186/s13059-016-0975-3
google_scholar_cluster_id: '2071780199208319199'
trajectory_types:
- cycle
- linear
- bifurcation
- convergence
- multifurcation
- binary_tree
- tree
- acyclic_graph
- graph
topology_inference: free
license: GPL-2
preprint_date: '2016-04-09'
publication_date: '2016-05-23'
code_url: https://github.com/jw156605/SLICER
method:
id: slicer
name: SLICER
tool_id: slicer
source: tool
platform: R
url: https://github.com/jw156605/SLICER
license: GPL-2
authors:
- given: Joshua
family: Welch
email: [email protected]
github: jw156605
- given: Jan
family: Prins
email: [email protected]


manuscript:
doi: 10.1186/s13059-016-0975-3
google_scholar_cluster_id: '2071780199208319199'
preprint_date: '2016-04-09'
publication_date: '2016-05-23'

container:
url: https://github.com/dynverse/ti_slicer
docker: dynverse/ti_slicer

wrapper:
type: cell_graph
topology_inference: free
trajectory_types:
- cycle
- linear
- bifurcation
- convergence
- multifurcation
- binary_tree
- tree
- acyclic_graph
- graph
example: /code/example.R
input_required:
- expression
- start_id
input_optional:
- features_id
- end_id

parameters:
kmin:
- id: kmin
type: integer
default: 10
upper: 20
lower: 2
distribution:
type: uniform
upper: 20
lower: 2
description: Smallest value of k to try
m:
- id: m
type: integer
default: 2
upper: 20
lower: 2
distribution:
type: uniform
upper: 20
lower: 2
description: 'Intrinsic dimension of the data. This parameter mainly influences
the visualisation of the results. The real intrinsic dimension will be calculated
automaticly. '
input:
format: rds
optional:
- features_id
- end_id
required:
- expression
- start_id
output:
format: rds
outputs:
- cell_graph
- timings
- dimred
wrapper_type: cell_graph
authors:
- given: Joshua
family: Welch
email: [email protected]
github: jw156605
- given: Jan
family: Prins
email: [email protected]
17 changes: 14 additions & 3 deletions example.R
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#!/usr/local/bin/Rscript

# generate dataset with certain seed
set.seed(1)
data <- dyntoy::generate_dataset(
id = "specific_example/slicer",
num_cells = 99,
num_features = 101,
model = "tree"
model = "tree",
normalise = FALSE
)
params <- list()

# add method specific args (if needed)
data$params <- list()

data$seed <- 1

# write example dataset to file
file <- commandArgs(trailingOnly = TRUE)[[1]]
dynutils::write_h5(data, file)
Binary file added example.h5
Binary file not shown.
39 changes: 15 additions & 24 deletions run.R
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/local/bin/Rscript

task <- dyncli::main()

library(jsonlite)
library(readr)
library(dplyr)
Expand All @@ -10,20 +14,11 @@ library(igraph)
# ____________________________________________________________________________
# Load data ####

data <- read_rds("/ti/input/data.rds")
params <- jsonlite::read_json("/ti/input/params.json")


#' @examples
#' data <- dyntoy::generate_dataset(id = "test", num_cells = 300, num_features = 300, model = "linear") %>% c(., .$prior_information)
#' params <- yaml::read_yaml("containers/slicer/definition.yml")$parameters %>%
#' {.[names(.) != "forbidden"]} %>%
#' map(~ .$default)

expression <- data$expression
start_id <- data$start_id
features_id <- data$features_id
end_id <- data$end_id
expression <- as.matrix(task$expression)
params <- task$params
start_id <- task$priors$start_id
features_id <- task$priors$features_id
end_id <- task$priors$end_id

start_cell <- sample(start_id, 1)

Expand Down Expand Up @@ -81,16 +76,12 @@ nodes_to_keep <- unique(sh_p_to_ends$vpath %>% unlist)
cell_ids <- names(igraph::V(traj_graph))
to_keep <- setNames(seq_along(cell_ids) %in% nodes_to_keep, cell_ids)

# return output
output <- lst(
cell_ids,
cell_graph,
to_keep,
dimred = traj_lle,
timings = checkpoints
)

# ____________________________________________________________________________
# Save output ####

write_rds(output, "/ti/output/output.rds")
output <- dynwrap::wrap_data(cell_ids = cell_ids) %>%
dynwrap::add_cell_graph(cell_graph = cell_graph, to_keep = to_keep) %>%
dynwrap::add_dimred(dimred = traj_lle) %>%
dynwrap::add_timings(timings = checkpoints)

output %>% dyncli::write_output(task$output)
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION=0.9.9

0 comments on commit 9093dc3

Please sign in to comment.