This file contains hidden or 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 Bio import Entrez | |
| import csv | |
| from collections import defaultdict | |
| from datetime import datetime | |
| AUTHOR_NAME = "Knowles DA" | |
| START_YEAR = datetime.now().year - 4 | |
| EMAIL = "you@example.com" | |
| OUTFILE = "nsf_coauthors.csv" |
This file contains hidden or 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
| matplotlib | |
| numpy==1.26.4 | |
| pandas | |
| scanpy | |
| scikit_learn | |
| scipy | |
| plotnine | |
| seaborn | |
| jupyterlab | |
| Cython |
This file contains hidden or 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
| function mmwrite(filename,A) | |
| mmfile = fopen(filename,'w'); | |
| [M,N] = size(A); | |
| [I,J,V] = find(A); | |
| NZ = length(V); | |
This file contains hidden or 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
| #!/bin/bash | |
| bcftools view -H input.vcf.gz | \ | |
| awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6 "\t" $7 "\t" $8 "\t" $9 "\t" "0/1"}' | \ | |
| cat <(bcftools view -h -s SOME_SAMPLE input.vcf.gz) - | \ | |
| bgzip > \ | |
| output.vcf.gz | |
| bcftools view -H output.vcf.gz | awk '{ print $1 "\t" $2 - 1 "\t" $2 }' | bgzip > output.bed.gz |
This file contains hidden or 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
| import pyro | |
| from pyro.infer import SVI, Trace_ELBO, TraceEnum_ELBO, config_enumerate | |
| from torch.distributions import constraints | |
| data = 2. * torch.Tensor( [-1., -0.5, -0.5, .5, .8, 1.] ) | |
| def model(data): | |
| guide_efficacy = pyro.sample('guide_efficacy', dist.Beta(1., 1.).expand([len(data)]).to_event(1) ) | |
| gene_essentiality = pyro.sample("gene_essentiality", dist.Normal(0., 5.)) | |
| mean = gene_essentiality * guide_efficacy |
This file contains hidden or 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
| require(VariantAnnotation) | |
| require(GenomicRanges) | |
| get_cis_geno = function(tab, chrom, left, right, genome_build = "GRCh38") { | |
| gr = GRanges(chrom, IRanges(left, right)) | |
| sp = ScanVcfParam(which = gr) | |
| vcf = readVcf(tab, genome_build, param = sp) | |
| gt = geno(vcf)$GT | |
| if (nrow(gt) == 0) return(NULL) | |
| allele1 = substr(gt, 1, 1) |
This file contains hidden or 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
| #' Consistent implementation of diag | |
| fix_diag=function(x) { | |
| if(length(x)==1) matrix(x) else diag(x) | |
| } | |
| unscale = function(x) { | |
| x = sweep(x, 1, attr(x, "scaled:scale"), "*") | |
| sweep(x, 1, attr(x, "scaled:center"), "+") | |
| } |
This file contains hidden or 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
| def pixel_shuffle_1d(x, upscale_factor): | |
| batch_size, channels, steps = x.size() | |
| channels //= upscale_factor | |
| input_view = x.contiguous().view(batch_size, channels, upscale_factor, steps) | |
| shuffle_out = input_view.permute(0, 1, 3, 2).contiguous() | |
| return shuffle_out.view(batch_size, channels, steps * upscale_factor) |
This file contains hidden or 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
| #!/bin/bash | |
| set -e | |
| outfile=$2 | |
| if [ "$#" -eq 1 ]; then | |
| outfile=$1 | |
| fi | |
| gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dCompatibilityLevel=1.5 -sOutputFile=temp.pdf $1 | |
| # so you can run on the same file | |
| mv temp.pdf $outfile |
This file contains hidden or 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
| library(ggplot2) ## devtools::install_github("hadley/ggplot2) | |
| library(grid) ## rasterGrob | |
| library(EBImage) ## readImage | |
| library(ggthemes) ## theme_minimal | |
| ## ########## | |
| ## INDEPENDENT CODE TO BE SOURCED: | |
| ## ########## | |
| # user-level interface to the element grob |