Skip to content

Instantly share code, notes, and snippets.

@samesense
samesense / dbsnp_unknown.py
Created April 18, 2012 01:38
Grab hg19 positions in dbSNP that have unknown status
def get_dbsnp_unknown():
snvs = {}
with open('/vol/Users/yk336/database/human/dbsnp/hg19/snp.txt') as f:
for line in f:
sp = line.strip().split('\t')
chrom = sp[1]
pos = sp[3]
status = sp[12]
snv_type = sp[11]
if status == 'unknown' and snv_type == 'single':
@samesense
samesense / 0_reuse_code.js
Created May 31, 2014 23:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@samesense
samesense / snakemake_setup
Created June 5, 2015 15:51
snakemake install
###Assuming python3 is not on your server and you are not sudo
1. Download python source, compile
```
wget http://python.org/ftp/python/3.3.4/Python-3.3.4.tgz
gunzip Python-3.3.4.tgz && tar -xvf Python-3.3.4.tar
cd Python-3.3.4
./configure --prefix=/home/me/mypython && make && make install
cd /home/me/mypython
```
sourceID: description
2000DanishExomes: http://www.ncbi.nlm.nih.gov/pubmed?term=24290377
63000exomes: ExAC
ADNI: Alzheimer's Disease Neuroimaging Initiative
!Ai: Five Khoisan and Bantu genomes from southern Africa, http://www.ncbi.nlm.nih.gov/pubmed?term=20164927
D#kgao: Five Khoisan and Bantu genomes from southern Africa, http://www.ncbi.nlm.nih.gov/pubmed?term=20164927
dbSNP: dbSNP v 144
Geuvadis: Genetic European Variation in Disease, http://www.ebi.ac.uk/eva/?eva-study=PRJEB6042
gonl: GoNL (Founders from 250 Dutch trios, http://www.ncbi.nlm.nih.gov/pubmed?term=24974849)
GS* (ex GS000009929): PGP, 152 individual genomes sequenced by the Personal Genome Project
@samesense
samesense / Make input based on wildcards
Last active November 24, 2015 21:15
snakemake syntax to make input based on wildcards
# broken, but expresses idea
rule parseMvar:
input: DATA + 'collapseCalls_snvs/{sample}.tab',
expand(DATA + 'bedIntr/{{sample}}_{sample2}.bed', \
sample2 = n2t['{wildcards.sample}'])
output: DATA + 'snv_tumorStatus/{sample}.tab'
shell: 'python parseTumorStatus.py {input} {output}'
# correct syntax
def getTumor(wc):
/mnt/isilon/cbmi/variome/bin/java -Xmx32g -Xms16g -jar /mnt/isilon/cbmi/variome/bin/GenomeAnalysisTK-1.6-2-gc2b74ec/3.3-0/GenomeAnalysisTK.jar -l DEBUG -variant_index_type LINEAR -variant_index_parameter 128000 --emitRefConfidence GVCF -T HaplotypeCaller -R /mnt/isilon/cbmi/variome/reference/mm9.fa -I ~/me/projects/blobel/download_encode/data/bam_group/ENCFF001NTS.bam --genotyping_mode DISCOVERY -stand_emit_conf 10 -stand_call_conf 30 -o /home/evansj/me/projects/blobel/download_encode/data/gvars/ENCFF001NTS.g.vcf
@samesense
samesense / targetTodo
Last active January 15, 2016 14:55
TARGET todo list for mtg
* Data checksums
* Collapse variants by chrom
* Pull reads of all variant positions across bam files
* Pull mapping qualities
* Apply cutoffs
* Annotate collapsed variants w/ function and pop info
* Mk tables
@samesense
samesense / remote_to_local_clipboard.md
Last active May 15, 2019 11:32
Copy to local machiine clipboard from iteractive remote session

Copy to local machine clipboard from iteractive remote session

  • Works with macOS and remote linux machine
  • On local machine, make this plist file to use with launchclt
  • On local machine launchctl load local.pbcopy.9999.plist. This must remain running for remote copy to work.
  • On remote machine cat "message or file" | nc localhost 9997 -w1
  • nc is at /mnt/isilon/cbmi/variome/perry/bin/nc
  • On local machine, use paste or pbpaste as usual

Extra

  • On my locate machine, p is aliased to the launchctl command
@samesense
samesense / local.pbcopy.9999.plist
Created March 22, 2017 14:24
macOS plist file for launchclt
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.pbcopy.9999</string>
<key>UserName</key>
<string>joe</string>
<key>Program</key>
<string>/usr/bin/pbcopy</string>
@samesense
samesense / python_argparse
Created April 29, 2017 21:05
python main
import argparse
def main(args):
giabBaseCounts(d, args.giabCountFile)
if __name__ == "__main__":
desc = 'Pull data for report.'
parser = argparse.ArgumentParser(description=desc)
argLs = ('giabCountFile', 'outFile',)
for param in argLs: