Giter Club home page Giter Club logo

Comments (11)

sgibb avatar sgibb commented on August 11, 2024

Did you tried

library("MADLIquantForeign")
spectra <- importImzMl(Directory)

importImzMl is looking for all .imzML files recursively.

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

Dear @sgibb
thank you for replying.
I load the library first everytime I work on MALDIquant and it does load the files. when I process the files individually it does that as well but but when i load multiple files( files of different samples) like this
1
It doesnot process them as separate files. I load the files as suggested but in my case the problem comes when i try to upload multiple files (files of different samples). How can I upload multiple files?
As with the fiedler data there is the folder that is to be uploaded which has all the files. I tried to upload folder with all my sample files but it is not working as well. I tried few options as mentioned in ist comment but they do not work.
also it gives this error
maldiquant Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘mass’ for signature ‘"list"’.
If you could please help me with this.

from maldiquant.

sgibb avatar sgibb commented on August 11, 2024

import* (as importImzMl) always returns a list of spectra (even if there is just one spectrum, then it is a list of length 1). You have to use the [[ operator (as for every generic list in R) to access the individual spectrum:

library("MADLIquantForeign")
spectra <- importImzMl(Directory)
mass(spectra[[1]])
plot(spectra[[1]])

There is no need to combine individual files manually because import* (and importImzMl) supports recursive reading of all files in a directory and also include and exclude patterns. You could even list the filenames manually:

## list files manually
spectra <- importImzMl(c("file1.imzMl", "file2.imzMl")) 
## use patterns
spectra <- importImzMl(".", pattern = "file[0-9]\\.imzMl")

But if you really want to combine the spectra on your own its:

spectra1 <- importImzMl("file1.imzMl")
spectra2 <- importImzMl("file2.imzMl")
spectra <- c(spectra1, spectra2)
## get the mz values of the first spectrum
mass(spectra[[1]])

Feel free to reopen the issue if it doesn't explain your problem.

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

@sgibb
Thank you for making it clear.
I tried the functions as suggested but I get this error
Errormsg

from maldiquant.

sgibb avatar sgibb commented on August 11, 2024

Could you attach the file? (I would need both the .imzMl and the corresponding .ibd)

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

from maldiquant.

sgibb avatar sgibb commented on August 11, 2024

Unfortunately your files are incorrect (I guess it is not your fault).

imzML files could store data in two formats: continuous or processed. Your .imzML files claim to be continuous but the .idb files are in fact processed. That's why MALDIquantForeign can import the first but not the second spectrum of a file. You may ask WATERS to fix their converter.

Please have a look at https://ms-imaging.org/wp/imzml/data-structure/ for the details:

In order to insure efficient storage, two different formats of the binary data are defined: continuous and processed. Continuous type means that each spectrum of an image has the same m/z values. As a result the m/z array is only saved once directly behind the UUID of the file and the intensity arrays of the spectra are following. At the processed type every spectrum has its own m/z array. So it is necessary to save both – the m/z array and the corresponding intensity array – per spectrum.

image

A quick fix for you would be to fix the imzML files by replacing line 10:

      <cvParam cvRef="IMS" accession="IMS:1000030" name="continuous" value=""/>

with

      <cvParam cvRef="IMS" accession="IMS:1000031" name="processed" value=""/>

A solution in R would be:

library("MALDIquant")
library("MALDIquantForeign")

repairImzMlFiles <- function(d) {
    files <- list.files(
        d, pattern = "*\\.imzML$", recursive = TRUE, full.names = TRUE
    )
    for (f in files) {
        lns <- sub(
            'accession=\"IMS:1000030\" name=\"continuous\"',
            'accession=\"IMS:1000031\" name=\"processed\"',
            readLines(f)
        )
        writeLines(lns, f)
    }
}

repairImzMlFiles(".")
spectra <- importImzMl(".")

par(mfrow = c(2, 1))
plot(spectra[[1]])
plot(spectra[[2]])

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

Thank You so much for your help . I will go through all the details and follow the procedure as mentioned. I may get back to you if I face any difficulty again.
I am attaching the file of how I convert the raw file into imzML format. If you could please see whether I am doing it right or not.
WatersFileConversion.pptx
Thank You again.
Kindest Regards
Umara

from maldiquant.

sgibb avatar sgibb commented on August 11, 2024

Sry, but I never used msconvert myself.

from maldiquant.

umara-Nissar avatar umara-Nissar commented on August 11, 2024

from maldiquant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.