Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include additional parameters #17

Merged
merged 8 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
23 changes: 23 additions & 0 deletions scmap-cli-post-install-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,29 @@
[ -f "$closest_cells_similarities_text_file" ]
}

@test "For each cell in a query dataset, search for the nearest neighbours by cosine distance within a collection of reference datasets. Includes additional parameters for refining the results" {
if [ "$use_existing_outputs" = 'true' ] && [ -f "$closest_cells_similarities_text_file_2" ]; then
skip "$closest_cells_similarities_text_file_2 exists and use_existing_outputs is set to 'true'"
fi

run rm -rf $closest_cells_similarities_text_file_2 && scmap-scmap-cell.R\
-i $index_cell_sce\
-p $test_sce_processed\
--number-nearest-neighbours $cell_number_nearest_neighbours\
--nearest-neighbours-threshold $cell_nearest_neighbours_threshold\
--threshold $cell_similarity_threshold\
--cluster-col $cluster_col\
--output-object-file $closest_cells_clusters_sce\
--output-clusters-text-file $closest_cells_clusters_tsv\
--closest-cells-text-file $closest_cells_text_file\
--closest-cells-similarities-text-file $closest_cells_similarities_text_file_2

echo "status = ${status}"
echo "output = ${output}"

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

@test "Obtain standard output" {
if [ "$use_existing_outputs" = 'true' ] && [ -f "$scmap_output_tbl" ]; then
Expand Down
5 changes: 4 additions & 1 deletion scmap-cli-post-install-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export index_cell_sce=$output_dir'/index_cell.rds'
export project_cell_sce=$output_dir'/project_cell.rds'
export closest_cells_text_file=$output_dir'/closest_cells.tsv'
export closest_cells_similarities_text_file=$output_dir'/closest_cells_similarities.tsv'
export closest_cells_similarities_text_file_2=$output_dir'/closest_cells_similarities_2.tsv'
export closest_cells_clusters_sce=$output_dir'/closest_cells_clusters.rds'
export closest_cells_clusters_tsv=$output_dir'/closest_cells_clusters.tsv'
export scmap_output_tbl=$output_dir'/scmap_output_tbl.txt'
Expand All @@ -84,6 +85,8 @@ export random_seed=1
export cells_number_chunks=50
export cells_number_clusters=9
export cell_number_nearest_neighbours=5
export cell_nearest_neighbours_threshold=1
export cell_similarity_threshold=0.4

################################################################################
# Test individual scripts
Expand All @@ -99,4 +102,4 @@ export use_existing_outputs
tests_file="${script_name%.*}".bats

# Execute the bats tests
$tests_file
$tests_file
18 changes: 17 additions & 1 deletion scmap-scmap-cell.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ option_list = list(
type = 'numeric',
help = 'A positive integer specifying the number of nearest neighbours to find.'
),
make_option(
c("-n", "--nearest-neighbours-threshold"),
action = "store",
default = 3,
type = 'numeric',
help = 'A positive integer specifying the number of matching nearest neighbours required to label a cell.'
),
make_option(
c("-r", "--threshold"),
action = "store",
default = 0.7,
type = 'numeric',
help = 'Threshold on similarity (or probability for SVM and RF).'
),
make_option(
c("-c", "--cluster-col"),
action = "store",
Expand Down Expand Up @@ -104,7 +118,9 @@ if (opt$cluster_col %in% colnames(colData(index_sce))){
scmapCell_results,
list(
as.character(colData(index_sce)[[opt$cluster_col]])
)
),
w=opt$nearest_neighbours_threshold,
threshold=opt$threshold
)

# Output format anticipates multiple input indexes, let's assume a single input
Expand Down
3 changes: 2 additions & 1 deletion scmap-scmap-cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ scmapCluster_results <- scmapCluster(
projection = project_sce,
index_list = list(
metadata(index_sce)$scmap_cluster_index
)
),
threshold = opt$threshold
)

# Output format anticipates multiple input indexes, let's assume a single input
Expand Down
4 changes: 2 additions & 2 deletions scmap-select-features.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ if ( ! file.exists(opt$input_object_file)){
SingleCellExperiment <- readRDS(opt$input_object_file)

if (is.na(opt$output_plot_file)){
SingleCellExperiment <- selectFeatures(SingleCellExperiment, suppress_plot = TRUE)
SingleCellExperiment <- selectFeatures(SingleCellExperiment, n_features = opt$n_features, suppress_plot = TRUE)
}else{
png(file = opt$output_plot_file)
SingleCellExperiment <- selectFeatures(SingleCellExperiment, suppress_plot = FALSE)
SingleCellExperiment <- selectFeatures(SingleCellExperiment, n_features = opt$n_features, suppress_plot = FALSE)
dev.off()
}

Expand Down