2024年4月11日木曜日

Python でSPLASH

MassBank レコードにはSplashというスペクトルに対するユニークなタグを付与する必要があります。


手作業で作成するときは下記のEnter Your Spectraで作成できます。


https://splash.fiehnlab.ucdavis.edu/


複数のファイルにSplashをPythonで一括付与するには、スペクトルデータからSPLASHを生成するPythonライブラリ pySPLASH をインストールします。Windows上での使い方を示します。

0. Anacondaがインストールされている前提です。

1. 下記のページに行く。

 https://github.com/berlinguyinca/spectra-hash/tree/master/python




2. Installation の下の「source code (ZIP)」をクリックしてZIPファイルをダウンロード

berlinguyinca-spectra-hash-174fbf2.zip

というファイルがダウンロードされる

このファイルをここではPipelineフォルダにコピーしてます。


3 berlinguyinca-spectra-hash-174fbf2.zip

をWindowsの機能で解凍する。

.\Pipeline\berlinguyinca-spectra-hash-174fbf2\berlinguyinca-spectra-hash-174fbf2\


4 Window メニュー=>Anaconda3 (64-bit)=>Anaconda Prompt (Anaconda 3)

を選択


5. 次にPipelineフォルダに移動する。


6. インストールフォルダに移動

C:\Pipeline>cd b

ここまで入力したらタブを押すと

C:\Pipeline>cd berlinguyinca-spectra-hash-174fbf2

と補完されるのでリターン

最終的に下記に移動

C:\Pipeline\berlinguyinca-spectra-hash-174fbf2\berlinguyinca-spectra-hash-174fbf2>cd python

7. ここでpython setup.py installと入力

C:\Pipeline\berlinguyinca-spectra-hash-174fbf2\berlinguyinca-spectra-hash-174fbf2\python>python setup.py install

これでpySPLASHがインストールされる。


8. 使い方


from splash import Spectrum, SpectrumType, Splash

# スペクトルデータ準備

# [(float m/z , int intensity),(float m/z , int intensity),(float m/z , int intensity)...]

spec = [(68.049498, 14), (70.065138, 999)]

spectrum = Spectrum(spec, SpectrumType.MS) splash = Splash().splash(spectrum)

print(splash)


>splash10-00di-9000000000-f8fa78114da5712d6bf9


と作成できます。



0 件のコメント:

コメントを投稿