psims icon indicating copy to clipboard operation
psims copied to clipboard

[Question] Adding 1/k0 information to selected precursor ions

Open jspaezp opened this issue 8 months ago • 2 comments

Hello Joshua!

I hope everything is going well! I had a question on the usage of the package. I am trying to write an mzML where the spectra has ion mobility information and I was wondering if this was currently supported (or the option to pass a custom entry at a specific place). Let me know if you can point me to a place in the documentation where I could find that!

Here is a sample of the arguments I am trying to pass to the writer.

sample = {
            "mz_array": mz,
            "intensity_array": intensity,
            "scan_start_time": rt,
            "id": f"scan={i+offset}",
            "params": [
                "MSn Spectrum",
                {"ms level": 2},
                {"total ion current": sum(intensity)},
            ],
            "precursor_information": {
                "activation": [
                    "beam-type collisional dissociation",
                    {"collision energy": 25},
                ],
                "mz": quad_mid,
                "intensity": sum(intensity),
                "charge": 2,
                "isolation_window": [quad_low, quad_mid, quad_high],
                "scan_id": last_precursor_scan_id,
                "selectedIonList": [
                    {
                        ########## HERE ###########
                        "inverse reduced ion mobility": mobility_value,
                    }
                ],
            },
        }
with IndexedMzMLWriter("outfile.mzml") as out:
    ...
    out.write_spectrum(**sample)

And I would like the precursor list section of the mzml to look something like this:

            <precursorList count="1">
                <precursor>
                    <isolationWindow>
                        <cvParam cvRef="MS" accession="MS:1000827" name="isolation window target m/z" value="457.723968505859" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
                        <cvParam cvRef="MS" accession="MS:1000828" name="isolation window lower offset" value="1.5" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
                        <cvParam cvRef="MS" accession="MS:1000829" name="isolation window upper offset" value="0.75" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
                    </isolationWindow>
                    <selectedIonList count="1">
                        <selectedIon>
                            <cvParam cvRef="MS" accession="MS:1000744" name="selected ion m/z" value="457.723968505859" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
                            <cvParam cvRef="MS" accession="MS:1000041" name="charge state" value="2" />
                            <cvParam cvRef="MS" accession="MS:1002815" name="inverse reduced ion mobility" value="1.078628" unitAccession="MS:1002814" unitName="volt-second per square centimeter"/>
                        </selectedIon>
                    </selectedIonList>
                    <activation>
                        <cvParam cvRef="MS" accession="MS:1000133" name="collision-induced dissociation" />
                        <cvParam cvRef="MS" accession="MS:1000045" name="collision energy" value="35.0"/>
                    </activation>
                </precursor>
            </precursorList>

jspaezp avatar Oct 12 '23 01:10 jspaezp