This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gtfparse import read_gtf | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import gzip | |
import subprocess | |
import scipy.stats as stats | |
import argparse | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!require("BiocManager")) | |
install.packages("BiocManager") | |
BiocManager::install("maftools") | |
##download rngtools from https://cran.r-project.org/src/contrib/Archive/rngtools/ | |
install.packages("~/Desktop/nature_commu/rngtools_1.3.1.tar.gz", repos = NULL, type = "source") | |
library(maftools) | |
uvm = read.maf(maf = '.maf') | |
skcm = read.maf(maf = '.maf') | |
# download CanFam3.1 from ftp://ftp.ensembl.org/pub/release-96/gtf/canis_familiaris/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This function sorts the matrix for better visualization of mutual exclusivity across genes | |
memoSort <- function(M) { | |
geneOrder <- sort(rowSums(M), decreasing=TRUE, index.return=TRUE)$ix; | |
scoreCol <- function(x) { | |
score <- 0; | |
for(i in 1:length(x)) { | |
if(x[i]) { | |
score <- score + 2^(length(x)-i); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#be sure to have scikit-allel, pandas, glob intalled | |
import allel | |
import pandas as pd | |
import glob | |
#change this line to match the path for vcf.gz files | |
all_files = glob.glob("*.vcf.gz") | |
#very first vcf for merging | |
file1 = allel.read_vcf(all_files[0]) |