Package: capice
CAPICE : a computational method for Consequence-Agnostic Pathogenicity Interpretation of Clinical Exome variationsCAPICE is a computational method for predicting the pathogenicity of SNVs and InDels. It is a gradient boosting tree
model trained using a variety of genomic annotations used by CADD score and trained on the clinical significance. CAPICE
performs consistently across diverse independent synthetic, and real clinical data sets. It ourperforms the current best
method in pathogenicity estimation for variants of different molecular consequences and allele frequency.The software can be used as web service, as pre-computed scores or by installing the software locally, all described
below.Use online web serviceCAPICE can be used as online service athttp://molgenis.org/capiceRequirementsVEP v107Including VEP cache (which needs to be unarchived!):homo_sapiens_refseq_vep_107_GRCh38Including plugin(s):GranthamSpliceAIIncluding additional data (GRCh38)available here:gnomad.genomes.v3.1.2.sites.stripped.vcf.gzgnomad.genomes.v3.1.2.sites.stripped.vcf.gz.csihg38.phyloP100way.bwspliceai_scores.masked.indel.hg38.vcf.gzspliceai_scores.masked.indel.hg38.vcf.gz.tbispliceai_scores.masked.snv.hg38.vcf.gzspliceai_scores.masked.snv.hg38.vcf.gz.tbiApptainer == 1.1.* (For:BCFTools singularity image).Singularity could also work, but requires manual adjusting ofthe conversion script.Python >=3.10InstallThe CAPICE software is also provided in this repository for running CAPICE in your own environment. The following
sections will guide you through the steps needed for the variant annotation and the execution of making predictions
using the CAPICE model.UNIX like systemsNote: performance of CAPICE has been tested on Python 3.10. Performance on other Python versions is not
guaranteed.Download and installationPreferredpip install capiceOptionalgit clone https://github.com/molgenis/capice.git
cd capice
pip install .Developersgit clone https://github.com/molgenis/capice.git
cd capice
pip install -e '.[test]'Additionally, theBCFTools Singularity imagehas to be obtained.WindowsInstallation on Windows systems is as of current not possible. Please refer to UNIX like systems (macOS or Linux) or use
theWindows subsystem for Linux.
You may also use the Singularity image of CAPICE foundhere.SingularitySingularity images of CAPICE are made available as part of the VIP pipeline. These can be foundhere.UsageVEPIn order to score your variants through CAPICE, you have to annotate your variants using VEP by using the following
command:vep --input_file <path to your input file> --format vcf --output_file <path to your output file> \
--vcf --compress_output gzip --sift s --polyphen s --numbers --symbol \
--shift_3prime 1 --allele_number --refseq --total_length --no_stats --offline --cache \
--dir_cache </path/to/cache/107> --species "homo_sapiens" --assembly <GRCh38> \
--fork <n_threads> --dont_skip --allow_non_variant --use_given_ref --exclude_predicted \
--flag_pick_allele --plugin Grantham \
--plugin SpliceAI,snv=<path/to/spliceai_scores.masked.snv.vcf.gz>,indel=</path/to/spliceai_scores.masked.indel.vcf.gz> \
--custom "<path/to/gnomad.total.sites.stripped.vcf.gz>,gnomAD,vcf,exact,0,AF" \
--custom "<path/to/hg38.phyloP100way.bed.gz,phyloP,bed,exact,0" \
--dir_plugins <path to your VEP plugin directory>Note: Certain arguments might not be needed if training/predicting without using all possible features offered by CAPICE.Then you have to convert the VEP output to TSV using our own BCFTools script:./scripts/convert_vep_vcf_to_tsv_capice.sh -i </path/to/vep_output.vcf.gz> -o </path/to/capice_input.tsv.gz>Important!:this script uses APPTAINER and expects binds to be set correctly by the system administrator by utilizing the environment variableAPPTAINER_BIND.CAPICECAPICE can be run by using the following command:capice [-h] [-v] [--version] {module}arguments-h: Print help and exit.-v: Verbose flag. Add multiplevto increase verbosity (more than 2vdoes not further increase verbosity).--version: Print current CAPICE version and exit.CAPICE currently has the following available modules:predicttrainexplainFor all modulespredict,trainandexplain, the following arguments are available:-i / --input(required): The path to the
inputVEP annotateddataset using the tab separator (can be
both gzipped or not). Example input data can be found in theresourcesdirectory (based on genome build 37 with VEP105).
The non-raw input files can be used directly with CAPICE.
VEP outputs can be converted usingconvert_vep_to_tsv_capice.shin thescriptsdirectory (requires apptainer).-o / --output(optional): The path to the directory, output filename or output directory and filename where the
output is placed (will be made if it does not exists). If only a filename is supplied, or no output is supplied, the
file will be placed within the directory of which CAPICE was called from.The file will always be gzipped with a .gz
extension!For instance:-i input.tsvcreates the output fileinput_capice.tsv.gz-i input.tsv -o output.tsv.gzcreates the output fileoutput.tsv.gz-i input.tsv -o path/to/output.tsv.gzcreates the output filepath/to/output.tsv.gz-i input.tsv -o path/to/output_directorycreates the output filepath/to/output_directory/input_capice.tsv.gz-f / --force: Overwrite an output file if already present.The following argument is specific topredict:-m / --model(required): The path to the (universal binary) json model that includes
attributesCAPICE_version(str),vep_features(list[str]),processable_features(list[str]) andpredict_proba(XGBoost.XGBClassifier).
Models can be found as attachments on theGitHub releasespage.The following arguments are specific totrain:-e / --features(required): The path to a JSON containing the features desired for training as supplied in the input file. Each key is a training feature, each value is ignored and can be leftnull.Please note that the features are case-sensitive!-s / --split(optional): Percentage of input data that should be used to measure performance during training.
Argument should be given in float from 0.1 (10%) to 0.9 (90%), default = 0.2.-t / --threads(optional): The amount of processing cores the training protocol can use. Default = 1.You can also usecapice {module} --helpto show help on the command line.Output of CAPICE prediction filesA file will be put out containing the following columns:chr: column containing the chromosome of a variantpos: the position of the variantref: the reference of the variantalt: the alternative of the variantgene_name: The gene name of the variant as supplied.gene_id: The id of the gene name.id_source: The source of the gene id.feature: The feature of the variant as supplied.feature_type: The type of the feature of the variant as supplied.score: The predicted CAPICE score for the variant. The higher the score, the more likely that the variant is
pathogenic.suggested_class:Suggestedoutput class of the variant keeping in mind the score and gene.
Currently VUS only. Work in progress.Usage for making new CAPICE like modelsOutside of Predictions, this repository also provides users the availability to create new CAPICE like models according
to their specific use case. Since the input file features are not validated apart from 6 features (CHROM,POS,REF,ALT,sample_weight,binarized_label(case sensitive)), user can provide their
own features. Please note that performance is validated on natively supported features.Performance is not guaranteed
for custom features.Sample weight can be 1 for all samples if no sample weight should be applied. Binarized label should be either 0 or 1,
depending on your labels of classification. Train is optimized for a 2 class problem. Performance is not guaranteed for
more than 2 classes.Outputs for training a new model:A file will be put out containing the following element:xgb_classifier:Universal Binary Jsonor JSON file of
aXGBClassifierinstance that
has successfully trained on the input data, containing additional attributes CAPICE_version, vep_features and processable_features.Note: To load in the (universal binary) json model, use the following commands:importxgboostasxgbmodel=xgb.XGBClassifier()model.load_model('/path/to/model.ubj')Usage for the explain moduleIs only supported for CAPICE models that have been created using CAPICE v5.0.0 or greater!The explain module takes a model and exports the feature importances of said model.
Each of the importance type is describedhere.Do note that the output of the explain module will always a gzipped TSV, just like the output ofpredict.FAQ:Question:Will CAPICE support CADD 1.6 and Genome Build 38?Answer:No (CADD 1.6) and yes (Genome Build 38). CADD has moved on to Snakemake and is quite slow.
It also limits us on updating VEP for improved and bugfixes on features. However, CAPICE will support genome build 38.Question:These scores are nice and all, but what do they really mean for this particular variant?Answer:CAPICE bases it's scoring on the training that it was provided with. A score is assigned based on features the model
learned to recognize during training. There are plans to make a "Capice Explain Tool" which will tell how a score came
to be.Question:Training a new model failed with an error injoblib.externals.loky.process_executor.RemoteTracebackwithValueError: unknown format is not supported. Why?Answer:This could possibly originate from a low sample size during the cross validation in RandomSearchCV.
Pleasecontact usfor further help.Question:I'm on Windows and installing XGBoost fails with the PIP
error“No files/directories in C:\path\to\xgboost\pip-egg-info (from PKG-INFO)”. Am I doing something wrong?Answer:Unfortunately, XGBoost does not cooperate well with Windows. You might want to try to
installSetuptoolsbefore you attempt to install the dependencies. If that does
not work either, we suggest you use either a Unix style virtual machine or, if you are using Windows 10,
theWindows Subsystem for Linuxis also available in the
Windows Store for free, which is guaranteed to work.You could also use CAPICE through theSingularity Container.Question:I'm trying to run CAPICE, but I'm getting the following error:xgboost.core.XGBoostError: XGBoost Library (libxgboost.dylib) could not be loaded.Answer:This error is caused on (likely) macOS when the package "OpenMP" is not installed. Please installlibompto get XGBoost
running.Question:I'm getting the following error:ModuleNotFoundError: No module named 'sklearn'. What is going wrong?Answer:sklearnis a module that should be installed whenscikit-learnis installed. Either installsklearnmanually
thoughpip install sklearnor try to re-installscikit-learn.Question:I'm getting the warning/usr/local/lib/python3.8/dist-packages/joblib/_multiprocessing_helpers.py:45: UserWarning: [Errno 2] No such file or directory.  joblib will operate in serial mode warnings.warn('%s.  joblib will operate in serial mode' % (e,))when using the CAPICE Singularity image. What's going wrong?Answer:This is likely due to the fact that the Singularity image searches for shared memory, which is different for Windows style operating systems.
This means that any and all multiprocessing parts of CAPICE will perform in single threaded mode. Other than that, CAPICE should work just fine.Question:I want to use thestandalone SpliceAIinstead of the VEP plugin. Is this possible?Answer:We are investigating options to include the standalone SpliceAI since this requires a lot less resources for the precomputed scores that the VEP plugin uses.
You could try to use it, but proceed at your own risk.Question:CAPICE gives an error that the model version does not match with the CAPICE version.Answer:There are certain restrictions regarding what model versions can be used with CAPICE.
For regular releases, the major version must be identical.
For pre-release versions (withrc<number>in the version), the entire version number (major, minor, patch & pre-release) must be identical.Question:I created/am using a.pickle.datmodel, but the newer versions of CAPICE switched to.ubj/.jsoninstead for models.
Can I somehow use my old.pickle.datwith newer versions of CAPICE.Answer:First of all, it's important to note that with every major release, breaking changes might be implemented.
However, it might be possible to upgrade a CAPICE 4.x.x model to a model usable by CAPICE 5.x.x (though no guarantees are
given!).To convert a.pickle.datmodel to.ubj/.json, one can do the following (using a local git clone of the repository):Git checkout the CAPICE version (tag) on which the model was trained.Create/load a virtual environment (venv) & pip install from the source code.Use the following python code:importsysimportpicklewithopen(sys.argv[1],'rb')asmodel_file:model=pickle.load(model_file)model.save_model(sys.argv[2])sys.argv[1]: the input.pickle.datfilesys.argv[2]: the output.jsonfileAdjustCAPICE_versionwithin the new model file to that of the new release (major version should match!).
It is advisable however to ensure that the filename still contains the version it was trained on (e.g.v4.0.0_grch38_v5.0.0-compatibility.json) to ensure no confusion will exist on which version it was actually trained.Do note that we recommend using a model trained on a specific major version instead, as other breaking changes might be present as well!Data sourcesGnomADThe gnomAD files can be generated through the following scripts (which also download the gnomAD files):GRCH38:https://github.com/molgenis/vip/blob/main/utils/create_gnomad_GRCh38.shPhyloPPhyloP resources can be downloaded from:GRCh38:http://hgdownload.cse.ucsc.edu/goldenpath/hg38/phyloP100way/SpliceAIFiles for the SpliceAI VEP plugin can be found in the Illumina project "Predicting splicing from primary sequence" (as mentionedhere),
which can be accessed after creating an account on Illumina. Once added, the relevant files can be accessed as follows:Go to the projects tabSelectPredicting splicing from primary sequenceSelect theanalysessubtab (might be selected by default)Click ongenome_scores_v<version_number>(select most recent version)SelectfilessubtabClick on thegenome_scores_v<version_number>folderSelect the files to download (seeRequirements)Overview of codeIf you're lost in the code, an outdated map can be
foundhere.