Skip to content

Commit

Permalink
Merge branch 'release/v0.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
nh3 committed Jan 27, 2020
2 parents b3825a7 + 385f6bf commit 8595728
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: MonocleScripts
Title: Command line scripts for Monocle3
Version: 0.0.4
Version: 0.0.5
Authors@R: c(
person('Ni', 'Huang', email='[email protected]', role=c('aut', 'cre')),
person('Krzysztof', 'Polanski', email='[email protected]', role='aut'))
Expand Down
4 changes: 2 additions & 2 deletions R/cmd_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ monocle_create <- function(
else if (toupper(substr(file, nchar(file)-2, nchar(file))) == 'MTX')
assign(var, Matrix::readMM(file))
else if (toupper(substr(file, nchar(file)-2, nchar(file))) == 'TSV')
assign(var, read.delim(file, row.names = 1, stringsAsFactors = FALSE))
assign(var, as.matrix(read.delim(file, row.names = 1, stringsAsFactors = FALSE)))
else
assign(var, read.csv(file, row.names = 1, stringsAsFactors = FALSE))
assign(var, as.matrix(read.csv(file, row.names = 1, stringsAsFactors = FALSE)))
}
}

Expand Down
30 changes: 30 additions & 0 deletions monocle-scripts-post-install-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ setup() {
var_rds="${data_dir}/var.rds"
create_opt="--expression-matrix $exprs_mtx --cell-metadata $obs_rds --gene-annotation $var_rds"
create_rds="${output_dir}/create.rds"
tsv_file="${test_dir}/matrix.tsv"
tsv_opt="--expression-matrix $tsv_file"
tsv_rds="${output_dir}/tsv.rds"
csv_file="${test_dir}/matrix.csv"
csv_opt="--expression-matrix $csv_file"
csv_rds="${output_dir}/csv.rds"
preprocess_opt="-f cds3 --method PCA --num-dim 50 --norm-method log --pseudo-count 1"
preprocess_rds="${output_dir}/preprocess.rds"
reduceDim_opt="--max-components 2 --reduction-method UMAP --preprocess-method PCA"
Expand Down Expand Up @@ -72,6 +78,30 @@ setup() {
[ -f "$create_rds" ]
}

@test "Create from .csv" {
if [ "$resume" = 'true' ] && [ -f "$csv_rds" ]; then
skip "$csv_rds exists and resume is set to 'true'"
fi

echo "$monocle create $csv_rds $csv_opt"
run eval "printf 'genes,MGH100-P5-A01,MGH100-P5-A03\nA1BG,4.13,2.17\nA1BG-AS1,0,5.57\n' > $csv_file" && $monocle create $csv_rds $csv_opt

[ "$status" -eq 0 ]
[ -f "$csv_rds" ]
}

@test "Create from .tsv" {
if [ "$resume" = 'true' ] && [ -f "$tsv_rds" ]; then
skip "$tsv_rds exists and resume is set to 'true'"
fi

echo "$monocle create $tsv_rds $tsv_opt"
run eval "printf 'genes\tMGH100-P5-A01\tMGH100-P5-A03\nA1BG\t4.13\t2.17\nA1BG-AS1\t0\t5.57\n' > $tsv_file" && $monocle create $tsv_rds $tsv_opt

[ "$status" -eq 0 ]
[ -f "$tsv_rds" ]
}

# Preprocess data

@test "Preprocess" {
Expand Down

0 comments on commit 8595728

Please sign in to comment.