-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_bagel_cli.sh
executable file
·34 lines (26 loc) · 1.25 KB
/
run_bagel_cli.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/bash
ldin=inputs/openneuro-jsonld/
ldout=outputs/openneuro-jsonld/
ds="$1"
ds_name="$2"
ds_portal=https://github.com/OpenNeuroDatasets-JSONLD/${ds}.git
workdir=`realpath ${ldin}/$ds`
container_dir=/${ds}
out=(${ldout}/${ds}.jsonld)
if [ "$ds_name" == "None" ]; then
ds_name=$ds
fi
if [ ! -e ${ldout} ]; then
mkdir -p ${ldout}
fi
echo $ds "$ds_name"
if [ ! -e ${out} ]; then
echo Checking data dictionary for descriptions!
python3 add_description.py ${workdir}/participants.json
echo bagel pheno --pheno ${workdir}/participants.tsv --dictionary ${workdir}/participants.json --output ${workdir}/pheno.jsonld --name "$ds_name" --portal $ds_portal
docker run --rm -v ${workdir}:${container_dir} neurobagel/bagelcli:latest pheno --pheno ${container_dir}/participants.tsv --dictionary ${container_dir}/participants.json --output ${container_dir}/pheno.jsonld --name "$ds_name" --portal $ds_portal
docker run --rm -v ${workdir}:${container_dir} neurobagel/bagelcli:latest bids --jsonld-path ${container_dir}/pheno.jsonld --bids-dir ${container_dir} --output ${container_dir}/pheno_bids.jsonld
echo Resetting dataset to HEAD
git -C ${workdir} checkout HEAD -- participants.json
cp ${workdir}/pheno_bids.jsonld ${out}
fi