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(plyranges) | |
| library(nullranges) | |
| x <- data.frame( | |
| seqnames=rep(c("1","2","3"), each=10), | |
| start=rep(c(0:4, 10:14) * 1000 + 1, times=3), | |
| width=100) |> | |
| as_granges() | |
| seqlengths(x) <- c("1"=20123, "2"=20123, "3"=20123) |
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(SummarizedExperiment) | |
| library(plyranges) | |
| # example data | |
| m <- matrix(rnorm(600), nrow=100) | |
| r1 <- data.frame(seqnames=1, start=1:50 * 100 + 2501, | |
| width=5, id1=paste0("u",formatC(1:50,width=3,flag="0"))) |> | |
| as_granges() | |
| r2 <- data.frame(seqnames=1, start=1:100 * 100 + 1, | |
| width=5, id2=paste0("v",formatC(1:100,width=3,flag="0"))) |> |
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(shiny) | |
| library(UpSetR) | |
| library(dplyr) | |
| library(tidyr) | |
| library(readr) | |
| library(ggplot2) | |
| library(pheatmap) | |
| dat <- read_delim("ancestry_dataframe.tsv") | |
| ui <- fluidPage( |
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
| mat <- matrix(rnbinom(2e5, mu=100, size=1/.01), ncol=100) | |
| library(DESeq2) | |
| d <- DESeqDataSetFromMatrix(mat, DataFrame(x=rep(1,100)), ~1) | |
| # library size correction, centered log ratio to reference sample | |
| d <- estimateSizeFactors(d) | |
| # variance | |
| d <- estimateDispersionsGeneEst(d) | |
| # trend |
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
| set.seed(5) | |
| n <- 1000 | |
| reps <- 10 | |
| rna <- matrix( | |
| rnbinom(n * reps, mu = 10, size = 100), | |
| ncol=reps | |
| ) | |
| dna <- matrix( | |
| rnbinom(n * reps, mu = 10, size = 100), |
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
| # dataframes vs lm S3 vs Bioc S4 | |
| # Michael Love | |
| # Nov 1 2023 | |
| dat <- data.frame(genotype=c("wt","wt","mut","mut"), | |
| count=c(10,20,30,40), | |
| score=c(-1.2,0,3.4,-5), | |
| gene=c("Abc","Abc","Xyz","Xyz")) | |
| library(tibble) | |
| dat |> as_tibble() |
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
| --- | |
| title: "Toy tree example for collapsing" | |
| author: "Michael Love" | |
| --- | |
| Example data with 20 inferential replicates, here we just have 1 | |
| sample per condition and we calculate the LFC at each level of the | |
| tree. | |
| From the below simulation setup (see first chunk), the true DE signal |
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(plyranges) | |
| library(readr) | |
| bindata <- read_tsv("bindata.40000.hg19.tsv.gz") | |
| fire <- read_bed("fire-adult-hg19.txt") | |
| # not necessary, but nice to have | |
| si <- Seqinfo(genome="hg19") | |
| si <- keepStandardChromosomes(si) |
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
| # minimap2 map reads: | |
| minimap2 -t {threads} -a -x map-ont -p 1.0 -N 100 {input.index} {input.fastq} | samtools view -Sb > {output.bam} | |
| # salmon Quant: | |
| salmon quant --ont --noLengthCorrection -p 8 -t {input.transcriptome} -l U -a {input.bam} -o {output} |
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(palmerpenguins) # penguins! | |
| library(ggplot2) # "grammar of graphics" plots | |
| suppressPackageStartupMessages( | |
| library(dplyr) # data pliers | |
| ) | |
| penguins |> | |
| slice(1:3) |> | |
| select(species, island) |