Skip to content

Instantly share code, notes, and snippets.

@pmagwene
pmagwene / ftr_count.awk
Created November 27, 2023 22:05
Awk example from class
BEGIN {
FS="\t"
OFS=","
genect = 0
}
# filter the comments
$0 ~ /^#/ { next }
@pmagwene
pmagwene / gist:c2f0bee35ed64a232b374ec36212fd54
Created August 20, 2023 13:57
Prepend text to a sequence ID of a FASTA file using seqkit
# Prepends "VNII_" in front of every sequence ID in this genome
seqkit replace -p ^ -r VNII_ GCA_022832995.1_ASM2283299v1_genomic.fna > VNII_Genome.fasta
@pmagwene
pmagwene / rustrefsbad.rs
Created January 9, 2020 19:20
Rust references dis-allowed
use std::error::Error;
use std::io::{BufRead, BufReader};
#[derive(Debug)]
struct Record<'a> {
line: &'a str,
words: Vec<&'a str>,
}
impl<'a> Record<'a> {
@pmagwene
pmagwene / rustrefsgood.rs
Created January 9, 2020 19:20
Rust string references allowed
use std::error::Error;
use std::io::{BufRead, BufReader};
#[derive(Debug)]
struct Record<'a> {
line: &'a str,
words: Vec<&'a str>,
}
impl<'a> Record<'a> {
@pmagwene
pmagwene / rusttest.rs
Created January 9, 2020 15:27
Rust parsing example
use std::env;
use std::error::Error;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::time::Instant;
#[derive(Debug)]
struct Record {
words: Vec<String>,
}
@pmagwene
pmagwene / gotest.go
Created January 9, 2020 15:21
Go record parsing example
package main
import (
"bufio"
"fmt"
"io"
"log"
"os"
"strings"
"time"
@pmagwene
pmagwene / mean_time_series_per_cluster.R
Created April 2, 2017 01:29
Creates a plot showing the time series expression of genes within clusters, overlain by the w/in cluster mean
library(dendextend)
library(tidyr)
library(dplyr)
library(magrittr)
library(ggplot2)
# load data in "wide" format (genes in columns)
spellman <- read.csv("spellman-reformated.csv")
# restructure in "long" format
library(tidyr)
library(dplyr)
library(magrittr)
library(ggplot2)
# read data from causton heat expression data set
# see groups 4 and 9 data/focal papers
causton <- read.csv("causton-2001-heat-expression.csv")
# Take a look at data. You'll see that the genes are in rows,
library(tidyr)
library(dplyr)
library(magrittr)
library(ggplot2)
# load data in "wide" format (genes in columns)
spellman <- read.csv("spellman-reformated.csv")
# restructure in "long" format
spellman.long <- gather(spellman, gene, expression, -expt, -time)
library(tidyr)
library(dplyr)
library(magrittr)
library(ggplot2)
# load data in "wide" format (genes in columns)
spellman <- read.csv("spellman-reformated.csv")
# restructure in "long" format
spellman.long <- gather(spellman, gene, expression, -expt, -time)