Python使ってpubmedからbibを生成

biopythonで。

#!/usr/bin/env python
# -*- encoding:utf-8 -*-
# kzfm <kerolinq [AT] gmail.com>

def pm2bib(pm):
    author = "; ".join(pm['AU'])
    year = pm['DP'][0:4]
    bib = """@article{PMID:%s,
author = {%s},
title = {%s},
journal = {%s},
year = {%s},
volume = {%s},
number = {%s},
pages = {%s},
}
""" % (pm['PMID'],author,pm['TI'],pm['TA'],year,pm['VI'],pm.get('IP',""),pm['PG'])
    return bib

if __name__ == "__main__":

    from Bio import Entrez, Medline

    Entrez.email = "xxx@gmail.com"
    record = Entrez.read(Entrez.esearch(db="pubmed",term="biopython"))
    idlist = record["IdList"]
    records = Medline.parse(Entrez.efetch(db="pubmed",id=idlist,rettype="medline",retmode="text"))

    for record in records:
        print pm2bib(record)

適当に用意したtex

\documentclass{jarticle}
\begin{document}
\bibliographystyle{plain}
「お互いの犬\cite{PMID:20015970}の写真\cite{PMID:19811691}を撮り合い、帰ったらその写真\cite{PMID:19773334}
を自分のブログ\cite{PMID:19304878}にUPして紹介\cite{PMID:18606172}
し、お互いのブログにお礼コメント\cite{PMID:16403221}をするというのが暗黙のルール\cite{PMID:16377612}です。」

X06HT予約しにいったら、携帯電話が妻名義\cite{PMID:14871861}だったので予約出来なかった。
あと名義変更に一日かかるからあと二回いかないと予約出来ない\cite{PMID:14630660}
という衝撃の事実を聞かされた。多分、アンドロイドへの何か\cite{PMID:12230038}
が試されているんだろう。

\bibliography{test}
\end{document}

できたpdf

パーセプトロン

パターン認識と機械学習を読み直していて今4章。

図4.7のパーセプトロンのイメージが大変わかりやすいことに気づいて感激したのであった。

ProductName パターン認識と機械学習 上 - ベイズ理論による統計的予測
C. M. ビショップ
シュプリンガー・ジャパン株式会社 / ?円 ( 2007-12-10 )


いまは、Pinheiroを読むのに苦労している。

ProductName Mixed-Effects Models in S and S-PLUS (Statistics and Computing)
José Pinheiro
Springer / 2859円 ( 2009-04-15 )


これをきちんと理解しないと、PK-PDが進まないんだよな。

ProductName Pharmacokinetic-Pharmacodynamic Modeling And Simulation
Peter L., Ph.D. Bonate
Springer / 7596円 ( 2005-11 )


SRM435DIV2_250

余計な変数多いな。

public class SkiFriction {

    public int bestPosition(String sF, String pF) {
        int sFl = sF.length();
        int pFl = pF.length();
        if(sFl >= pFl) return 0;
        int result = 0;
        for(int i=0;i<pFl-sFl;i++) {
            int lmax = 0;
            for(int j=0;j<sFl;j++){
                int k = sF.charAt(j) - '0'+ pF.charAt(i+j) - '0';
                if(k>lmax) lmax = k;
            }
            result += lmax;
        }
        return result;
    }    
}

数字の比較はMath.max使えばいいのか

奈良萬

純米おりがらみ

1271073301

微発泡なので、シュワシュワ感がある。

最近、燗つける病が再発してたのだけど、楽しく飲めた。でも、僕の求める方向ではないかも。

SRM433DIV2_250

reverseってメソッドはないのかな? 両方ソートして、一方は先頭から他方は後ろから掛けてsumを求めた。

import java.util.*;

public class RoyalTreasurer {

    public int minimalArrangement(int[] A, int[] B) {
    java.util.Arrays.sort(A);
    java.util.Arrays.sort(B);
    int result = 0;
    for(int i=0;i<A.length;i++)
        {
        result += A[i] * B[A.length - i -1];
        }

    return result;
    }   
}

Mixed-Effects Models in S and S-PLUS chapter 1

nlmeを使いこなすために。

ProductName Mixed-Effects Models in S and S-PLUS (Statistics and Computing)
José Pinheiro,Douglas Bates
Springer / ¥ 5,742 ()
在庫あり。

  • fixed effects:平均に影響を及ぼす
  • random effects:分散に影響を及ぼす

ergoStoolのサンプルを。

residual plot(p.21)

ergostool_res

  • 全ての効果に対する因子はanovaで評価する必要がある
  • the mean response across the population would be zero.

Snow / Seba

滑りに行きたい病

最近読んだ本とか

本棚を整理して、よく読む本屋や積んである本の場所を用意してみた。今読ん出る本はまた別の場所にある。

一通り読んでみてScalaは結構楽しそう。

1270896965

Liftは気になるけどまだ読んでない。

1270896972

SRM460DIV2_250

java勉強中。

import java.util.ArrayList;
import java.util.List;

public class TheQuestionsAndAnswersDivTwo {

    public int find(String[] q) {
        List qlist = new ArrayList();
        int ans = 0;
        for (int i = 0; i < q.length; ++i)
            if (!qlist.contains(q[i]))
                qlist.add(q[i]);

        ans = (int) Math.pow(2, qlist.size());
        return ans;
    }

}

Set使えばいいのね。

Pharmacokinetic-Pharmacodynamic Modeling and Simulation 6章

Linear Mixed Effects Models

ProductName Pharmacokinetic-Pharmacodynamic Modeling and Simulation
Peter Bonate
Springer / ¥ 8,616 ()
在庫あり。

理論的な説明をさらっとやって例へ。Tumor Growthの薬剤Xの抑制効果が有為かどうかという例だった。

正直、よくわからんかった。MLとREMLの使い分けとか。

あとで読みなおそう。