diff --git a/examples/README.md b/examples/README.md index def2c34d..da9be480 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,10 +1,25 @@ SolveBio Python Examples ====================== -Please start with the [basic Python tutorial](https://docs.solvebio.com/docs/tutorial). +Complete beginner? Please start with the [basic Python tutorial](https://docs.solvebio.com/docs/tutorial). -Advanced Examples ------------------ +## Importing data + +There are many ways to import data into SolveBio. + +**Web**: +You can import VCF & JSON files directly via the [SolveBio web interface](https://my.solvebio.com/files) ([web import documentation](https://support.solvebio.com/hc/en-us/articles/218889718-Importing-VCF-and-JSON-Data +)). + +**SolveBio Python client shortcut**: +[Handy dandy command line shortcut](https://github.com/solvebio/solvebio-python/blob/master/examples/import/README.md) built into the SolveBio Python client. + +**Python script**: +Or use an +[example simple Python script](https://github.com/solvebio/solvebio-python/blob/master/examples/import_data.py). + + +## Advanced Examples IPython/Jupyter notebooks do not load embedded graphs in the GitHub viewer. For optimal experience, please use these links: diff --git a/examples/import/README.md b/examples/import/README.md new file mode 100644 index 00000000..0cc60ee8 --- /dev/null +++ b/examples/import/README.md @@ -0,0 +1,25 @@ +SolveBio Import Shortcut Example +====================== + +Make sure you're using the newest version of SolveBio with `pip install solvebio --upgrade` + +The SolveBio Python client provides a simple command line shortcut to import data. + +Your DOMAIN is the subdomain of your SolveBio account. You can find your domain by going to [SolveBio](https://my.solvebio.com/organization/people) - your organization name is your domain. + +To run the example commands, download the [example_input.json](https://github.com/solvebio/solvebio-python/blob/master/examples/import/example_input.json) and [example_template.json](https://github.com/solvebio/solvebio-python/blob/master/examples/import/example_template.json) files. + +In your command line: +```bash +solvebio import DOMAIN:ExampleDepo/1.0.0/ExampleDataset example_input.json --create-dataset --auto-approve +``` + +If you want to add SolveBio entities to your data, you can with a template file (you can also do it later on the SolveBio web interface). +``` +solvebio import DOMAIN:ExampleDepo/1.0.0/ExampleEntityDataset example_input.json --create-dataset --auto-approve --template-file example_template.json +``` + +To get a full list of the arguments options available, try +``` +solvebio import -h +``` diff --git a/examples/import/example_input.json b/examples/import/example_input.json new file mode 100644 index 00000000..dd20479a --- /dev/null +++ b/examples/import/example_input.json @@ -0,0 +1,3 @@ +{"aa": "p.T235M", "classification": "missense", "solvebio_variant_id": "GRCh37-1-155932911-155932911-A", "transcript": "ENST00000313695", "genomic_coordinates": {"start": 155932911, "stop": 155932911, "build": "GRCh37", "chromosome": "1"}, "gene_id": "ARHGEF2", "cosmic_id": "998184", "cdna": "c.704C>T","hgvs_g": "NC_000001.10:g.155932911G>A", "hgvs_c": "ENST00000313695:c.704C>T"} +{"aa": "p.A185T", "classification": "missense", "solvebio_variant_id": "GRCh37-1-155934866-155934866-T", "transcript": "ENST00000313695", "genomic_coordinates": {"start": 155934866, "stop": 155934866, "build": "GRCh37", "chromosome": "1"}, "gene_id": "ARHGEF2", "cosmic_id": "998184", "cdna": "c.553G>A","hgvs_g": "NC_000001.10:g.155934866C>T", "hgvs_c": "ENST00000313695:c.553G>A"} +{"aa": "p.A77T", "classification": "missense", "solvebio_variant_id": "GRCh37-1-155936237-155936237-T", "transcript": "ENST00000313695", "genomic_coordinates": {"start": 155936237, "stop": 155936237, "build": "GRCh37", "chromosome": "1"}, "gene_id": "ARHGEF2", "cosmic_id": "998184", "cdna": "c.229G>A","hgvs_g": "NC_000001.10:g.155936237C>T", "hgvs_c": "ENST00000313695:c.229G>A"} \ No newline at end of file diff --git a/examples/import/example_template.json b/examples/import/example_template.json new file mode 100644 index 00000000..4a10e35d --- /dev/null +++ b/examples/import/example_template.json @@ -0,0 +1,13 @@ +{ + "name": "Example SolveBio import template", + "fields": [ + { + "name": "gene_id", + "entity_type": "gene" + }, + { + "name": "solvebio_variant_id", + "entity_type": "variant" + } + ] +} \ No newline at end of file diff --git a/examples/import_data.py b/examples/import_data.py index 3a2b37a3..44de85b3 100644 --- a/examples/import_data.py +++ b/examples/import_data.py @@ -1,7 +1,12 @@ import solvebio +# find your solvebio domain +solvebio.login() +user = solvebio.User.retrieve() +my_domain = user['account']['domain'] + # create a dataset -dataset_name = '{0}:SampleImport/1.0.0/SampleImport'.format('your-domain') +dataset_name = '{0}:SampleImport/1.0.0/SampleImport'.format(my_domain) dataset = solvebio.Dataset.get_or_create_by_full_name(dataset_name) # create a manifest object and a file to it