{"id":18360970,"url":"https://github.com/mmkim1210/isoform-genetics","last_synced_at":"2026-02-14T18:31:52.624Z","repository":{"id":133609766,"uuid":"474584223","full_name":"mmkim1210/isoform-genetics","owner":"mmkim1210","description":"👨🏻‍👩🏻‍👧🏻‍👦🏻Heritability + genetic correlation analyses for 🧠human brain isoform expression","archived":false,"fork":false,"pushed_at":"2025-01-03T21:36:50.000Z","size":99059,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-13T17:10:00.187Z","etag":null,"topics":["autism","bipolar","gwas","isoforms","rna-seq","schizophrenia"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmkim1210.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-27T08:57:42.000Z","updated_at":"2025-01-03T21:36:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"4fc221f2-06a0-4dfc-ac83-224be112624f","html_url":"https://github.com/mmkim1210/isoform-genetics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mmkim1210/isoform-genetics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmkim1210%2Fisoform-genetics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmkim1210%2Fisoform-genetics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmkim1210%2Fisoform-genetics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmkim1210%2Fisoform-genetics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmkim1210","download_url":"https://codeload.github.com/mmkim1210/isoform-genetics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmkim1210%2Fisoform-genetics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29452371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autism","bipolar","gwas","isoforms","rna-seq","schizophrenia"],"created_at":"2024-11-05T22:30:38.569Z","updated_at":"2026-02-14T18:31:52.607Z","avatar_url":"https://github.com/mmkim1210.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# isoform-genetics\n\nThis repository contains code and instructions for heritability and genetic correlation analyses, using the \u003ca href=\"https://github.com/Hua-Zhou/MultiResponseVarianceComponentModels.jl\"\u003e\u003cimg src=\"assets/MRVCModels-logo.svg\" width=\"40em\"\u003e MultiResponseVarianceComponentModels.jl \u003c/a\u003e \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia \u003c/a\u003epackage and applying it to the [PsychENCODE brain gene and isoform expression data](http://resource.psychencode.org/). There is a great number of primary literature, review papers, and educational materials that explain in broad strokes the heuristics of heritability and genetic correlation analyses. Briefly, heritability captures the degree of genetic effects, while genetic correlation captures the extent of shared genetic influences or genetic overlap and pleiotropy. If you are interested more in technical details with clarity in presentation and mathematical notation, please take a look at the **Methods** section of the associated paper [Kim et al. 2022](#references). All analyses herein were conducted solely using \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia\u003c/a\u003e. If you have any questions, let me know via my email mmkim1210@gmail.com.\n\n## Getting started\n[To install necessary packages and activate a separate environment](https://pkgdocs.julialang.org/v1/environments/#Using-someone-else's-project), open \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia\u003c/a\u003e within the directory and type:\n```julia\njulia\u003e ]\n(@v1.10) pkg\u003e activate .\n(isoform-genetics) pkg\u003e instantiate\n```\n## Required data\nSome data like [GENCODE](https://www.gencodegenes.org/human/) is automatically downloaded when it is missing, whereas other data like the ones below are not publicly accessible and need to be made available before running any \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia \u003c/a\u003ecode. See below for some notes on these required data.\n\n    data\n    ├── expression\n    │   ├── PsychENCODE-EUR-gene.BED.gz                                                 # normalized PsychENCODE gene expression\n    │   ├── PsychENCODE-EUR-isoform.BED.gz                                              # normalized PsychENCODE isoform expression\n    │   └── PsychENCODE-EUR-covariates.tsv                                              # covariates for mean (or fixed) effects\n    ├── genotype\n    │   └── Capstone4.HRC.European.unique.frontal.nochr.filter.unrelated.{bed,bim,fam}  # PsychENCODE genotype data\n    ├── 1kg\n    │   └── kgp.EUR.maf0.05.geno.{bed,bim,fam}                                          # 1000 Genomes data subsetted to European individuals\n    └── gwas                                                                            # GWAS summary statistics\n\n**Couple notes:**\n- `PsychENCODE-EUR-gene.BED.gz` and `PsychENCODE-EUR-isoform.BED.gz`: [RNA-seq reads were previously aligned](https://www.science.org/doi/10.1126/science.aat8127) to the hg19 reference genome with STAR 2.4.2a and gene and isoform-level quantifications calculated using RSEM v1.2.29. Genes and isoforms were filtered to include those with TPM \u003e 0.1 in at least 25% of samples. Gene and isoform expression were separately normalized using TMM normalization in edgeR and log2-transformed. RNA-seq data was also restricted to frontal cortex samples from European individuals as well as genes and isoforms belonging to autosomal chromosomes, resulting in a total of **24,905 genes and 93,293 isoforms** based on GENCODE v19 annotation.\n- `PsychENCODE-EUR-covariates.tsv`: The same set of known biological and technical covariates were used for mean or fixed effects, which include age, age\u003csup\u003e2\u003c/sup\u003e, study, sex, diagnosis, RNA integrity number (RIN), RIN\u003csup\u003e2\u003c/sup\u003e, post-mortem interval (PMI), 24 sequencing principal components (PCs), and 5 genetic PCs.\n- `Capstone4.HRC.European.unique.frontal.nochr.filter.unrelated.{bed,bim,fam}`: [Genotype data were previously harmonized](https://www.science.org/doi/10.1126/science.aat8464) through phasing and imputation with the Haplotype Reference Consortium (HRC) reference panel. We focused on 860 unique European individuals with matching genotype and frontal cortex RNA-seq data. We started with 5,312,508 HRC imputed SNPs and filtered for SNPs with minor allele frequency (MAF) \u003e 0.01, genotype and individual missingness rate \u003c 0.05, and Hardy-Weinberg equilibrium (HWE) *P* values \u003e 10\u003csup\u003e-6\u003c/sup\u003e. Five pairs of individuals had classic genetic relationship matrix (GRM) values \u003e 0.05 when using all filtered SNPs, while 647 pairs of individuals had GRM values \u003e 0.025. We kept one individual from each of five pairs and only SNPs belonging to autosomal chromosomes, resulting in a total of **855 unrelated European individuals and 4,685,674 SNPs** for downstream analyses.\n- `kgp.EUR.maf0.05.geno.{bed,bim,fam}`: Linkage disequilibrium (LD) reference panel based on individuals of European ancestry in the [1000 Genomes Project](https://www.internationalgenome.org/) was generated using https://github.com/mmkim1210/1kg. This data was only used for visualization purpose, and not for actual variance components analysis.\n- `gwas`: [Multiple GWAS summary statistics](https://github.com/mmkim1210/GeneticsMakie.jl/blob/master/src/gwas.jl) were downloaded and harmonized using `mungesumstats!` function of the \u003ca href=\"https://github.com/mmkim1210/GeneticsMakie.jl\"\u003e\u003cimg src=\"assets/GM-logo.svg\" width=\"30em\"\u003e GeneticsMakie.jl \u003c/a\u003e \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia \u003c/a\u003epackage. This data was not required for variance components analysis.\n\n## Variance components analysis\n\u003ca href=\"https://hua-zhou.github.io/MultiResponseVarianceComponentModels.jl/dev/\"\u003e\u003cimg src=\"assets/MRVCModels-logo.svg\" width=\"40em\"\u003e MultiResponseVarianceComponentModels.jl \u003c/a\u003eis a \u003ca href=\"https://julialang.org\"\u003e\u003cimg src=\"https://julialang.org/assets/infra/julia.ico\" width=\"10em\"\u003e Julia \u003c/a\u003epackage for fitting and testing multivariate response variance components linear mixed models of form\n\n$$\\text{vec}\\ \\boldsymbol{Y} \\sim \\mathcal{N}(\\text{vec}(\\boldsymbol{X} \\boldsymbol{B}), \\sum_{i=1}^m \\boldsymbol{\\Gamma}_i \\otimes \\boldsymbol{V}_i),$$\n\nwhere $\\boldsymbol{Y}$ and $\\boldsymbol{X}$ are $n \\times d$ response and  $n \\times p$ predictor matrices, respectively, and $\\boldsymbol{V}_1, \\ldots, \\boldsymbol{V}_m$ are $m$ known $n \\times n$ positive semidefinite matrices. $\\text{vec}\\ \\boldsymbol{Y}$ creates an $nd \\times 1$ vector from $\\boldsymbol{Y}$ by stacking its columns and $\\otimes$ denotes the Kronecker product. The parameters of the model include $p \\times d$ mean effects $\\boldsymbol{B}$ and $d \\times d$ variance components ($\\boldsymbol{\\Gamma}_1, \\dots, \\boldsymbol{\\Gamma}_m$), which \u003ca href=\"https://hua-zhou.github.io/MultiResponseVarianceComponentModels.jl/dev/\"\u003e\u003cimg src=\"assets/MRVCModels-logo.svg\" width=\"40em\"\u003e MultiResponseVarianceComponentModels.jl \u003c/a\u003eestimates through either [minorization-maximization (MM)](https://en.wikipedia.org/wiki/MM_algorithm) or [expectation–maximization (EM)](https://en.wikipedia.org/wiki/Expectation–maximization_algorithm) algorithms. Note that univariate and bivariate response models are subsumed under this multivariate response model when $d$ is one and two, respectively.\n\nHerein, we initially modelled human brain gene and isoform-level expression using univariate variance components linear mixed models with `PsychENCODE-EUR-covariates.tsv` as mean effects covariates and specified three variance components, two of which capture *cis*- and *trans*-SNP genetic effects. In other words, $n = 855$ and $m = 3$. We defined *cis*-SNPs as those within 1 Mb window of gene start and gene end sites, and *trans*-SNPs as all the other SNPs. Based on this definition, **24,754 genes and 93,030 isoforms** had non-zero *cis*-SNPs. The same set of *cis*-SNPs was used for a given gene and its constituent isoforms for direct comparison. The mean number of *cis*-SNPs were 3,264 and 3,274 for these genes and isoforms, respectively. Variance components parameters were estimated using both maximum likelihood (ML) and restricted maximum likelihood (REML) estimation. The maximum number of iterations was set to 3,000. In total, **22,965 genes and 89,926 isoforms** had converged estimates.\n\nWe fitted multivariate variance components linear mixed models as well for isoform-level expression. We similarly specified three variance components, one of which captures *cis*-SNP genetic effects and the other *trans* effects. We used the same set of *cis*-SNPs that were used for univariate models. To reduce computational burden and the number of variance components parameters that need to be estimated, given limited sample size of the PsychENCODE dataset, we ran the multivariate model for isoforms with significant heritability estimates in a univariate model at *P* value \u003c 0.05. This meant modeling up to 23 isoforms or **$d = 23$**. For isoforms that are perfectly correlated in expression, we included only one isoform of the two. Variance components parameters were estimated using REML. Note that the MM algorithm is numerically stable to fit even the non-heritable isoforms, but we chose not to. Lastly, we also fitted pairwise bivariate variance components models with the same scheme as multivariate models. For each gene with at least two heritable isoforms, the model was fit to all pairwise combinations of isoforms. These analyses were conducted by running `./submit.sh` as follows.\n\nThe analyses will require at least $m(nd)^2$ storage space for double-precision floating-point numbers, which in our case corresponds to $3 \\cdot (855 \\cdot 23)^2 \\cdot 8\\text{B} \\div 10^9 \\approx 9.3 \\text{GB}$. Accordingly, $48\\text{GB}$ memory we requested in `./submit.sh` should have been more than sufficient.\n\n```bash\nqsub ./submit.sh\n```\n\n## Figures\nOnce the results are parsed with `./src/parse.jl`, **Figures 1-5** in [Kim et al. 2022](#references) can be reproduced by running `./src/fig{1,2,3,4,5}.jl`, respectively. Then minor edits can be made using `Illustrator` to finalize the figures as follows.\n\n**Figure 1:**\n\u003cp align=\"center\"\u003e\u003cimg width=\"100%\" style=\"border-radius: 5px;\" src=\"assets/fig1.png\"\u003e\u003c/p\u003e\n\n**Figure 2:**\n\u003cp align=\"center\"\u003e\u003cimg width=\"100%\" style=\"border-radius: 5px;\" src=\"assets/fig2.png\"\u003e\u003c/p\u003e\n\n**Figure 3:**\n\u003cp align=\"center\"\u003e\u003cimg width=\"100%\" style=\"border-radius: 5px;\" src=\"assets/fig3.png\"\u003e\u003c/p\u003e\n\n**Figure 4:**\n\u003cp align=\"center\"\u003e\u003cimg width=\"100%\" style=\"border-radius: 5px;\" src=\"assets/fig4.png\"\u003e\u003c/p\u003e\n\n**Figure 5:**\n\u003cp align=\"center\"\u003e\u003cimg width=\"100%\" style=\"border-radius: 5px;\" src=\"assets/fig5.png\"\u003e\u003c/p\u003e\n\n\u003ca name=\"references\"/\u003e\n\n## References\n- M. Kim, D.D. Vo, C.T. Jops, C. Wen, A. Patowary, A. Bhattacharya, C.X. Yap, H. Zhou, and M.J. Gandal: **Multivariate variance components analysis uncovers genetic architecture of brain isoform expression and novel psychiatric disease mechanisms** (2022) ([link](https://www.medrxiv.org/content/10.1101/2022.10.18.22281204v1))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmkim1210%2Fisoform-genetics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmkim1210%2Fisoform-genetics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmkim1210%2Fisoform-genetics/lists"}