broadinstitute / single_cell_portal

Tutorials, workflows, and convenience scripts for Single Cell Portal
https://singlecell.broadinstitute.org/single_cell
BSD 3-Clause "New" or "Revised" License
47 stars 25 forks source link

Add metadata convention flag to public CLI [SCP-1913] #84

Closed eweitz closed 4 years ago

eweitz commented 4 years ago

This adds a flag use_convention to the public CLI in manage_study.py, analogous to the new "Use metadata convention?" option in the GUI described in broadinstitute/single_cell_portal_core#336.

This enables users to validate their metadata against standard vocabularies and make it queryable in SCP's upcoming faceted search UI (or not).

(env) wm10d-4e7:scripts eweitz$ python manage_study.py upload-metadata --help
usage: manage_study.py upload-metadata [-h] --file METADATA_FILE
                                       [--use-convention] --study-name
                                       STUDY_NAME [--description DESCRIPTION]

optional arguments:
  -h, --help            show this help message and exit
  --file METADATA_FILE  Metadata file to load.
  --use-convention      Whether to use metadata convention: validates against
                        standard vocabularies, and will enable faceted search
                        on this data
  --study-name STUDY_NAME
                        Name of the study to add the file.
  --description DESCRIPTION
                        Text describing the metadata file.

Example call:

ACCESS_TOKEN=`gcloud auth print-access-token`
STUDY_NAME="CLI test"
python3 manage_study.py --environment development --token=$ACCESS_TOKEN create-study --study-name="${STUDY_NAME}"
python3 manage_study.py --environment development --token=$ACCESS_TOKEN upload-metadata --study-name "${STUDY_NAME}" --file tests/data/valid_array_v1.1.3.tsv --use-convention

This satisfies SCP-1913.