Package: variation-normalizer
Variation NormalizationServices and guidelines for normalizing variation terms toVRScompatible representations.Public OpenAPI endpoint:https://normalize.cancervariants.org/variationInstalling with pip:pipinstallvariation-normalizerThe variation-normalization repo depends on VRS models, and therefore each variation-normalizer package on PyPI uses a particular version of VRS. The correspondences between packages may be summarized as:variation-normalization branchvariation-normalizer versiongene-normalizer versionVRS versionmain0.6.X0.1.X1.X.Xstaging0.8.X0.3.X2.0-alphaAboutVariation Normalization works by using four main steps: tokenization, classification, validation, and translation. During tokenization, we split strings on whitespace and parse to determine the type of token. During classification, we specify the order of tokens a classification can have. We then do validation checks such as ensuring references for a nucleotide or amino acid matches the expected value and validating a position exists on the given transcript. During translation, we return a VRS Allele object.Variation Normalization is limited to the following types of variants:HGVS expressions and text representations (ex:BRAF V600E):protein (p.): substitution, deletion, insertion, deletion-insertioncoding DNA (c.): substitution, deletion, insertion, deletion-insertiongenomic (g.): substitution, deletion, ambiguous deletion, insertion, deletion-insertion, duplicationgnomAD-style VCF (chr-pos-ref-alt, ex:7-140753336-A-T)genomic (g.): substitution, deletion, insertionVariation Normalizer accepts input from GRCh37 or GRCh8 assemblies.We are working towards adding more types of variations, coordinates, and representations.Endpoints/to_vrsReturns a list of validated VRSVariations./normalizeReturns a VRS Variation aligned to the prioritized transcript. The Variation Normalizer relies onCommonOperationsOnLots-ofSequences Tool (cool-seq-tool)for retrieving the prioritized transcript data. More information on the transcript selection algorithm can be foundhere.If a genomic variation queryisgiven a gene (E.g.BRAF g.140753336A>T), the associated cDNA representation will be returned. This is because the gene provides additional strand context. If a genomic variation query isnotgiven a gene, the GRCh38 representation will be returned.Developer InstructionsClone the repo:gitclonehttps://github.com/cancervariants/variation-normalization.gitcdvariation-normalizationFor a development install, we recommend using Pipenv. See thepipenv docsfor direction on installing pipenv in your compute environment.Once installed, from the project root dir, just run:pipenvshell
pipenvupdate&&pipenvinstall--devBackend ServicesVariation Normalization relies on some local data caches which you will need to set up. It uses pipenv to manage its environment, which you will also need to install.Gene NormalizerVariation Normalization relies on data fromGene Normalization. You must load all sourcesandmerged concepts.You must also have Gene Normalization's DynamoDB running in a separate terminal for the application to work.For more information about the gene-normalizer and how to load the database, visit theREADME.SeqRepoVariation Normalization relies onseqrepo, which you must download yourself.Variation Normalizer uses seqrepo to retrieve sequences at given positions on a transcript.From therootdirectory:pipinstallseqrepo
sudomkdir/usr/local/share/seqrepo
sudochown$USER/usr/local/share/seqrepo
seqrepopull-i2021-01-29# Replace with latest version using `seqrepo list-remote-instances` if outdatedIf you get an error similar to the one below:PermissionError:[Error13]Permissiondenied:'/usr/local/share/seqrepo/2021-01-29._fkuefgd'->'/usr/local/share/seqrepo/2021-01-29'You will want to do the following:(Might not be ._fkuefgd, so replace with your error message path)sudomv/usr/local/share/seqrepo/2021-01-29._fkuefgd/usr/local/share/seqrepo/2021-01-29exitUse theSEQREPO_ROOT_DIRenvironment variable to set the path of an already existing SeqRepo directory. The default is/usr/local/share/seqrepo/latest.UTAVariation Normalizer also usesCommonOperationsOnLots-ofSequences Tool (cool-seq-tool)which usesUTAas the underlying PostgreSQL database.The following commands will likely need modification appropriate for the installation environment.InstallPostgreSQLCreate user and database.createuser-Upostgresuta_admin
createuser-Upostgresanonymous
createdb-Upostgres-Outa_adminutaTo install locally, from thevariation/datadirectory:exportUTA_VERSION=uta_20210129.pgd.gz
curl-Ohttp://dl.biocommons.org/uta/$UTA_VERSIONgzip-cdq${UTA_VERSION}|grep-v"^REFRESH MATERIALIZED VIEW"|psql-hlocalhost-Uuta_admin--echo-errors--single-transaction-vON_ERROR_STOP=1-duta-p5433UTA Installation IssuesIf you have trouble installing UTA, you can visitthese two READMEs.Connecting to the UTA databaseTo connect to the UTA database, you can use the default url (postgresql://uta_admin@localhost:5433/uta/uta_20210129). If you do not wish to use the default, you must set the environment variableUTA_DB_URLwhich has the format ofdriver://user:pass@host:port/database/schema.Starting the Variation Normalization Service Locallygene-normalizers dynamodb and theutadatabase must be running.To start the service, run the following:uvicornvariation.main:app--reloadNext, view the OpenAPI docs on your local machine:http://127.0.0.1:8000/variationInit coding style testsCode style is managed byRuffand checked prior to commit.Check style withruff:python3-mruffformat.&&python3-mruffcheck--fix.We usepre-committo run conformance tests.This ensures:Style correctnessNo large filesAWS credentials are presentPrivate key is presentPre-commitmustbe installed before your first commit. Use the following command:pre-commit installTestingFrom therootdirectory of the repository:pytesttests/