Skip to main content

A Python wrapper to use CFM-ID : https://cfmid.wishartlab.com

Project description

CFM-ID Python Package

This package is a Python wrapper to use CFM-ID : https://cfmid.wishartlab.com

CFM-ID provides a method for accurately and efficiently identifying metabolites in spectra generated by electrospray tandem mass spectrometry (ESI-MS/MS). The program uses Competitive Fragmentation Modeling to produce a probabilistic generative model for the MS/MS fragmentation process and machine learning techniques to adapt the model parameters from data.

This package is under devopment and work only for cfm-predict of the CFM-ID version 2.0.

Install

pip install cfm-id

Usage

from cfm_id import CfmId

cfm_id = CfmId("/path/to/cfm_id/folder")
cfm_id.predict("O=C1OC(CO)C(O)=C1O")

The default output format is a list of MatchMS Spectrum, including a "merged" spectrum of the 3 energies.

You can specify the CFM-ID raw text format export with the raw_format param :

cfm_id.predict("O=C1OC(CO)C(O)=C1O", raw_format=True)

Environment variable

You can also use environment variable CFMID_PATH rather than path argument.

export CFMID_PATH=path/to/cfm_id/folder
from cfm_id import CfmId

cfm_id = CfmId()

Param and config files

By default CfmId will use param_output.log and param_config.txt files located at the root of the cfm_id folder as respectively param and config files.

You can specify anoter files location at instantiation with local path as ist of string :

from cfm_id import CfmId

cfm_id = CfmId(
    "/path/to/cfm_id/folder",
    param=["param", "param_output0_neg.log"], conf=["conf", "param_config_neg.txt"]
)

In this example, the cfm_id instance will use /path/to/cfm_id/folder/param/param_output0_neg.log as param file.

Use Docker image

You can use a Docker image for CFM-ID rather than local files by using CfmIdDocker class.

from cfm_id import CfmIdDocker

cfm_id = CfmIdDocker("myrepo/image_name:tag")

In the Docker image, cfm-predict has to be in the PATH environment variable and param_output.log and param_config.txt files must be located at the working directory.

You can also use environment variable CFMID_IMAGE rather than path argument.

export CFMID_IMAGE=myrepo/image_name:tag
from cfm_id import CfmIdDocker

cfm_id = CfmIdDocker()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cfm_id-0.1.6.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

cfm_id-0.1.6-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file cfm_id-0.1.6.tar.gz.

File metadata

  • Download URL: cfm_id-0.1.6.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.12 Linux/5.4.0-92-generic

File hashes

Hashes for cfm_id-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e5e9994160ab83afe361199cd8675d53654464405153824d936d42a5ebf6afd5
MD5 c2f88410e8c4d16993ce71a71e85be87
BLAKE2b-256 fcf726c867051f45565c7d20c59847f0bd411decf882245a80174a21b69f40a2

See more details on using hashes here.

File details

Details for the file cfm_id-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: cfm_id-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.12 Linux/5.4.0-92-generic

File hashes

Hashes for cfm_id-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0edcb2a21346b68eca9dd22080ac2374d92297b1e6490b883366d9f9c2ae811e
MD5 fb8a230829c1995f77c519831691289c
BLAKE2b-256 95ab4ab8e1882d7c4ecb956275460b2c3143dc82a0468ced7da38d17d8f9efb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page