脂質２８（ししつにじゅうはち）

掛け算の「九九（くく）」の中に「ししちにじゅうはち」というものがあります。そこから

脂質２８（ししつにじゅうはち）

という、しょうもないダジャレを思いついたのでRDKitで出力することにしました。以下のコードは全て Google Colaboratory で動作確認済みです。

# RDKit のインストール


```Python
!pip install git+https://github.com/maskot1977/rdkit_installer.git

from rdkit_installer import install
install.from_miniconda()
```

    Collecting git+https://github.com/maskot1977/rdkit_installer.git
      Cloning https://github.com/maskot1977/rdkit_installer.git to /tmp/pip-req-build-3o2b74uz
      Running command git clone -q https://github.com/maskot1977/rdkit_installer.git /tmp/pip-req-build-3o2b74uz
    Building wheels for collected packages: rdkit-installer
      Building wheel for rdkit-installer (setup.py) ... [?25l[?25hdone
      Created wheel for rdkit-installer: filename=rdkit_installer-0.1.0-cp36-none-any.whl size=2850 sha256=564e84b70833b8ab3d724b5f0dd0b0b81586a7d1d321bfc2cce25caa6c866074
      Stored in directory: /tmp/pip-ephem-wheel-cache-x1ik7i2h/wheels/22/35/68/f3dcba76a2c9080c925b783ddf87a69f63521e0378721aec73
    Successfully built rdkit-installer
    Installing collected packages: rdkit-installer
    Successfully installed rdkit-installer-0.1.0


    add /root/miniconda/lib/python3.6/site-packages to PYTHONPATH
    python version: 3.6.9
    fetching installer from https://repo.continuum.io/miniconda/Miniconda3-4.7.12-Linux-x86_64.sh
    done
    installing miniconda to /root/miniconda
    done
    installing rdkit
    done
    rdkit-2020.03.3 installation finished!


# 脂質２８の選定

https://www.genome.jp/kegg-bin/get_htext?br08002.keg を参考に、名前の短めの脂質２８分子をなんとなく選びました。


```Python
lipids = [
          ["C13854", "1-Dodecanoyl-sn-glycerol"],
          ["C03199", "1,2-Didecanoyl-sn-glycerol"],
          ["C13870", "Tributyrin"],
          ["C04315", "sn-3-D-Galactosyl-sn-2-acylglycerol"],
          ["C00187", "Cholesterol"],
          ["C18129", "Monolysocardiolipin"],
          ["C00550", "Sphingomyelin"],
          ["C03985", "Linalool"],
          ["C04824", "Lipid X"],
          ["C08490", "cis-Jasmone"],
          ["C04685", "Prostaglandin A1"],
          ["C00909", "Leukotriene A4"],
          ["C02198", "Thromboxane A2"],
          ["C06314", "Lipoxin A4"],
          ["C18171", "Resolvin E1"],
          ["C04849", "Hepoxilin A3"], 
          ["C13807", "Levuglandin E2"],
          ["C13810", "Clavulone I"],
          ["C18178", "Resolvin D1"],
          ["C13821", "1-Hexadecyl hexadecanoate"],
          ["C08545", "Squamocin"],
          ["C12153", "Epothilone A"],
          ["C01848", "Rifamycin B"],
          ["C08725", "Pelargonin"],
          ["C09758", "Isochamaejasmin"],
          ["C00858", "Formononetin"],
          ["C05230", "Phaseollidin"],
          ["C09158", "Calophyllolide"]
]
len(lipids)
```




    28



# KEGG からの mol ファイルの取得


```Python
import urllib.request
from rdkit import Chem

mols = []
for id, name in lipids:
    url = "https://www.genome.jp/dbget-bin/www_bget?-f+m+compound+" + id
    urllib.request.urlretrieve(url, id + ".mol")
    mol = Chem.MolFromMolFile(id + ".mol")
    mol.SetProp("_Name", name)
    mols.append(mol)
```

# 脂質２８分子の２D表示


```Python
from rdkit.Chem import Draw

Draw.MolsToGridImage(
    mols, 
    molsPerRow=4, 
    subImgSize=(280,280), 
    legends=[x.GetProp("_Name") for x in mols] 
             )
```


![lipid28_7_0.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/211162/225ff205-bb2b-2fb5-0e68-14ccdcf62ac8.png)





# 脂質２８分子の３D表示


```Python
!pip install py3Dmol
```

    Collecting py3Dmol
      Downloading https://files.pythonhosted.org/packages/dd/19/dd527b0db65e730e20c3d5e5a7efbb7fbbf8d98f9debfb47962c13f479d6/py3Dmol-0.9.1-py2.py3-none-any.whl
    Installing collected packages: py3Dmol
    Successfully installed py3Dmol-0.9.1



```Python
import py3Dmol
from rdkit.Chem import AllChem

add_mols = []
for m in mols:
    m_h = Chem.AddHs(m)
    AllChem.EmbedMolecule(m_h, AllChem.ETKDG())
    add_mols.append(m_h)

view = py3Dmol.view(width=400, height=680, viewergrid=(7,4), linked=False)
for (n, (i,j)) in enumerate([(a,b) for a in range(7) for b in range(4)]):
    mb = Chem.MolToMolBlock(add_mols[n])
    view.addModel(mb, 'sdf', {'keepH': False}, viewer=(i,j))
    view.setStyle({'stick': {}}, viewer=(i,j))
view.zoomTo()
view.show()
```
![スクリーンショット 0002-12-21 12.33.53.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/211162/d75a51e4-57de-31f9-a2d3-b528b2286554.png)

脂質２８をぐりぐり回して遊べるよ！