Skip to content

Instantly share code, notes, and snippets.

View nickpettican's full-sized avatar
📚
Studying

Nicolas Pettican nickpettican

📚
Studying
View GitHub Profile
@nickpettican
nickpettican / read_galaxy.R
Created October 26, 2015 15:58
Reminder of how to read a tabular text file into R (stringsAsFactors = HELLNO!)
galaxy_bed <- read.table(file = "Galaxy1-[Main_on_Human].bed", stringsAsFactors = FALSE)
@nickpettican
nickpettican / sort_my_bed.R
Created October 26, 2015 16:32
sort some Galaxy-downloaded BED format
names(galaxy_bed) <- c("chrom",
"chromStart",
"chromEnd",
"name",
"score",
"strand",
"blockCount",
"blockSizes")
# This shows how to 'subset' with either the $ operator or [[
@nickpettican
nickpettican / stats01.R
Last active June 15, 2016 15:14
Stats01
# CHAPTER 1
# FUNDAMENTALS
# The response variable is the things you are working on, the variable whose variation you are attempting to understand.
# This is the variable that goes in the "y" axis of the graph (the ordinate).
# The explanatory variable goes on the "x" axis of the graph (the abscissa).
# The explanatory variables:
# - Regression: all explanatory variables continuous.
@nickpettican
nickpettican / ion_stats.pl
Last active October 30, 2015 15:58
Ion Stats
#!/usr/bin/perl -w
#
use strict;
use Getopt::Long;
# You might want to have a flag --binwidth and --bintarget
# perl ion_stats.pl --binwidth 30 --bintarget 150
# the above would specify bin parameters: 135-165
my $binwidth;
@nickpettican
nickpettican / stats02.R
Last active November 9, 2015 23:01
Session02
# CHAPTER 3
#ENTRAL TENDENCY
yvals<-read.csv("C:\\MSc\\Statistics\\Data\\yvalues.csv")
# open file
attach(yvals)
hist(yvals)
# the data values that occour the most are called 'mode'
@nickpettican
nickpettican / stats03.R
Last active November 16, 2015 12:42
Session03
# CHAPTER 6
# TWO SAMPLES
# COMPARING TWO VARIANCES
# To test to see whether the sample variances are significantly different we use Fisher's F test
# You divide the larger variance by the smaller variance
# We need to look for the critical value of the variance ratio 'qf' (quantiles of the F distribution)
@nickpettican
nickpettican / Ion_Stats.pl
Last active November 14, 2015 19:20
Programming Project
#!/usr/bin/perl -w
#
BEGIN{
use File::Basename;
push @INC,
use Getopt::Long
#
my $binwidth;
my $bintarget;
GetOptions ("binwidth" => \$binwidth,
@nickpettican
nickpettican / mass_conc_calc.java
Created November 13, 2015 15:32
Java Session01
package session01;
import java.util.Scanner;
public class calc {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
#!/usr/bin/perl
use diagnostics;
use strict;
use warnings;
use Getopt::Long;
# Defining bin size and parameters
my $data = "table.tsv";
@nickpettican
nickpettican / project.pm
Created November 18, 2015 09:00
Ion_Stats_v02
#!/usr/bin/env perl
package ProNTo::IonStats;
use diagnostics;
use strict;
use warnings;
use Getopt::Long;
use Exporter;