Conversation
…pper classes for json to python objects to improve access of annotation results
…r forgotten static method
…y are installed under the venv bin directory so that their always within the current PATH
…y are installed under the venv bin directory so that their always within the current PATH
…name to varsome-api-client
| varsome_api_run.py -g hg19 -q 'chr7-140453136-A-T' -p add-all-data=1 | ||
|
|
||
| Without an API key you will not be able to perform batch requests as well. | ||
| The script should complete without errors and display aprox 6,700 lines of data from dann, dbnsfp, ensemble_transcripts, gerp, gnomad_exomes, gnomad_exomes_coverage, icgc_somatic, ncbi_clinvar2, pub_med_articles, refseq_transcripts, sanger_cosmic_public, uniprot_variants, wustl_civic etc. |
|
|
||
|
|
||
| def annotate_variant(argv): | ||
| parser = argparse.ArgumentParser(description='Sample Variant API calls') |
There was a problem hiding this comment.
description='Sample Varsome API calls'
| rsid = fields.ListField(items_types=(int,), help_text="RS ID") | ||
|
|
||
|
|
||
| class ClinVarDisease(models.Base): |
There was a problem hiding this comment.
ClinVar and ClinVarDisease are not needed anymore, we only have them for old annotations for the portal, right?
| sanger_cosmic = fields.ListField(required=False, items_types=(Cosmic,), help_text="Sanger Cosmic") | ||
| sanger_cosmic_public = fields.ListField(required=False, items_types=(CosmicPublic,), help_text="Cosmic") | ||
| sanger_cosmic_licensed = fields.ListField(required=False, items_types=(CosmicLicensed,), help_text="Cosmic") | ||
| ncbi_clinvar = fields.ListField(required=False, items_types=(ClinVar,), help_text="ClinVar") |
There was a problem hiding this comment.
ncbi_clinvar is not in the API anymore
There was a problem hiding this comment.
Well the schema still returns them, and the available get parameters too. I will remove from the json models. Maybe we should also patch the api and remove the parameters, but we should keep the serialzers for the portal..
There was a problem hiding this comment.
Ok done, removed clinvar (1). I will prepare a patch for the api as well
Made some changes to the text of the rEADME file
|
|
||
| varsome_api_annotate_vcf.py -g hg19 -k api_key -i input.vcf -o annotated_vcf.vcf -p add-all-data=1 | ||
|
|
||
| Notice however that not all available annotations will be present in the annotated_vcf file. Only a subset |
There was a problem hiding this comment.
This is confusing. Why won't all annotations be present? Which ones will be there and which ones will be missing? How does the script "decide"? Is it random? Is it a specific set of annotations, the same each time?
| print(e) # 404 (invalid reference genome) | ||
|
|
||
| ### Example Usage | ||
| To view available request parameters (used in the params method parameter) refer to an example at [api.varsome.com](https://api.varsome.com) |
There was a problem hiding this comment.
If "params" is code, it should be params (`params`). I can't tell here if the method os parameter or params.
| api = VarSomeAPIClient(api_key) | ||
| # fetch information about a variant into a dictionary | ||
| result = api.lookup('chr7-140453136-A-T', params={'add-source-databases': 'gnomad-exomes,refseq-transcripts'}, ref_genome='hg19') | ||
| annotated_variant = AnnotatedVariant(**result) |
There was a problem hiding this comment.
The ** here make al subsequent lines bold. It looks like the code is not actually in a code block, so it is parsed as markdown.
| @@ -0,0 +1,112 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
Shouldn't this (and all other shebang lines) be #!/usr/bin/env python3? env python will likely still resolve to python2 on many systems.
There was a problem hiding this comment.
Well if you are on a system where python2 is still the default. which is none except Macs, and dont create a python3 virtual env then yes it will fail.
So leave it on pyton3. The setup.py script has a requirement for python3 but I guess its ok to change that to python3
|
|
||
| for a list of available options | ||
| Please visit the [api documentation](https://api.varsome.com) to find out how to use the api and | ||
| what values does the api provide as a response to lookup requests |
There was a problem hiding this comment.
Change
what values does the api provide as a response to lookup requests
to
what values the api provides as a response to lookup requests
added syntax highlighting to readme examples
| This client is still in beta but it is a good for playing around with the API. | ||
|
|
||
| ### Python versions | ||
| Python version 3 is supported. |
There was a problem hiding this comment.
Requires at least Python 3.5, you can download the latest version from www.python.org
There was a problem hiding this comment.
ie: Python 3.4 doesn't work.
| within your code, or do | ||
| There are several ways to create a virtual environment, but you can refer to [pip installation](https://pip.pypa.io/en/stable/installing/) and | ||
| [virtualenv installation](https://virtualenv.pypa.io/en/stable/installation/) to first install these 2 tools if you don't | ||
| have them already installed via a package manager (Linux) or HomeBrew (MacOS), etc. |
There was a problem hiding this comment.
Remember to use "sudo -H" when installing on Mac.
| varsome_api_run.py -g hg19 -k api_key -i variants.txt -o annotations.txt -p add-all-data=1 | ||
|
|
||
| The command above will read variants from `variants.txt` and dump the annotations to `annotations.txt`. | ||
| If you don't use the `-k` parameter, the script will do as many requests as there are variants in `variants.txt`, |
There was a problem hiding this comment.
For any substantial number of variants you will need to register for an API key. You can try the software without the -k apiKey parameter but you will quickly bump into safeguard limits...
or something like that.
| varsome_api_annotate_vcf.py -g hg19 -k api_key -i input.vcf -o annotated_vcf.vcf -p add-all-data=1 | ||
|
|
||
| Notice, however, that not all available annotations will be present in the `annotated_vcf.vcf` file. Only a subset | ||
| of the returned annotations will be available when running this script. See the "Using the client in your code" |
There was a problem hiding this comment.
I have added only a subset of annotations in the output.vcf the possible number of annotations are too many to add them all and header info in the vcf file for all of them it might take several more days with tests and changes etc.. Besides you dont know what a user might need from all of these annotations, this is why the user is referred to the section using the client,where he is instructed how to override the VCFAnnotator class with the annotations he wants.
After all the intended use is that the end user will get the python class objects to develop an app of his own not use the run.py and annotate_vcf scripts. Even if he wants to do that he can copy the code and use his overriden vcf annotator class
|
|
||
| You will also not be able to perform batch requests without an API key. | ||
|
|
||
| To obtain an API key please [contact us](mailto:support@saphetor.com) |
There was a problem hiding this comment.
Move this to the top of this section.
|
|
||
| ### How to get an API key | ||
|
|
||
| You are generally not required to have an API key to use the API but, without one, the number of requests |
There was a problem hiding this comment.
Change this to: "You can use the API without an API key, but performance and the number of queries will be limited in order to safeguard our platform's reliability."
| 'Programming Language :: Python :: 3', | ||
| 'Programming Language :: Python :: 3.2', | ||
| 'Programming Language :: Python :: 3.3', | ||
| 'Programming Language :: Python :: 3.4', |
There was a problem hiding this comment.
You probably need to remove up to 3.4 included.
| @@ -0,0 +1,41 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
Many (all?) of these files are missing (c) 2018 Saphetor at the top.
We need to decide which license we are using for these.
And then include the appropriate header in all files.
Preferably something that means that:
1- We own the original code.
2- If somebody modifies the code they still have to include the copyright message.
3- Would be nice if they send bug-fixes back to us.
4- They can sell the code to 3rd party uses, but they must credit Saphetor.
There was a problem hiding this comment.
Not sure if we need all this info in all files. The repository contains a license file which can cover all the code
There was a problem hiding this comment.
…nings in requests as possible
Includes new vcf annotator object
Several code fixes
Unit tests
updated documentation