This file contains 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
package net.sf.picard.sam; | |
import java.io.BufferedReader; | |
import java.io.DataInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStreamReader; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; |
This file contains 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
*---------------------------------- | |
* Setting up git | |
*---------------------------------- | |
Clone gatk git repo | |
Add the main gatk repo as a upstream remote repo: | |
git remote add upstream https://github.com/broadgsa/gatk.git | |
Change the remote of the master branch to upstream. .git/config should look like this. |
This file contains 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
#!/usr/bin/python | |
import os | |
def get_immediate_subdirectories(dir): | |
return [name for name in os.listdir(dir) | |
if os.path.isdir(os.path.join(dir, name))] | |
# Get runfolder name from file and return as list. | |
def get_runfolders_already_run(file): |
This file contains 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
import scala.math.Ordering | |
object SimpleBW extends App { | |
def bwt(s: String): String = { | |
def tranformString(string: String): List[String] = { transformString(string, string.length) } | |
def transformString(string: String, splitIndex: Int): List[String] = { | |
if (splitIndex == 0) { | |
// Recursion base case |
This file contains 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
object PlayWithURLs extends App { | |
// Some ids for the BRCA1 gene | |
val refseqids = List("uc010whl.1", "uc002icp.3", "uc010whp.1") | |
def queryRefSeqId(refSeqId: String): String = { | |
def read(url: String): String = io.Source.fromURL(url).mkString | |
val document = read("http://genome.ucsc.edu/cgi-bin/hgGene?hgg_gene=" + refSeqId + "&org=human") | |
val regexp = """.*Genetic Association Database:\s\<A HREF=.*\>(\w+)\<.*""".r |
This file contains 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
object UglyCodeExample extends App { | |
def m(stringToTransform: String): String = { | |
def t(string: String): List[String] = { | |
def th(string: String, si: Int): List[String] = { | |
if (si == 0) Nil | |
else { | |
val (firstString, secondString) = string.splitAt(si); val newString = secondString + firstString | |
newString :: th(string, si - 1)}} | |
th(string, string.length) | |
} |
This file contains 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
object BetterCodeExample extends App { | |
/** | |
* Burrows-Wheeler transform of string | |
* | |
* Perform the Burrows-Wheeler transform on a string. See http://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform | |
* for a introduction to the algorithm. | |
* | |
* This particular implementation is recursive. | |
* |
This file contains 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
import org.scalatest.FunSuite | |
import BetterCodeExample._ | |
class BetterCodeExampleUnitTests extends FunSuite { | |
test("Burrow wheelers transform of ^BANANA|") { | |
assert(BetterCodeExample.burrowsWheelersTransform("^BANANA|") === """BNN^AA|A""") | |
} | |
This file contains 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
import scala.io.Source | |
import java.io.File | |
object GCCounter extends App { | |
val file = new File("Homo_sapiens.GRCh37.67.dna_rm.chromosome.Y.fa") | |
// The actual GC counting function | |
def countGCOnLine(line: String): (Long, Long) = { | |
if (line.startsWith(">")) |
This file contains 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(ggplot2) | |
setwd("<my working directory>") | |
removeExtraLine <- function(x) { | |
x[,2:length(x)] | |
} | |
createInitialDataset <- function(x, sampleName) { | |
extraLineRemoved <- t(removeExtraLine(x)) |
OlderNewer