-
Notifications
You must be signed in to change notification settings - Fork 11
Training
Warning: for advanced users. Knowledge of python and scikit-learn is recommended
This is a guide for users to retrain the default SV2 classifiers and to train custom supervised classifiers.
Included in the SV2 source package are the original training set and a jupyter notebook containing instructions for (re)training.
The default training set is packaged with the source distribution.
The files are located here after extracting the source package:
$ ls sv2-VERSION/sv2/training/1kgp_training_data
1kgp_highcov_del_gt1kb.txt
1kgp_highcov_del_lt1kb.txt
1kgp_highcov_del_malesexchrom.txt
1kgp_highcov_dup_snv.txt
1kgp_lowcov_dup_breakpoint.txt
1kgp_lowcov_dup_malesexchrom.txt
These files can be used for retraining in the training SVM classifiers section
sv2train
is a script designed for advanced users that wish to train genotyping classifiers with their own data.
Given SV input, SV2 will generate features for training a new classifier, given user-defined genotype labels.
$ sv2train -i <in.txt> [-b ...] [-v ...] -o <sv2>
$ ls sv2_training_features/
sv2_deletion_gt1kb_training_features.txt
sv2_deletion_lt1kb_training_features.txt
sv2_deletion_male_sex_chrom_features.txt
sv2_duplication_breakpoint_training_features.txt
...
The header is formatted for the companion jupyter notebook, please do not alter it.
VERY IMPORTANT:bangbang:
before training, users have to populate the values in copy_number
. The default output is NA
and the expected output for the companion jupyter notebook is the following:
- Biallelic SVs
copy_number | VCF genotype |
---|---|
0 | 1/1 (DEL:HOM) |
1 | 0/1 (DEL:HET) |
2 | 0/0 (REF) |
3 | 0/1 (DUP:HET) |
4 | 1/1 (DUP:HOM) |
- SVs on Male Sex Chromosomes
copy_number | VCF genotype |
---|---|
0 | 1 (DEL:ALT) |
1 | 0 (REF) |
2 | 1 (DUP:ALT) |
Above is tabulated the expected values for copy_number
in the sv2train
output. The companion jupyter notebook encodes the genotype labels as copy number for simplicity. This is useful if a user wants to include variants with multiple alleles such as,
REF | ALT | Genotype | copy_number |
---|---|---|---|
, | 2/2 | 4 | |
, | 1/2 | 2 | |
, | 0/2 | 4 |
The jupyter notebook is located in the source package here: sv2-VERSION/sv2/training/sv2_training.ipynb
A copy is also available on github
This notebook is designed to guide users into training genotyping classifiers. It is important to chose a name for your classifier, this name will be later loaded into SV2
The output of the jupyter notebook is a JSON file containing the paths to the trained classifiers. The models are saved in pickle .pkl
files.
It is very important to not alter the paths in the JSON file or the pickle files themselves.
A JSON file containing paths to classifier models saved in pickle files is required to add new classifiers.
Pass the JSON file to the SV2 -load-clf
command
$ sv2 -load-clf myclf.json
This command appends new classifiers to the SV2 classifier JSON file located here: $SV2_INSTALL_LOCATION/sv2/config/sv2_clf.json
After loading the classifiers with the -load-clf
command, users can specify which model to genotype on with the -clf <classifier-name>
option.
# genotype with default classifiers
$ sv2 -i in.txt [-b ...] [-v ...] -clf default
# genotype with a classifier named "myclf"
$ sv2 -i in.txt [-b ...] [-v ...] -clf myclf