Skip to content

Commit 92a0131

Browse files
committed
add dataset processing script
1 parent 3ebfec1 commit 92a0131

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# get the root of the directory
4+
REPO_ROOT=$(git rev-parse --show-toplevel)
5+
6+
# ensure that the command below is run from the root of the repository
7+
cd "$REPO_ROOT"
8+
9+
set -e
10+
11+
RAW_DIR=resources_raw/human_cll_mass_cytometry/
12+
DATASET_ID=human_cll_mass_cytometry
13+
OUTPUT_DIR=resources/datasets_raw/$DATASET_ID/
14+
15+
mkdir -p $OUTPUT_DIR
16+
17+
# create raw dataset files
18+
python << HERE
19+
import anndata as ad
20+
21+
adata = ad.read_h5ad("$RAW_DIR/human_cll_mass_cytometry.h5ad")
22+
23+
# rename values
24+
for col in ["parameter_num_clusters", "parameter_som_xdim", "parameter_som_ydim"]:
25+
adata.uns[col] = int(adata.uns[col])
26+
27+
# make sure the output is compressed
28+
adata.write_h5ad("$OUTPUT_DIR/common_dataset.h5ad", compression='gzip')
29+
HERE
30+
31+
cat > $OUTPUT_DIR/state.yaml << HERE
32+
id: $DATASET_ID
33+
output_dataset: !file common_dataset.h5ad
34+
HERE
35+
36+
# only run this if you have access to the openproblems-data bucket
37+
aws s3 sync --profile op \
38+
resources/datasets_raw/human_cll_mass_cytometry \
39+
s3://openproblems-data/resources/task_cyto_batch_integration/datasets_raw/human_cll_mass_cytometry/ \
40+
--delete --dryrun

0 commit comments

Comments
 (0)