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(lubridate) | |
| library(dplyr) | |
| #fake data as an example, just 4 ranodm dates in the last month | |
| set.seed(123) | |
| fake_data_a <- data.frame(date = today() - sample(30,4), value_a=rnorm(4)) | |
| fake_data_b <- data.frame(date = today() - sample(30,4), value_b=rnorm(4)) | |
| #find all the dates in the window dfeine by fake_data_a | |
| all_dates <- data.frame(date = seq(min(fake_data_a$date), max(fake_data_a$date), by=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
| license: cc-by-4.0 | |
| height: 1800 | |
| scrolling: no | |
| border: yes |
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 base_consensus(alignment, base_index): | |
| """ """ | |
| # get the bases at this position, store in case we want to come back | |
| # and assign the first one as th winner | |
| #n_seqs = len(alignment) | |
| bases = [r[base_index].upper() for r in alignment] | |
| base_c = Counter(bases) | |
| max_count = max(base_c.values()) | |
| most_common_base = [b for b in base_c.items() if b[1] == max_count] | |
| if len(most_common_base) == 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
| $include /etc/inputrc | |
| "\e[A":history-search-backward | |
| "\e[B":history-search-forward | |
| export HISTSIZE=1000000 | |
| export HISTFILESIZE=1000000000 | |
| export HISTIGNORE='pwd:ls:history:' |
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 collections import defaultdict | |
| from Bio import SeqIO | |
| class Orthologs: | |
| def __init__(self, ortho_file, seq_map_file): | |
| """Store information on orthologs from another of strains """ | |
| self.ortholog_map = defaultdict(lambda: defaultdict(list)) | |
| with open(ortho_file) as infile: |
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
| tail cov.tsv -n1 | cut -f1,2 > spp.genome | |
| bedtools makewindows -g spp.genome -w 1000 > spp_1kw.bed | |
| awk -v OFS='\t' '{print $1,($2 -1),$2,$3 }' cov.tsv > cov.bed | |
| bedtools map -a spp_1kw.bed -b cov.bed -c 4 -o mean |
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
| sample_half_disk <- function(n,radius) { | |
| prop_radius <- runif(n) | |
| angles <- runif(n,0,360) | |
| data.frame( x= sqrt(prop_radius) * cos(angles) * radius, | |
| y = -abs(sqrt(prop_radius) * sin(angles) * radius)) | |
| } | |
| plot(sample_half_disk(1e4,300)) |
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
| .one_chrom_outline <- function(chrom_name, len, offset, width, centro_s, centro_e, notch_prop=0.6){ | |
| one_side <- c(0, centro_s-offset, (centro_s + centro_e)/2, centro_e+offset, len) | |
| wd = width/2 | |
| data.frame( | |
| chrom = chrom_name, | |
| x = c(one_side, rev(one_side), 0), | |
| y = c(wd, wd, notch_prop * wd, wd, wd, -wd, -wd, -notch_prop * wd, -wd, -wd, wd) | |
| ) |
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
| obs | unit | magnitude | |
|---|---|---|---|
| 1 | 1 | -0.61 | |
| 2 | 1 | -1.43 | |
| 3 | 1 | -1.09 | |
| 4 | 1 | -1.13 | |
| 5 | 1 | -0.66 | |
| 6 | 1 | -0.36 | |
| 7 | 1 | -0.73 | |
| 8 | 1 | -0.89 | |
| 9 | 1 | -0.69 |
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
| ``` | |
| --- | |
| name: rotl-paper-published | |
| layout: post | |
| title: "rotl paper published" | |
| date: 2016-18-02 | |
| authors: | |
| - name: Francois Michonneau | |
| url: http://francoismichonneau.net/ | |
| - name: Joseph Brown |
NewerOlder