Skip to content

Instantly share code, notes, and snippets.

View cth's full-sized avatar

Christian Theil Have cth

View GitHub Profile
#!/home/fng514/bin/ruby
#$ -S /home/fng514/bin/ruby
#$ -cwd
# Script to calculate INFO (approx R-squared) and Allele frequency from a VCF file (with dosages).
# Like the ones produced with https://github.com/cth/vcf-misc-tools
# Christian Theil Have, 2016.
# Use as you see fit, but no warranties.
# Usage:
# qsub yuvaraj_info.rb my.vcf my.info
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
#$ -l pe smp 20
# Julia script to to read VCF file and calculate quality and depth statistics (in parallel)
# Christian Theil Have, 2016.
import GZip
println(string("Reading ",ARGS[1]))
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
#$ -pe smp 20
# Julia script to read a VCF file and calculate tstv by stepwise GQ and DP tresholds
# Christian Theil Have, 2016.
import GZip
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
#
# Split multi allelic sites:
# 1. Split multi-allelic sites into multiple VCF lines, s.t., a) each line has one unique alternative allele, and b) if person has an other alternative allele than the one specified for the line in question, then that particular genotype is coded as missing in that line.
# 2. Run bi-allelic hardy weinberg test for each of these lines.
#
# Christian Theil Have, 2016.
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
#
# Split multi allelic sites:
# 1. Split multi-allelic sites into multiple VCF lines, s.t., a) each line has one unique alternative allele, and b) if person has an other alternative allele than the one specified for the line in question, then that particular genotype is coded as missing in that line.
# 2. Run bi-allelic hardy weinberg test for each of these lines.
#
# Christian Theil Have, 2016.
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
# Christian Theil Have, 2016.
#import GZip
function process_vcf_line(outfile,line, dpmin, gqmin)
fields = split(line)
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
# Christian Theil Have, 2016.
using HypothesisTests
using StatsBase
nucleotides = Set{AbstractString}(["A","G","C","T"])
@cth
cth / CPR.jl
Created February 24, 2016 06:58
# A datatype of storing Danish CPR numbers and accommpanying function for converversion to/from strings
type CPR
date::Date
serialnumber::UInt16
end
Base.string(x::CPR) = string( dec(Integer(Dates.Day(x.date)),2), dec(Integer(Dates.Month(x.date)),2), dec(Integer(Dates.Year(x.date)) % 100), "-", dec(x.serialnumber, 4))
ismale(x::CPR) = x.serialnumber % 2 == 1
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
# Christian Theil Have, 2016.
#import GZip
function process_vcf_line(outfile,line, dpmin, gqmin)
fields = split(line)
#!/home/fng514/bin/julia
#$ -S /home/fng514/bin/julia
#$ -cwd
# Christian Theil Have, 2016.
using HypothesisTests
using StatsBase
nucleotides = Set{AbstractString}(["A","G","C","T"])