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
# smooth genetic map by mixing it with a bit of constant recombination (separate rec rate for each chromosome) | |
# (the input gmap and pmap are lists of vectors of marker positions) | |
smooth_gmap <- | |
function(gmap, pmap, alpha=0.02) | |
{ | |
stopifnot(is.list(gmap), is.list(pmap)) | |
stopifnot(length(gmap)==length(pmap), all(names(gmap) == names(pmap))) | |
stopifnot(length(alpha)==1, alpha >= 0, alpha <= 1) | |
for(chr in seq(along=gmap)) { | |
g <- gmap[[chr]] |
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
import re | |
import requests | |
from requests_html import HTMLSession | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
session = HTMLSession() | |
r = session.get('https://covidresponse.wisc.edu/dashboard/') |
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
# guess genotypes from allele dosages | |
# | |
# alleleprob = n_ind x n_alleles matrix of allele dosages (rows sum to 1) | |
# epsilon = tolerance value | |
guess_geno_from_alleleprob <- | |
function(alleleprob, epsilon=0.01) | |
{ | |
stopifnot(is.matrix(alleleprob)) # expect ind x allele matrix | |
stopifnot(is.numeric(epsilon), length(epsilon)==1, epsilon >= 0, epsilon <= 1) |
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
# plot strain distribution patterns for SNPs | |
# | |
# pos = vector of SNP positions | |
# sdp = vector of strain distribution patterns | |
# labels = names of the strains | |
# | |
# example usage: | |
# plot_sdp(runif(100, 0, 100), sample(0:255, 100, replace=TRUE)) | |
plot_sdp <- |
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
--- | |
title: "test_plotly" | |
author: "Karl" | |
date: "5/10/2021" | |
output: html_document | |
--- | |
Compile this at command line with | |
``` |
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
# functions for expanding probs and kinship matrices | |
# for individual-level analysis of RILs | |
# create mapping, individuals -> lines | |
# | |
# n = sample size for each line | |
n2mapping <- | |
function(n) | |
{ |
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
library(qtl) | |
# example data set; calculate pairwise rec fracs | |
data(hyper) | |
hyper <- est.rf(hyper) | |
# set up color scale | |
n_colors <- 256 | |
zmax <- 12 | |
lod <- seq(0, zmax, len=n_colors) |
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
# bootstrap of scan1() | |
scan1boot <- | |
function(genoprobs, pheno, kinship=NULL, addcovar=NULL, Xcovar=NULL, intcovar=NULL, | |
weights=NULL, n_boot=1, ...) | |
{ | |
# to contain the results | |
result <- vector("list", n_boot) | |
# drop individuals that are not in common across all data |
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
# find large intervals in a map | |
# | |
# | |
# input: map = list of chromosomes that are vectors of marker positions | |
# [can also be a cross object, in which case pull.map() is used] | |
# min_distance = minimum distance between markers to be flagged | |
# | |
# example use: | |
# library(qtl) | |
# data(hyper) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder