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
/** | |
* Created with JetBrains WebStorm. | |
* User: zhuxp | |
* Date: 13-4-21 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
function parseStems(ss) | |
{ |
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
chr1 61735 7035990 CopyNumberRegion_0 2 0 | |
chr1 7036801 7974076 CopyNumberRegion_1 3 0 | |
chr1 7975788 29271013 CopyNumberRegion_2 2 0 | |
chr1 29275883 30265652 CopyNumberRegion_3 4 2 | |
chr1 30271899 31334415 CopyNumberRegion_4 6 2 | |
chr1 31336903 41403766 CopyNumberRegion_5 7 2 | |
chr1 41405663 42601214 CopyNumberRegion_6 4 2 | |
chr1 42602991 44503629 CopyNumberRegion_7 6 2 | |
chr1 44507772 48809180 CopyNumberRegion_8 2 0 | |
chr1 48810111 48824773 CopyNumberRegion_9 7 1 |
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
#for i in chr1 chr2 chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15chr16 chr17 chr18 chr19 chr20 chr21 chr22 chrX chrY chrM | |
for i in chr3 chr4 chr5 chr6 chr7 chr8 chr9 chr10 chr11 chr12 chr13 chr14 chr15 chr16 chr17 chr18 chr19 chr20 chr21 chrX chrY chrM | |
do | |
echo "samtools mpileup -uf ../hg19.fna ../Mapping/$i.v2.sorted.bam | bcftools view -bvcg - > test_$i.var.raw.bcf" | |
echo "bcftools view test_$i.var.raw.bcf | vcfutils.pl varFilter -D100000 > test_$i.vcf" | |
echo "vcf2var.pl test_$i.vcf > test_$i.variants" | |
echo "samtools view ../Mapping/$i.v2.sorted.bam | extract_hairs --sam stdin --variants test_$i.variants > test_$i.fragments" | |
done |
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
venn.overlap <- | |
function(r, a, b, target = 0) | |
{ | |
# | |
# calculate the overlap area for circles of radius a and b | |
# with centers separated by r | |
# target is included for the root finding code | |
# | |
pi = acos(-1) | |
if(r >= a + b) { |
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
#!/bin/sh | |
inputfile=$1 | |
# you can add friendly code to check the extension and use zcat if it's *.fastq.gz or *.fq.gz... | |
[[ "$inputfile" =~ ".*\.(fq\.gz$|fastq\.gz$)" ]] && zcat $inputfile | head -n400 | awk '{if(NR%4==0) printf("%s",$0);}' | od -A n -t u1 | awk 'BEGIN{min=100;max=0;}{for(i=1;i<=NF;i++) {if($i>max) max=$i; if($i<min) min=$i;}}END{if(max<=74 && min<59) print "Phred+33"; else if(max>73 && min>=64) print "Phred+64"; else if(min>=59 && min<64 && max>73) print "Solexa+64"; else print "Unknown score encoding!";}' | |
[[ "$inputfile" =~ ".*\.(fq$|fastq$)" ]] && head -n400 $inputfile | awk '{if(NR%4==0) printf("%s",$0);}' | od -A n -t u1 | awk 'BEGIN{min=100;max=0;}{for(i=1;i<=NF;i++) {if($i>max) max=$i; if($i<min) min=$i;}}END{if(max<=74 && min<59) print "Phred+33"; else if(max>73 && min>=64) print "Phred+64"; else if(min>=59 && min<64 && max>73) print "Solexa+64"; else print "Unknown score encoding!";}' |
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
#!/bin/bash | |
if [ $# -lt 1 ] | |
then | |
echo "USAGE: test_contamination.sh <fastq_file>" | |
exit 0 | |
fi | |
# modify the following parameters as needed | |
Sample_Size=5000000 |
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 | |
# Wei Guifeng, <guifengwei@gmail.com> | |
# Revised By zhuxp <nimezhu@gmail.com> | |
# -- coding: utf-8 -- | |
''' | |
Gencode annotation or Cufflinks transcript.gtf | |
usage: | |
for gene in TableIO.parse("cufflinks.transcript.gtf", 'gtf'): | |
print "{0}\t{1}\t{2}".format(gene.chr, gene.strand, (gene.stop - gene.start)) |
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 | |
# programmer : zhuxp | |
# usage: | |
import sys | |
from getopt import getopt | |
import networkx as nx | |
import matplotlib.pyplot as plt | |
def show_help(): | |
print >>sys.stderr,"\n\nplotCausalGraph.py: drawing causal graph from LiNGAM output equation matrix B" | |
print >>sys.stderr,"Library Dependence: networkx , matplotlib\n\n" |
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
$(function() { | |
Backbone.sync = function(method, model, success, error){ | |
success(); | |
} | |
CausalityView = Backbone.View.extend({ | |
el: $('body'), // el attaches to existing element | |
attributes: {"width":900,"height":700}, | |
events: { | |
'change #csv': 'render', |
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/env python | |
# a bar plot with errorbars | |
import numpy as np | |
import matplotlib.pyplot as plt | |
N = 5 | |
menMeans = (20, 35, 30, 35, 27) | |
menStd = (2, 3, 4, 1, 2) | |
ind = np.arange(N) # the x locations for the groups |