Package: deepBreaks
deepBreaksdeepBreaks, a computational method, aims to identify important
changes in association with the phenotype of interest
using multi-alignment sequencing data from a population.Key features:Generality:deepBreaksis a new computational tool for identifying genomic regions and genetic variants
significantly associated with phenotypes of interest.Validation:A comprehensive evaluation of deepBreaks performance using synthetic
data generation with known ground truth for genotype-phenotype association testing.Interpretation:Rather than checking all possible mutations (breaks),deepBreaksprioritizes only statistically
promising candidate mutations.Elegance:User-friendly, open-source software allowing for high-quality visualization
and statistical tests.Optimization:Since sequence data are often very high volume (next-generation DNA sequencing reads typically
in the millions), all modules have been written and benchmarked for computing time.Documentation:Open-source GitHub repository of code complete with tutorials and a wide range of
real-world applications.Citation:Mahdi Baghbanzadeh, Tyson Dawson, Bahar Sayoldin, Todd H. Oakley, Keith A. Crandall, Ali Rahnavard (2023).deepBreaks: a machine learning tool for identifying and prioritizing genotype-phenotype associations,https://github.com/omicsEye/deepBreaks/.deepBreaks user manualContentsFeaturesdeepBreaksInstallationWindows Linux MacApple M1/M2 MACGetting Started with deepBreaksTest deepBreaksOptionsInputOutputDemoTutorialApplicationsdeepBreaksidentifies amino acids associated with color sensitivityNovel insights of niche associations in the oral microbiomedeepBreaksreveals important SARS-CoV-2 regions associated with Alpha and Delta variantsdeepBreaksidentifies HIV regions with potentially important functionsSupportFeaturesGeneric software that can handle any kind of sequencing data and phenotypesOne place to do all analysis and producing high-quality visualizationsOptimized computationUser-friendly softwareProvides a predictive power of most discriminative positions in a sequencing dataDeepBreaksInstallationFirst installcondaGo to theAnaconda websiteand download the latest version for your operating system.For Windows users: do not forget to addcondato your systempathSecond is to check for conda availabilityopen a terminal (or command line for Windows users) and run:conda --versionit should out put something like:conda 4.9.2if not, you must makecondaavailable to your system for further steps.
if you have problems adding conda to PATH, you can find instructionshere.Windows Linux MacIf you are using anApple M1/M2 MACplease go to theApple M1/M2 MACfor installation
instructions.If you have a working conda on your system, you can safely skip to step three.If you are using windows, please make sure you have both git and Microsoft Visual C++ 14.0 or greater installed.
installgitMicrosoft C++ build toolsIn case you face issues with this step,this linkmay help you.Create a new conda environment (let's call it deepBreaks_env) with the following command:conda create --name deepBreaks_env python=3.9Activate your conda environment:conda activate deepBreaks_envInstalldeepBreaks:
install with pip:pip install deepBreaksor you can directly install if from GitHub:python -m pip install git+https://github.com/omicsEye/deepbreaksApple M1/M2 MACUpdate/install Xcode Command Line Toolsxcode-select --installInstallBrew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install libraries for brewbrew install cmake libompInstall miniforgebrew install miniforgeClose the current terminal and open a new terminalCreate a new conda environment (let's call it deepBreaks_env) with the following command:conda create --name deepBreaks_env python=3.9Activate the conda environmentconda activate deepBreaks_envInstall packages from Condaconda install -c conda-forge lightgbm
pip install xgboostFinally, installdeepBreaks:
install with pip:pip install deepBreaksor you can directly install if from GitHub:python -m pip install git+https://github.com/omicsEye/deepbreaksGetting Started with deepBreaksTest deepBreaksTo test if deepBreaks is installed correctly, you may run the following command in the terminal:deepBreaks -hWhich yields deepBreaks command line options.Options$ deepBreaks -hInputusage: deepBreaks [-h] --seqfile SEQFILE --seqtype SEQTYPE --meta_data META_DATA --metavar METAVAR [--gap GAP] [--miss_gap MISS_GAP]
                  [--ult_rare ULT_RARE] --anatype {reg,cl}
                  [--distance_metric {correlation,hamming,jaccard,normalized_mutual_info_score,adjusted_mutual_info_score,adjusted_rand_score}]
                  [--fraction FRACTION] [--redundant_threshold REDUNDANT_THRESHOLD] [--distance_threshold DISTANCE_THRESHOLD]
                  [--top_models TOP_MODELS] [--cv CV] [--separate_cv] [--tune] [--plot] [--write]

options:
  -h, --help            show this help message and exit
  --seqfile SEQFILE, -sf SEQFILE
                        files contains the sequences
  --seqtype SEQTYPE, -st SEQTYPE
                        type of sequence: 'nu' for nucleotides or 'aa' for amino-acid
  --meta_data META_DATA, -md META_DATA
                        files contains the meta data
  --metavar METAVAR, -mv METAVAR
                        name of the meta var (response variable)
  --gap GAP, -gp GAP    Threshold to drop positions that have GAPs above this proportion. Default value is 0.7 and it means that the positions that
                        70% or more GAPs will be dropped from the analysis.
  --miss_gap MISS_GAP, -mgp MISS_GAP
                        Threshold to impute missing values with GAP. Gapsin positions that have missing values (gaps) above this proportionare
                        replaced with the term 'GAP'. the rest of the missing valuesare replaced by the mode of each position.
  --ult_rare ULT_RARE, -u ULT_RARE
                        Threshold to modify the ultra rare cases in each position.
  --anatype {reg,cl}, -a {reg,cl}
                        type of analysis
  --distance_metric {correlation,hamming,jaccard,normalized_mutual_info_score,adjusted_mutual_info_score,adjusted_rand_score}, -dm {correlation,hamming,jaccard,normalized_mutual_info_score,adjusted_mutual_info_score,adjusted_rand_score}
                        distance metric. Default is correlation.
  --fraction FRACTION, -fr FRACTION
                        fraction of main data to run
  --redundant_threshold REDUNDANT_THRESHOLD, -rt REDUNDANT_THRESHOLD
                        threshold for the p-value of the statistical tests to drop redundant features. Defaultvalue is 0.25
  --distance_threshold DISTANCE_THRESHOLD, -dth DISTANCE_THRESHOLD
                        threshold for the distance between positions to put them in clusters. features with distances <= than the threshold will be
                        grouped together. Default values is 0.3
  --top_models TOP_MODELS, -tm TOP_MODELS
                        number of top models to consider for merging the results. Default value is 5
  --cv CV, -cv CV       number of folds for cross validation. Default is 10. If the given number is less than 1,
                        then instead of CV, a train/test split approach will be used with --cv being the test size. 
  
  --tune                After running the 10-fold cross validations, should the top selected models be tuned and finalize, or finalized only?
  --plot                plot all the individual positions that are statistically significant.Depending on your data, this process may produce many
                        plots.
  --write               During reading the fasta file we delete the positions that have GAPs over a certain threshold that can be changed in the
                        `gap_threshold` argumentin the `read_data` function. As this may change the whole FASTA file, you maywant to save the FASTA
                        file after this cleaning step.Outputcorrelated positions. We group all the colinear positions together.models summary. list of models and their performance metrics.plot of the feature importance of the top models inmodelName_dpi.pngformat.csv files of feature importance based on top models containing, feature, importance, relative importance,
group of the position (we group all the colinear positions together)plots and csv file of average of feature importance of top models.box plot (regression) or stacked bar plot (classification) for top positions of each model.pickle files of the plots and final modelsp-values of all the variables used in training of the final modelDemodeepBreaks -sf PATH_TO_SEQUENCE.FASTA -st aa -md PATH_TO_META_DATA.tsv -mv
 META_VARIABLE_NAME -a reg  -dth 0.15 --plot --writeTutorialMultiple detailed jupyter notebook ofdeepBreaksimplementation are available in theexamplesand the
required data for the examples are also available in thedatadirectory.For thedeepBreaks.models.model_comparefunction, these are the available models by default:Regression:models={'rf':RandomForestRegressor(n_jobs=-1,random_state=123),'Adaboost':AdaBoostRegressor(random_state=123),'et':ExtraTreesRegressor(n_jobs=-1,random_state=123),'gbc':GradientBoostingRegressor(random_state=123),'dt':DecisionTreeRegressor(random_state=123),'lr':LinearRegression(n_jobs=-1),'Lasso':Lasso(random_state=123),'LassoLars':LassoLars(random_state=123),'BayesianRidge':BayesianRidge(),'HubR':HuberRegressor(),'xgb':XGBRegressor(n_jobs=-1,random_state=123),'lgbm':LGBMRegressor(n_jobs=-1,random_state=123)}Classification:models={'rf':RandomForestClassifier(n_jobs=-1,random_state=123),'Adaboost':AdaBoostClassifier(random_state=123),'et':ExtraTreesClassifier(n_jobs=-1,random_state=123),'lg':LogisticRegression(n_jobs=-1,random_state=123),'gbc':GradientBoostingClassifier(random_state=123),'dt':DecisionTreeClassifier(random_state=123),'xgb':XGBClassifier(n_jobs=-1,random_state=123),'lgbm':LGBMClassifier(n_jobs=-1,random_state=123)}The default metrics for evaluation are:Regression:scores={'R2':'r2','MAE':'neg_mean_absolute_error','MSE':'neg_mean_squared_error','RMSE':'neg_root_mean_squared_error','MAPE':'neg_mean_absolute_percentage_error'}Classification:scores={'Accuracy':'accuracy','AUC':'roc_auc_ovr','F1':'f1_macro','Recall':'recall_macro','Precision':'precision_macro'}To get the ful list of available metrics, you can use:fromsklearnimportmetricsprint(metrics.SCORERS.keys())The default search parameters for the models are:importnumpyasnpparams={'rf':{'rf__max_features':["sqrt","log2"]},'Adaboost':{'Adaboost__learning_rate':np.linspace(0.001,0.1,num=2),'Adaboost__n_estimators':[100,200]},'gbc':{'gbc__max_depth':range(3,6),'gbc__max_features':['sqrt','log2'],'gbc__n_estimators':[200,500,800],'gbc__learning_rate':np.linspace(0.001,0.1,num=2)},'et':{'et__max_depth':[4,6,8],'et__n_estimators':[500,1000]},'dt':{'dt__max_depth':[4,6,8]},'Lasso':{'Lasso__alpha':np.linspace(0.01,100,num=5)},'LassoLars':{'LassoLars__alpha':np.linspace(0.01,100,num=5)}}Attention:The names of models in the provideddictare the same with the names in thedictprovided
for theparams. If the name from the modelsdictdoes not match, the defaultsklearnparameters for that model
is then used.  For example,model_compare_cvuses thexgboostwith default hyperparameters.To use thedeepBreaks.models.model_compare_cvfunction with default parameters:fromdeepBreaks.modelsimportmodel_compare_cvfromdeepBreaks.preprocessingimportMisCare,ConstantCare,URareCare,CustomOneHotEncoderfromdeepBreaks.preprocessingimportFeatureSelection,CollinearCarefromdeepBreaks.utilsimportget_models,get_scores,get_params,make_pipelineana_type='reg'# assume that we are running a regression analysisreport_dir='PATH/TO/A/DIRECTORY'# to save the reportsprep_pipeline=make_pipeline(cache_dir=None,steps=[('mc',MisCare(missing_threshold=0.25)),('cc',ConstantCare()),('ur',URareCare(threshold=0.05)),('cc2',ConstantCare()),('one_hot',CustomOneHotEncoder()),('feature_selection',FeatureSelection(model_type=ana_type,alpha=0.25)),('collinear_care',CollinearCare(dist_method='correlation',threshold=0.25))])report,top=model_compare_cv(X=tr,y=y,preprocess_pipe=prep_pipeline,models_dict=get_models(ana_type=ana_type),scoring=get_scores(ana_type=ana_type),report_dir=report_dir,cv=10,ana_type=ana_type,cache_dir=None)To use a new set ofmodels,params, ormetricsyou can define them in adict:importdeepBreaks.modelsasmlfromsklearn.ensembleimportRandomForestRegressor,AdaBoostRegressorfromsklearn.ensembleimportExtraTreesRegressorfromdeepBreaks.modelsimportmodel_compare_cvfromdeepBreaks.preprocessingimportMisCare,ConstantCare,URareCare,CustomOneHotEncoderfromdeepBreaks.preprocessingimportFeatureSelection,CollinearCarefromdeepBreaks.utilsimportget_models,get_scores,get_params,make_pipelineana_type='reg'# assume that we are running a regression analysisreport_dir='PATH/TO/A/DIRECTORY'# to save the reports# define a new set of modelsmodels={'rf':RandomForestRegressor(n_jobs=-1,random_state=123),'Adaboost':AdaBoostRegressor(random_state=123),'et':ExtraTreesRegressor(n_jobs=-1,random_state=123)}prep_pipeline=make_pipeline(cache_dir=None,steps=[('mc',MisCare(missing_threshold=0.25)),('cc',ConstantCare()),('ur',URareCare(threshold=0.05)),('cc2',ConstantCare()),('one_hot',CustomOneHotEncoder()),('feature_selection',FeatureSelection(model_type=ana_type,alpha=0.25)),('collinear_care',CollinearCare(dist_method='correlation',threshold=0.25))])report,top=model_compare_cv(X=tr,y=y,preprocess_pipe=prep_pipeline,models_dict=models,scoring=get_scores(ana_type=ana_type),report_dir=report_dir,cv=10,ana_type=ana_type,cache_dir=None)'''Since we do not define a set of parameters for the model "et", it will fit withdefault parameters'''# change the set of metricsscores={'R2':'r2','MAE':'neg_mean_absolute_error','MSE':'neg_mean_squared_error'}report,top=model_compare_cv(X=tr,y=y,preprocess_pipe=prep_pipeline,models_dict=models,scoring=scores,report_dir=report_dir,cv=10,ana_type=ana_type,cache_dir=None)ApplicationsHere we try to use thedeepBreakson different datasets and elaborate on the results.deepBreaksidentifies amino acids associated with color sensitivityOpsins are genes involved in light sensitivity and vision, and when coupled with a light-reactive chromophore, the
absorbance of the resulting photopigment dictates physiological phenotypes like color sensitivity. We analyzed the
amino acid sequence of rod opsins because previously published mutagenesis work established mechanistic connections
between 12 specific amino acid sites and phenotypesYokoyama et al. (2008).
Therefore, we hypothesized that machine learning approaches could predict known associations between amino acid sites
and absorbance phenotypes. We identified opsins expressed in
rod cells of vertebrates (mainly marine fishes) with absorption spectra measurements (λmax, the wavelength with the
highest absorption). The dataset contains 175 samples of opsin sequences. We next applied deepBreaks on this
dataset to find the most important sites contributing to the variations of λmax.
ThisJupyter Notebookillustrates the steps.Novel insights of niche associations in the oral microbiomeMicrobial species tend to adapt at the genome level to the niche in which they live. We hypothesize
that genes with essential functions change based on where microbial species live. Here we use microbial strain
representatives from stool metagenomics data of healthy adults from theHuman Microbiome Project. The input for deepBreaks consists of 1) an MSA file
with 1006 rows, each a representative strain of a specific microbial species, here Haemophilus parainfluenzae, with
49839 lengths; and 2) labels for deepBreaks prediction are body sites from which samples were collected.
ThisJupyter Notebookillustrates the steps.deepBreaksreveals important SARS-CoV-2 regions associated with Alpha and Delta variantsVariants occur with new mutations in the virus genome. Most mutations in the SARS-CoV-2 genome do not affect the
functioning of the virus. However, mutations in the spike protein of SARS-CoV-2, which binds to receptors on cells
lining the inside of the human nose, may make the virus easier to spread or affect how well vaccines protect people.
We are going to study the mutations in the spike protein of the sequences of Alpha (B.1.1.7): the first variant of
concern described in the United Kingdom (UK) in late December 2020 and Delta (B.1.617.2): first reported in India in
December 2020. We used the publicly available data from theGSAIDand obtained 900 sequences
of spike protein region of Alpha (450 samples) and Delta (450 samples) variants. Then, we used deepBreaks to analyze
the data and find the most important (predictive) positions in these sequences in terms of classifying the variants.
ThisJupyter Notebookillustrates the steps.deepBreaksidentifies HIV regions with potentially important functionsSubtypes of the human immunodeficiency virus type 1 (HIV-1) group M are different in the envelope (Env) glycoproteins
of the virus. These parts of the virus are displayed on the surface of the virion and are targets for both neutralizing
antibody and cell-mediated immune responses. The third hypervariable domain (V3) of HIV-1 gp120 is a cysteine-bounded
loop structure usually composed of 105 nucleotides and labeled as the base (nu 1:26 and 75:105), stem
(nu 27:44 and 54:74), and turn (nu 45:53) regionsLynch et al. (2009).
Among all of the hyper-variable regions in gp120 (V1-V5), V3 is playing the main role in the virus infectivityFelsövályi et al. (2006).
Here we useare using deepBreaks to identify important regions in the V3 loop that are important in terms of associating
the V3 sequences V3 to subtypes B and C. We used theLos Alamos HIV Databaseto gather the
nucleotide sequences of the V3 loop of subtypes B and C.
ThisJupyter Notebookillustrates the steps.SupportPlease submit your questions or issues with the software atIssues tracker.For community discussions, questions, and issue reporting, please visit our forumhere