Skip to content

Instantly share code, notes, and snippets.

@ce-carey
ce-carey / r_pheno.py
Last active July 13, 2021 18:59
UKB Phenotypic Correlation Matrices
## UKB Phenotypic Correlation Matrices
##
## Generates a phenotypic correlation matrix for all GWAS'ed
## traits, residualized for all GWAS covariates. Also outputs
## a matrix of pairwise N's.
##
## Created by Caitlin E Carey (ccarey@broadinstitute.org)
##
## Last updated 9/27/2019
@akissinger
akissinger / comb_disintegration.py
Last active December 20, 2022 01:36
Demonstration of comb disintegration for causal inference
from sympy import *
from sympy.physics.quantum import TensorProduct
# composition is '*'
# monoidal product
def T(*args):
if len(args) == 0: return Matrix([[1]])
elif len(args) == 1: return args[0]
else: return TensorProduct(*args)