Skip to main content

Writers and controlled vocabulary manager for PSI-MS's mzML and mzIdentML standards

Project description

psims

Prototype work for a unified API for writing PSIMS standardized XML documents, currently just mzML and MzIdentML

mzML Minimal Example

from psims.mzml.writer import MzMLWriter

# Load the data to write
scans = get_scan_data()

with MzMLWriter(open("out.mzML", 'wb')) as out:
    # Add default controlled vocabularies
    out.controlled_vocabularies()
    # Open the run and spectrum list sections
    with out.run(id="my_analysis"):
        with out.spectrum_list(count=len(scans)):
            for scan, products in scans:
                # Write Precursor scan
                out.write_spectrum(
                    scan.mz_array, scan.intensity_array,
                    id=scan.id, params=[
                        "MS1 Spectrum",
                        {"ms level": 1},
                        {"total ion current": sum(scan.intensity_array)}
                     ])
                # Write MSn scans
                for prod in products:
                    out.write_spectrum(
                        prod.mz_array, prod.intensity_array,
                        id=prod.id, params=[
                            "MSn Spectrum",
                            {"ms level": 2},
                            {"total ion current": sum(prod.intensity_array)}   
                         ], 
                         # Include precursor information
                         precursor_information={
                            "mz": prod.precursor_mz,
                            "intensity": prod.precursor_intensity,
                            "charge": prod.precursor_charge,
                            "scan_id": prod.precursor_scan_id
                         })

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

psims-0.1.16.tar.gz (601.4 kB view details)

Uploaded Source

Built Distributions

psims-0.1.16-py3-none-any.whl (629.7 kB view details)

Uploaded Python 3

psims-0.1.16-py2-none-any.whl (628.3 kB view details)

Uploaded Python 2

File details

Details for the file psims-0.1.16.tar.gz.

File metadata

  • Download URL: psims-0.1.16.tar.gz
  • Upload date:
  • Size: 601.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/2.7.14

File hashes

Hashes for psims-0.1.16.tar.gz
Algorithm Hash digest
SHA256 3f68abda2f5b451481afed3f9e7fc9970f4b52b9e399edd654f6c818d6fddba9
MD5 2655677549976a99bfea45d02c6ff64e
BLAKE2b-256 d0ef1350ce5ad5703c96c3a94349673f29e46b3da4babf340a8fc02fc7819618

See more details on using hashes here.

File details

Details for the file psims-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: psims-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 629.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/2.7.14

File hashes

Hashes for psims-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 af2d58870a5f69e3d15d76a7bb5323ba291b150db01aece2edc2afcac535a2bf
MD5 d15d135a484867493a1c9b917ce5550c
BLAKE2b-256 192f320bbe2bc2313a6b558a169e65512e8082fb7e303deb77e656e3350bcbc9

See more details on using hashes here.

File details

Details for the file psims-0.1.16-py2-none-any.whl.

File metadata

  • Download URL: psims-0.1.16-py2-none-any.whl
  • Upload date:
  • Size: 628.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/2.7.14

File hashes

Hashes for psims-0.1.16-py2-none-any.whl
Algorithm Hash digest
SHA256 5dbe4c1dd0a8103f102c36eb6635c816d34b85afaaa70f100391cd93eb2e8f10
MD5 a5f1df405ff524ff6026021d187a8a10
BLAKE2b-256 d5020c1c36b06f9a9b0c0a91ca834c7bf2ecf6d71d927af4305c65255e909878

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