Skip to content

Instantly share code, notes, and snippets.

View yk-tanigawa's full-sized avatar

Yosuke Tanigawa yk-tanigawa

View GitHub Profile
@yk-tanigawa
yk-tanigawa / myheatmap.py
Last active June 15, 2016 07:25
python plots snippet
def myheatmap(ndary):
X, Y = ndary.shape
fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(1,1,1)
ax.set_xlim(0, Y)
ax.set_ylim(0, X)
ax.invert_yaxis()
ax.pcolor(ndary, cmap=plt.cm.Blues)
fig.show()
def someMap: Map[String, Int]
someMap.keys.map(key => (key -> someMap(key).someFunc)).toMap
@yk-tanigawa
yk-tanigawa / .ssh_config
Created August 11, 2016 20:42
GeneX2016@CSHL
## line starting with '#' is will be ignored by your computer (comment line)
## configuration
Host nickname_of_your_server
User [email protected]
Port 22
Hostname server
IdentityFile ~/.ssh/server
IdentitiesOnly yes

install necessary software to cluster machine

pyenv

  • download and install pyenv via github
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
  • add the following to ~/.bash_profile
$ parallel mkdir -p dirs/{2}/{1} :::: <(seq 1 10) <(seq 1 5)
$ parallel -k 'echo {}' :::: <(seq 1 10)
$ # https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1
@yk-tanigawa
yk-tanigawa / hello.sbatch
Last active July 21, 2017 23:20
sherlock
#!/bin/sh
# (@) hello world
#SBATCH --job-name=hello
#SBATCH --output=hello.%j.out
#SBATCH --error=hello.%j.err
#SBATCH --time=0:01:00
#SBATCH --qos=normal
#SBATCH -p normal
np.array(
Parallel(
n_jobs=multiprocessing.cpu_count()
)(delayed(pre_process_main)(read_3channel_file(lead_df, i))
for i in range(batch_interval[0], batch_interval[1])),
dtype = np.float64
)
@yk-tanigawa
yk-tanigawa / pgen_write.out.txt
Created July 4, 2017 07:46
plink2 pgenlib.PgenWriter caused a segmentation fault
$ python pgen_write.py
2017-07-04 00:44:50,706 pgen_write DEBUG pgen write test script
2017-07-04 00:44:50,706 read_alleles_range DEBUG reading alleles range 0:10 from ./pgen_in.pgen
2017-07-04 00:44:50,725 read_alleles_range DEBUG The shape of the numpy nd-array is (10, 224676)
2017-07-04 00:44:50,725 pgen_write DEBUG shape of buffer is (10, 224676)
2017-07-04 00:44:50,727 pgen_write DEBUG writing SNP 0 of 10 ...
2017-07-04 00:44:50,728 pgen_write DEBUG writing SNP 1 of 10 ...
2017-07-04 00:44:50,730 pgen_write DEBUG writing SNP 2 of 10 ...
2017-07-04 00:44:50,731 pgen_write DEBUG writing SNP 3 of 10 ...
2017-07-04 00:44:50,733 pgen_write DEBUG writing SNP 4 of 10 ...
PC score
1 0.840188
2 0.394383
3 0.783099
4 0.79844
5 0.911647
6 0.197551
7 0.335223
8 0.76823
9 0.277775

This script works as a wrapper for sbatch command.

Usage: sherlock-one-liner python --version