This file contains hidden or 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
| """ | |
| flat convolution of width n on an array x in O(n) time | |
| padded out to maintain shape | |
| """ | |
| def do_convolve(X, n): | |
| csum = np.cumsum(X) | |
| conv = np.r_[np.repeat(csum[n-1],n), csum[n:]-csum[:-n]] | |
| return conv |
This file contains hidden or 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
| """ | |
| get position of adjactent 1st in a vector | |
| """ | |
| def getNonZeroRanges( A, zeroDefVal=0 ): | |
| dA=np.diff(A) | |
| N=A.shape[0] | |
| nzdA,=np.nonzero(dA) | |
| liRangesAll=np.c_[ np.r_[0,nzdA+1], | |
| np.r_[nzdA,N-1] +1] | |
| iiR = A.take(liRangesAll[:,0]) != zeroDefVal |
This file contains hidden or 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
| """ | |
| flat convolution of width n on an array x in O(n) time | |
| padded out to maintain shape | |
| """ | |
| def do_convolve(X, n): | |
| csum = np.cumsum(X) | |
| conv = np.r_[np.repeat(csum[n-1],n), csum[n:]-csum[:-n]] | |
| return conv |
This file contains hidden or 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
| <!doctype HTML> | |
| <meta charset = 'utf-8'> | |
| <html> | |
| <head> | |
| <link rel='stylesheet' href='http://timelyportfolio.github.io/rCharts_d3_sankey/css/sankey.css'> | |
| <script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
| <script src='http://timelyportfolio.github.io/rCharts_d3_sankey/js/sankey.js' type='text/javascript'></script> | |
| <style> |
This file contains hidden or 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
| <!doctype HTML> | |
| <meta charset = 'utf-8'> | |
| <html> | |
| <head> | |
| <link rel='stylesheet' href='http://timelyportfolio.github.io/rCharts_d3_sankey/css/sankey.css'> | |
| <script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script> | |
| <script src='http://timelyportfolio.github.io/rCharts_d3_sankey/js/sankey.js' type='text/javascript'></script> | |
| <style> |
This file contains hidden or 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 | |
| # Get and install openblas | |
| mkdir -p ~/bin/openblas | |
| cd ~/bin/openblas | |
| wget https://github.com/xianyi/OpenBLAS/archive/v0.2.9.rc1.zip | |
| unzip v0.2.9.rc1 | |
| cd OpenBLAS-0.2.9.rc1/ | |
| make |
This file contains hidden or 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 | |
| #rule: {job} | |
| #input: {job.input} | |
| #output: {job.output} | |
| #threads: {job.threads} | |
| {self.workflow.snakemakepath} --snakefile {self.workflow.snakefile} \ | |
| --force -j{self.cores} \ | |
| --directory {workdir} --nocolor --notemp --quiet --nolock {job.output} \ | |
| > /dev/null && touch "{jobfinished}" || touch "{jobfailed}" | |
| exit 0 |
This file contains hidden or 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 | |
| # | |
| # Adopts and submit a snakemake cluster job script to SGE queue | |
| # | |
| # by Hyeshik Chang | |
| # | |
| JOBSCRIPT_SNAKEMAKE=$1 | |
| JOBSCRIPT_SGE="`dirname $1`/sge`basename $1`" |
This file contains hidden or 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
| # set this to your head node hostname (run hostname) | |
| HEAD_NODE_NAME=master | |
| if [ `hostname` = $HEAD_NODE_NAME ]; then | |
| NODES=`qconf -sel | grep -v $HEAD_NODE_NAME` | |
| for NODE in $NODES; do | |
| SCRIPT_PATH=$(dirname `which $0`) | |
| qsub -l h=$NODE $SCRIPT_PATH | |
| done |
This file contains hidden or 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
| Improve the log (https://coderwall.com/p/euwpig?i=3&p=1&t=git) | |
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" | |
| Enable color in git: | |
| git config --global --add color.ui true | |
| Make git push only push the current branch | |
| git config --global push.default current |
NewerOlder