投稿

2月, 2018の投稿を表示しています

SNPset

遺伝子名が一列目、属するSNP-IDが二列目に並んだタブ区切りファイルが欲しい chr1.tss: 一列目が遺伝子名、二列目が領域開始点、三列目が領域終了点のtsv chr1.bim:一列目が染色体番号、二列目がSNP-ID、四列目が染色体上の位置(plinkのbimフォーマット) : > chr1.snpset while read line; do arr=(`echo {line}`) gene={arr[0]} start={arr[1]} end={arr[2]} head chr1.bim | \ gawk \ -v gene=gene \ -v start=start \ -v end=end \ '{if(start<=4 && 4<=end) \ {print gene"\t"2}}' >> chr1.snpset done < chr1.tss これで一列目に該当遺伝子名前、二列目にSNP-IDの記載されtsvが手に入る。染色体間での作成には対応していません。

neotermとipython

Macでnvim+neotermでpython3を書きたいがデフォルトではpython2のREPLが立ち上がってしまう。設定ファイルを書き換えれば良いのだろうが、少しよくわからない。チートっぽいけど pip3 intall ipython でpython3のipythonが立ち上がってくれる。チートっぽいけど。 追記 普通にneotermの設定ファイルをいじればできた ~/.local/share/dein/repos/github.com/kassio/neoterm/ftdetect/set_repl_cmd.vim のなかの elseif executable('python') | call neoterm#repl#set('python') | というところを elseif executable('python3') | call neoterm#repl#set('python3') | とすればよかった。

mach2qtl

minimacでimputationしたdosageのgenotypeファイルでassociationしたい。とくに量的変数。 このためにmach2qtlというソフトをminimacの開発者がリリースしているが、使い方に癖があるのでメモ –datfile sample.dat C age C female T lg10CRP Cで共変量、Tで目的変数を指定 –pedfile sample.ped # FID IID Father Mother sex age female lg10CRP 4001 4001 0 0 m 41.591 0 0.580 4014 4014 0 0 m 61.864 0 1.021 4021 4021 0 0 m 53.859 0 0.845 PLINKでいうところのfamファイルである。6列目以下に目的変数もしくは共変量を記載する –dosefile sample.dose.vcf.gz これが現行のminimac3の出力ファイルを受けつけてくれない。 DosageConverer をつかって形式を変更する。 dosageConvertor \ --vcfDose sample.dose.vcf.gz \ --info sample.info \ --prefix sample_mldose \ --type mach \ --format 1 –dosefile sample_mldose.dose.vcf.gz としてようやく実行 mach2qtl \ --datfile sample.dat \ --pedfile sample.ped \ --infofile sample.info \ --dosefile sample_mldose.dose.vcf.gz \ --rsqcutoff 0.7 > output.txt つまり標準出力で返る。リダイレクトで受けるのだが、フォーマットがやや利用しにくい。きれいなテーブルにしたいなら下記のスクリプトを使用してください。 cat sample_mldose.doseassoc | \ awk '{ if(NR==1){print "TRAIT\tCHR\tPOS\tALLELES\tFR...