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.11a0.tar.gz (597.5 kB view details)

Uploaded Source

Built Distributions

psims-0.1.11a0-py2.7.egg (738.1 kB view details)

Uploaded Source

psims-0.1.11a0-py2-none-any.whl (624.6 kB view details)

Uploaded Python 2

File details

Details for the file psims-0.1.11a0.tar.gz.

File metadata

  • Download URL: psims-0.1.11a0.tar.gz
  • Upload date:
  • Size: 597.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for psims-0.1.11a0.tar.gz
Algorithm Hash digest
SHA256 5f1bfdb71e5e1dd1e533a156138d41c419514d12d277283c995c77ed317b137d
MD5 24dc93be69c56bc218195732cfce69d4
BLAKE2b-256 5ec54f3ae24fd465a48326b368509c6cd0f592827b8d1d7f8c5c755a96fb8b31

See more details on using hashes here.

File details

Details for the file psims-0.1.11a0-py2.7.egg.

File metadata

  • Download URL: psims-0.1.11a0-py2.7.egg
  • Upload date:
  • Size: 738.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for psims-0.1.11a0-py2.7.egg
Algorithm Hash digest
SHA256 c9cd12d9150be17e312f2184565d44927c601f81323a12d0eadf3a3533a14301
MD5 e704da957620519de5ac4abc6d7dbe1a
BLAKE2b-256 b04d1699efd0255d9c356814f5f895c6bc726620d9479ac42ee2ea20029dae5c

See more details on using hashes here.

File details

Details for the file psims-0.1.11a0-py2-none-any.whl.

File metadata

File hashes

Hashes for psims-0.1.11a0-py2-none-any.whl
Algorithm Hash digest
SHA256 2c3a3fedc11800421c76c6858660879ee5541a598e11e079958eff02dbcd24ed
MD5 73715f2ae6dc29dd849fff30b68695a9
BLAKE2b-256 140e743bb5055f11c73fb387918eefa7f41797608c585b934f84847aab8e7174

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