Package: genal-python
genal: A Python Toolkit for Genetic Risk Scoring and Mendelian RandomizationThis project was developed by Cyprien A. RivierTable of contentsIntroductionRequirements for the GENAL moduleInstallation and how to use GENALInstallationTutorial and presentation of the main toolsData loadingData preprocessingClumpingPolygenic Risk ScoringMendelian RandomizationSNP-association testingLiftingIntroductionGenal is a python module designed to make it easy to run genetic risk scores and mendelian randomization analyses. It integrates a collection of tools that facilitate the cleaning of single nucleotide polymorphism data (usually derived from Genome-Wide Association Studies) and enable the execution of clinical population genetic workflows. The functionalities provided by genal include clumping, lifting, association testing, polygenic risk scoring, and Mendelian randomization analyses, all within a single Python module.The module prioritizes user-friendliness and intuitive operation, aiming to reduce the complexity of data analysis for researchers. Despite its focus on simplicity, Genal does not sacrifice the depth of customization or the precision of analysis. Researchers can expect to maintain analytical rigour while benefiting from the streamlined experience.Genal draws on concepts from well-established R packages such as TwoSampleMR, MR-Presso, MendelianRandomization, and gwasvcf, adapting their proven methodologies to the Python environment. This approach ensures that users have access to tried and tested techniques with the versatility of Python's data science tools.Requirements for the GENAL modulePython 3.9 or later.https://www.python.org/Installation and How to use the GENAL moduleInstallationDownload and install the package with pip:pip install genal-pythonAnd it can be imported in a python environment with:importgenalThe main genal functionalities require a working installation of PLINK v1.9 that can be downloaded here:https://www.cog-genomics.org/plink/Once downloaded, the path to the plink executable can be set with:genal.set_plink(path="/path/to/plink/executable/file")TutorialFor this tutorial, we will build a Polygenic Risk Score (PRS) for systolic blood pressure (SBP) and investigate its genetically-determined effect on the risk of stroke. We will utilize summary statistics from Genome-Wide Association Studies (GWAS) and individual-level data from the UK Biobank. The steps include:Data loadingData preprocessingPerform checks and cleaning operations on SNP-level data for appropriate formattingClump data to identify significant, independent SNPs as genetic instruments for SBPBuild a genomic risk score for SBP in a test populationInclude risk score calculations with proxiesPerform Mendelian RandomizationAnalyze SBP as an exposure and acute ischemic stroke as an outcomePlot the resultsConduct sensitivity analyses using the weighted median, MR-Egger, and MR-PRESSO methodsCalibrate SNP-trait weights with individual-level genetic dataExecute single-SNP association tests for calibrating SBP genetic instrumentsUtility tools demonstrationData lifting to another genomic buildIn pure PythonUsing LiftOverPhenoscanner (to be added)Data loadingWe begin with publicly available summary statistics from a large GWAS study of systolic blood pressure.Link to study. After downloading and unzipping the summary statistics, we load them into a pandas DataFrame:importpandasaspdsbp_gwas=pd.read_csv("Evangelou_30224653_SBP.txt",sep=" ")sbp_gwas.head(5)MarkerNameAllele1Allele2Freq1EffectStdErrPTotalSampleSizeN_effective10:100000625:SNPag0.56600.05230.03030.08394073817073684710:100000645:SNPac0.79360.02000.03720.59110073816873501810:100003242:SNPtg0.88310.14170.04690.00252673816873307010:100003304:SNPag0.96090.02450.08380.76980073705466380910:100003785:SNPtc0.6406-0.06800.03130.029870738169735681We can now load this data into agenal.Genoobject. Thegenal.Genoclass is the central piece of the package. It is designed to store Single Nucleotide Polymorphisms (SNP) data and make it easy to preprocess and clean.Thegenal.Genotakes as input a pandas dataframe where each row corresponds to a SNP, with columns describing the position and possibly the effect of the SNP for the given trait (SBP in our case). To indicate the names of the columns, the following arguments can be passed:CHR: Column name for chromosome. Defaults to "CHR".POS: Column name for genomic position. Defaults to "POS".SNP: Column name for SNP identifier (rsid). Defaults to "SNP".EA: Column name for effect allele. Defaults to "EA".NEA: Column name for non-effect allele. Defaults to "NEA".BETA: Column name for effect estimate. Defaults to "BETA".SE: Column name for effect standard error. Defaults to "SE".P: Column name for effect p-value. Defaults to "P".EAF: Column name for effect allele frequency. Defaults to "EAF".After inspecting the dataframe, we first need to extract the chromosome and position information from the "MarkerName" column into two new columns "CHR" and "POS":sbp_gwas[["CHR","POS","Filler"]]=sbp_gwas["MarkerName"].str.split(":",expand=True)sbp_gwas.head(5)MarkerNameAllele1Allele2Freq1EffectStdErrPTotalSampleSizeN_effectiveCHRPOSFiller10:100000625:SNPag0.56600.05230.03030.08394073817073684710100000625SNP10:100000645:SNPac0.79360.02000.03720.59110073816873501810100000645SNP10:100003242:SNPtg0.88310.14170.04690.00252673816873307010100003242SNP10:100003304:SNPag0.96090.02450.08380.76980073705466380910100003304SNP10:100003785:SNPtc0.6406-0.06800.03130.02987073816973568110100003785SNPAnd it can now be loaded into agenal.Genoobject:importgenalSBP_Geno=genal.Geno(sbp_gwas,CHR="CHR",POS="POS",EA="Allele1",NEA="Allele2",BETA="Effect",SE="StdErr",P="P",EAF="Freq1",keep_columns=False)The last argument (keep_columns = False) indicates that we do not wish to keep the other (non-main) columns in the dataframe.Note:Make sure to read the readme file usually provided with the summary statistics to identify the correct columns. It is particularly important to correctly identify the allele that represents the effect allele. Also, you do not need all columns to move forward, as some can be inputted as we will see next.Data preprocessingNow that we have loaded the data into agenal.Genoobject, we can begin cleaning and formatting it. Methods such as Polygenic Risk Scoring or Mendelian Randomization require the SNP data to be in a specific format. Also, raw summary statistics can sometimes contain missing or invalid values that need to be handled. Additionally, some columns may be missing from the data (such as the SNP rsid column, or the non-effect allele column) and these columns can be created based on existing ones and a reference panel.Genal can run all the basic cleaning and preprocessing steps in one command:SBP_Geno.preprocess_data(preprocessing='Fill_delete')Thepreprocessingargument specifies the global level of preprocessing applied to the data:preprocessing = 'None': The data won't be modified.preprocessing = 'Fill': Missing columns will be added based on reference data and invalid values set to NaN, but no rows will be deleted.preprocessing = 'Fill_delete': Missing columns will be added, and all rows containing missing, duplicated, or invalid values will be deleted. This option is recommended before running genetic methods.By default, and depending on the global preprocessing level ('None', 'Fill', 'Fill_delete') chosen, thepreprocess_datamethod ofgenal.Genowill run the following checks:Ensure the CHR (chromosome) and POS (genomic position) columns are integers.Ensure the EA (effect allele) and NEA (non-effect allele) columns are uppercase characters containing A, T, C, G letters. Multiallelic values are set to NaN.Validate the P (p-value) column for proper values.Check for no duplicated SNPs based on rsid.Determine if the BETA (effect) column contains beta estimates or odds ratios, and log-transform odds ratios if necessary.Create SNP column using a reference panel if CHR and POS columns are present.Create CHR and/or POS column using a reference panel if SNP column is present.Create NEA (non-effect allele) column using a reference panel if EA (effect allele) column is present.Create the SE (standard-error) column if the BETA and P (p-value) columns are present.Create the P column if the BETA and SE columns are present.If you do not wish to run certain steps, or wish to run only certain steps, you can use additional arguments. For more information, please refer to thegenal.Geno.preprocess_datamethod in the API documentation.In our case, the SNP column (for SNP identifier - rsid) was missing from our dataframe and has been added based on a 1000 genome reference panel:Using the EUR reference panel.
The SNP column (rsID) has been created. 197511(2.787%) SNPs were not found in the reference data and their ID set to CHR:POS:EA.
The BETA column looks like Beta estimates. Use effect_column='OR' if it is a column of Odds Ratios.You can always check the data of agenal.Genoobject by accessing the 'data' attribute:SBP_Geno.dataEANEAEAFBETASEPCHRPOSSNP0AG0.56600.05230.03030.08394010100000625rs78996321AC0.79360.02000.03720.59110010100000645rs618753092TG0.88310.14170.04690.00252610100003242rs122586513AG0.96090.02450.08380.76980010100003304rs728284614TC0.6406-0.06800.03130.02987010100003785rs1359508............................7088120AG0.9028-0.01840.05170.722300999999468rs10981301And we see that the SNP column with the rsids has been added based on the reference data.
You do not need to obtain the 1000 genome reference panel yourself, Genal will download it the first time you use it. By default, the reference panel used is the european (eur) one. You can specify another valid reference panel (afr, eas, sas, amr) with the reference_panel argument:SBP_Geno.preprocess_data(preprocessing='Fill_delete',reference_panel="afr")You can also use a custom reference panel by specifying to the reference_panel argument a path to bed/bim/fam files (without the extension).ClumpingClumping is the step at which we select the SNPs that will be used as our genetic instruments in future Polygenic Risk Scores and Mendelian Randomization analyses. The process involves identifying the SNPs that are strongly associated with our trait of interest (systolic blood pressure in this tutorial) and are independent from each other. This second step ensures that selected SNPs are not highly correlated, (i.e., they are not in close linkage disequilibrium). For this step, we again need to use a reference panel.The SNP-data loaded in agenal.Genoobject can be clumped using thegenal.Geno.clumpmethod. It will return anothergenal.Genoobject containing only the clumped data:SBP_clumped=SBP_Geno.clump(p1=5e-8,r2=0.1,kb=250,reference_panel="eur")It will output the number of instruments obtained::Using the EUR reference panel.
Warning: 760  top variant IDs missing
1545 clumps formed from 73594 top variants.You can specify the thresholds you want to use for the clumping with the following arguments:p1: P-value threshold during clumping. SNPs with a P-value higher than this value are excluded.r2: Linkage disequilibrium threshold for the independence check. Takes values between 0 and 1.kb: Genomic window used for the independence check (the unit is thousands of base-pair positions).reference_panel: The reference population used to derive linkage disequilibrium values and select independent SNPs.Polygenic Risk ScoringComputing a Polygenic Risk Score (PRS) can be done in one line with thegenal.Geno.prsmethod:SBP_clumped.prs(name="SBP_prs",path="path/to/genetic/files")The genetic files of the target population can be either one triple of bed/bim/fam files containing information for all SNPs, or they can be divided by chromosome (one bed/bim/fam triple for chr 1, another for chr 2, etc...). In the latter case, provide the path by replacing the chromosome number by '$' and Genal will extract the necessary SNPs from each chromosome and merge them before running the PRS. For instance, if the genetic files are namedPop_chr1.bed,Pop_chr1.bim,Pop_chr1.fam,Pop_chr2.bed, ..., you can use:SBP_clumped.prs(name="SBP_prs",path="Pop_chr$")Thenameargument specifies the name of the .csv file that will be saved with the individual risk scores.
The output of thegenal.Geno.prsmethod will include how many SNPs were used to compute the risk score. It can happen that some of the SNPs are multiallelic in the genetic data (even if they are not multiallelic in our SNP data) and need to be excluded. It can also happen that some of the SNPs are missing from the genetic files of the target population (for instance if the data has not been imputed):CHR/POS columns present: SNPs searched based on genomic positions.
Extracting SNPs for each chromosome...
SNPs extracted for chr1.
SNPs extracted for chr2.
SNPs extracted for chr3.
SNPs extracted for chr4.
SNPs extracted for chr5.
SNPs extracted for chr6.
SNPs extracted for chr7.
SNPs extracted for chr8.
SNPs extracted for chr9.
SNPs extracted for chr10.
SNPs extracted for chr11.
SNPs extracted for chr12.
SNPs extracted for chr13.
SNPs extracted for chr14.
SNPs extracted for chr15.
SNPs extracted for chr16.
SNPs extracted for chr17.
SNPs extracted for chr18.
SNPs extracted for chr19.
SNPs extracted for chr20.
SNPs extracted for chr21.
SNPs extracted for chr22.
Merging SNPs extracted from each chromosome...
Created bed/bim/fam fileset with extracted SNPs: tmp_GENAL/4f4ce6a7_allchr
Extraction completed. 786(50.874%) SNPs were not extracted from the genetic data.
Computing a weighted PRS using tmp_GENAL/4f4ce6a7_allchr data.
The PRS computation was successful and used 759/1545 (49.126%) SNPs.
PRS data saved to SBP_prs.csvHere, we see that about half of the SNPs were not extracted from the data. In such cases, we may want to try and salvage some of these SNPs by looking for proxies (SNPs in high linkage disequilibrium, i.e. highly correlated SNPs). This can be done by specifying the 'proxy = True' argument:SBP_clumped.prs(name="SBP_prs",path="Pop_chr$",proxy=True,reference_panel="eur",r2=0.8,kb=5000,window_snps=5000)and the output is:CHR/POS columns present: SNPs searched based on genomic positions.
Identifying the SNPs present in the genetic data...
759 SNPs out of 1545 are present in the genetic data.
Searching proxies for 786 SNPs...
Using the EUR reference panel.
Filtering the potential proxies with the searchspace provided.
Found proxies for 578 missing SNPs.
7(0.455%) duplicated SNPs have been removed. Use keep_dups=True to keep them.
Extracting SNPs for each chromosome...
SNPs extracted for chr1.
SNPs extracted for chr2.
SNPs extracted for chr3.
SNPs extracted for chr4.
SNPs extracted for chr5.
SNPs extracted for chr6.
SNPs extracted for chr7.
SNPs extracted for chr8.
SNPs extracted for chr9.
SNPs extracted for chr10.
SNPs extracted for chr11.
SNPs extracted for chr12.
SNPs extracted for chr13.
SNPs extracted for chr14.
SNPs extracted for chr15.
SNPs extracted for chr16.
SNPs extracted for chr17.
SNPs extracted for chr18.
SNPs extracted for chr19.
SNPs extracted for chr20.
SNPs extracted for chr21.
SNPs extracted for chr22.
Merging SNPs extracted from each chromosome...
Created bed/bim/fam fileset with extracted SNPs: tmp_GENAL/4f4ce6a7_allchr
Extraction completed. 208(13.524%) SNPs were not extracted from the genetic data.
Computing a weighted PRS using tmp_GENAL/4f4ce6a7_allchr data.
The PRS computation was successful and used 1330/1538 (86.476%) SNPs.
PRS data saved to SBP_prs.csvIn our case, we have been able to find proxies for 571 of the 786 SNPs that were missing in the population genetic data (7 potential proxies have been removed because they were identical to SNPs already present in our data).You can customize how the proxies are chosen with the following arguments:reference_panel: The reference population used to derive linkage disequilibrium values and find proxies.kb: Width of the genomic window to look for proxies (in thousands of base-pair positions).r2: Minimum linkage disequilibrium value with the original SNP for a proxy to be included.window_snps: Width of the window to look for proxies (in number of SNPs).Note:You can call thegenal.Geno.prsmethod on anyGenoobject (containing at least the EA, BETA, and either SNP or CHR/POS columns). The data does not need to be clumped, and there is no limit to the number of instruments used to compute the scores.Mendelian RandomizationTo run MR, we need to load both our exposure and outcome SNP-level data ingenal.Genoobjects. In our case, the genetic instruments of the MR are the SNPs associated with blood pressure at genome-wide significant levels resulting from the clumping of the blood pressure GWAS. They are stored in ourSBP_clumpedgenal.Genoobject which also include their association with the exposure trait (instrument-SBP estimates in the BETA column).To get their association with the outcome trait (instrument-stroke estimates), we are going to use SNP-level data from a large GWAS of stroke performed by the GIGASTROKE consortium (https://www.nature.com/articles/s41586-022-05165-3):stroke_gwas=pd.read_csv("GCST90104539_buildGRCh37.tsv",sep="\t")We inspect it to determine the column names:chromosomebase_pair_locationeffect_allele_frequencybetastandard_errorp_valueodds_ratioci_lowerci_uppereffect_alleleother_allele5294392750.35690.00300.00700.66581.0030050.9893371.016861TC5859288920.0639-0.01520.01370.26860.9849150.9588201.011720TC101283412320.46130.00250.00650.69981.0025030.9898121.015357TC3627075190.05360.01520.01520.31771.0153160.9855141.046019TC2804641200.97890.00570.02540.82231.0057160.9568741.057052TGWe load it in agenal.Genoobject:Stroke_Geno=genal.Geno(stroke_gwas,CHR="chromosome",POS="base_pair_location",EA="effect_allele",NEA="other_allele",BETA="beta",SE="standard_error",P="p_value",EAF="effect_allele_frequency",keep_columns=False)We preprocess it as well to put it in the correct format and make sure there is no invalid values:Stroke_Geno.preprocess_data(preprocessing='Fill_delete')Now, we need to extract our instruments (SNPs of the SBP_clumped data) from the outcome data to obtain their association with the outcome trait (stroke). It can be done by calling thegenal.Geno.query_outcomemethod:SBP_clumped.query_outcome(Stroke_Geno,proxy=False)Genal will print how many SNPs were successfully found and extracted from the outcome data:Outcome data successfully loaded from 'b352e412' geno object.
Identifying the exposure SNPs present in the outcome data...
1541 SNPs out of 1545 are present in the outcome data.
(Exposure data, Outcome data, Outcome name) stored in the .MR_data attribute.Here as well you have the option to use proxies for the instruments that are not present in the outcome data:SBP_clumped.query_outcome(Stroke_geno,proxy=True,reference_panel="eur",kb=5000,r2=0.6,window_snps=5000)And Genal will print the number of missing instruments which have been proxied:Outcome data successfully loaded from 'b352e412' geno object.
Identifying the exposure SNPs present in the outcome data...
1541 SNPs out of 1545 are present in the outcome data.
Searching proxies for 4 SNPs...
Using the EUR reference panel.
Found proxies for 4 SNPs.
(Exposure data, Outcome data, Outcome name) stored in the .MR_data attribute.After extracting the instruments from the outcome data, the SBP_clumpedgenal.Genoobject contains an 'MR_data' attribute containing the instruments-exposure and instruments-outcome associations necessary to run MR. Running MR is now as simple as calling thegenal.Geno.MRmethod of the SBP_clumpedgenal.Genoobject:SBP_clumped.MR(action=3,exposure_name="SBP",outcome_name="Stroke_eur")Thegenal.Geno.MRmethod returns a dataframe containing the estimates and p-values for different MR methods:exposureoutcomemethodnSNPbsepvalSBPStroke_eurInverse-Variance Weighted13120.0233940.001132<e-100SBPStroke_eurInverse Variance weighted (Fixed effects)13120.0233940.000807<e-100SBPStroke_eurUnweighted regression13120.0217640.0786480.781986SBPStroke_eurWeighted Median13120.0228910.001423<e-100SBPStroke_eurPenalised weighted median13120.0215250.001432<e-100SBPStroke_eurSimple median13120.0214800.001364<e-100SBPStroke_eurSign concordance test13120.373476NaN0.0SBPStroke_eurMR Egger13120.0293120.003063<e-100SBPStroke_eurEgger Intercept1312-0.0017990.0008650.037777SBPStroke_eurMR Egger bootstrap13120.0303420.002093<e-100SBPStroke_eurEgger Intercept bootstrap1312-0.0027580.0007400.0015You can specify several arguments. We refer to the API for a full list, but the most important one is the 'action' argument. It determines how palindromic SNPs are treated during the exposure-outcome harmonization step. Palindromic SNPs are SNPs where the nucleotide change reads the same forward and backward on complementary strands of DNA (for instance EA = 'A' and NEA = 'T').action = 1: Palindromic SNPs are not treated (assumes all alleles are on the forward strand)action = 2: Uses effect allele frequencies to attempt to flip them (conservative, default)action = 3: Removes all palindromic SNPs (very conservative)If you choose the option 2 or 3 (recommended), Genal will print the list of palindromic SNPs that have been removed from the analysis.By default, all MR methods (inverse-variance weighted, weighted median, MR-Egger, etc.) are going to be run. But if you do not wish to run all of them, you can specify a 'methods' argument. More details in thegenal.Geno.MRAPI.For more fine-tuning, such as settings for the number of boostrapping iterations, please refer to the API.If you want to visualize the obtained MR results, you can use thegenal.Geno.MR_plotmethod that will plot each SNP in an effect_on_exposure x effect_on_outcome plane as well as lines corresponding to different MR methods:SBP_clumped.MR_plot(filename="MR_plot_SBP_AS")You can select which MR methods you wish to plot with the 'methods' argument. Note that for an MR method to be plotted, they must be included in the latestgenal.Geno.MRcall of thisgenal.Genoobject.If you wish to include the heterogeneity values (Cochran's Q) in the results, you can use the heterogeneity argument in thegenal.Geno.MRcall. Here, the heterogeneity for the inverse-variance weighted method:SBP_clumped.MR(action=3,methods=["IVW"],exposure_name="SBP",outcome_name="Stroke_eur",heterogeneity=True)And that will give:exposureoutcomemethodnSNPbsepvalQQ_dfQ_pvalSBPStroke_eurInverse-Variance Weighted13120.0233940.001132<e-1002583.7402681311<e-100As expected, many MR methods indicate that SBP is strongly associated with stroke, but there are some signs of horizontal pleiotropy (instruments influencing the outcome through a different pathway than the one used as exposure) given the significant MR-Egger intercept p-value.
To investigate horizontal pleiotropy in more details, a very useful method is Mendelian Randomization Pleiotropy RESidual Sum and Outlier (MR-PRESSO). MR-PRESSO is a method designed to detect and correct for horizontal pleiotropy. It will identify which instruments are likely to be pleiotropic on their effect on the outcome, and it will rerun an inverse-variance weighted MR after excluding them. It can be run using thegenal.Geno.MRpressomethod:SBP_clumped.MRpresso(action=3)As with thegenal.Geno.MRmethod, theactionargument determines how the pleiotropic SNPs will be treated. The output is a list containing:A table containing the original and outlier-corrected inverse variance-weighted results.The global test p-value indicating the presence of horizontal pleiotropy.A dataframe of p-values, one for each instrument, representing the likelihood that this instrument is pleiotropic (only relevant if the global test is significant).A dictionary containing the outputs of the distortion test. This test assesses whether the removal of the pleiotropic instruments has significantly altered the original MR estimate.An array containing the indices of the pleiotropic SNPs.The coefficient of the distortion test.The p-value of the distortion test.SNP-association testingWe may want to calibrate instrument-trait estimates in a specific population for which we have individual-level data (genetic files as well as phenotypic data). For instance, if the GWAS of SBP was done in a european population, we may want to adjust the estimates based on data coming from a population of a different ancestry. This can be done in 2 steps:Loading the phenotypic data in a dataframe and calling thegenal.Geno.set_phenotypemethodCalling thegenal.Geno.association_testmethod to run the association tests and update the estimates
Let's start by loading phenotypic data::df_pheno=pd.read_csv("path/to/trait/data")Note:One important detail is to make sure that the individual IDs are identical between the phenotypic data and the genetic data for the target population.Then, it is advised to make a copy of thegenal.Genoobject containing our instruments as we are going to update their coefficients and to avoid any confusion:SBP_adjusted=SBP_clumped.copy()We can then call thegenal.Geno.set_phenotypemethod, specifying which column contains our trait of interest (for the association testing) and which column contains the IDs:SBP_adjusted.set_phenotype(df_pheno,PHENO="htn",IID="IID")At this point, Genal will identify if the phenotype is binary or quantitative (to determine the regression model. If the phenotype is binary, it will assume that the most frequent value is coding for control (and the other value for case), this can be changed with 'alternate_control=True':Detected a binary phenotype in the 'PHENO' column. Specify 'PHENO_type="quant"' if this is incorrect.
Identified 0 as the control code in 'PHENO'. Set 'alternate_control=True' to inverse this interpretation.
The phenotype data is stored in the .phenotype attribute.We can then run the association tests, specifying the path to the genetic files in plink format, and any columns we may want to include as covariates in the regression tests:SBP_adjusted.association_test(covar=["age"],path="path/to/genetic/files")Genal will print information regarding the number of individuals used in the tests and the kind of tests performed. It is advised to make sure that these information are consistent with your data:CHR/POS columns present: SNPs searched based on genomic positions.
Extracting SNPs for each chromosome...
SNPs extracted for chr1.
SNPs extracted for chr2.
SNPs extracted for chr3.
SNPs extracted for chr4.
SNPs extracted for chr5.
SNPs extracted for chr6.
SNPs extracted for chr7.
SNPs extracted for chr8.
SNPs extracted for chr9.
SNPs extracted for chr10.
SNPs extracted for chr11.
SNPs extracted for chr12.
SNPs extracted for chr13.
SNPs extracted for chr14.
SNPs extracted for chr15.
SNPs extracted for chr16.
SNPs extracted for chr17.
SNPs extracted for chr18.
SNPs extracted for chr19.
SNPs extracted for chr20.
SNPs extracted for chr21.
SNPs extracted for chr22.
Merging SNPs extracted from each chromosome...
Created bed/bim/fam fileset with extracted SNPs: tmp_GENAL/e415aab3_allchr
39131 individuals are present in the genetic data and have a valid phenotype trait.
Running single-SNP logistic regression tests on tmp_GENAL/e415aab3_allchr data with adjustment for: ['age'].
The BETA, SE, P columns of the .data attribute have been updated.The SBP_adjusted.data attribute has been updated in the BETA, SE, and P columns with the results of the association tests.LiftingIt is sometimes necessary to lift the SNP data to a different build. For instance, if the genetic data of our target population is in build 38 (hg38), but the GWAS summary statistics are in build 37 (hg19).
This can easily be done in Genal using thegenal.Geno.liftmethod:SBP_clumped.lift(start="hg19",end="hg38",replace=False)This outputs a table with the lifted SBP instruments (stored in theSBP_clumpedobject) from build 37 (hg19) to build 38 (hg38). We specifiedreplace = Falseto not modify theSBP_clumped.dataattribute, but we may want to modify it (before running a PRS in a population stored in build 38 for instance). Genal will download the appropriate chain files required for the lift, and it will be done in pure python by default. However, if you plan to lift large datasets of SNPs (the whole summary statistics for instance), it may be useful to install the LiftOver executable that will run faster than the pure python version. It can be downloaded here:https://genome-store.ucsc.edu/You will need to create an account, scroll down to "LiftOver program", add it to your cart, and declare that you are a non-profit user.You can specify the path of the LiftOver executable to theliftover_pathargument:SBP_Geno.lift(start="hg19",end="hg38",replace=False,liftover_path="path/to/liftover/exec")