Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ion injection time feature extraction from mzML file #159

Closed
mchiapello opened this issue Oct 4, 2016 · 2 comments
Closed

ion injection time feature extraction from mzML file #159

mchiapello opened this issue Oct 4, 2016 · 2 comments

Comments

@mchiapello
Copy link

mchiapello commented Oct 4, 2016

Dear Laurent,
I'd like to ask for a new feature in MSnbase:
Is it possible to add in "readMSData" function, to ability to read the ion injection time feature?

I used the following code for my analysis:

# Library
library(MSnbase)
library("XML")

# Read raw data
Rep1 <- "/path/to/file/*.mzML"
rawdata <- readMSData(Rep1)

# Prepare xml file
doc <- xmlInternalTreeParse(Rep1)
namespaceDef <- getDefaultNamespace(doc)
ns <- c(x=namespaceDef[[1]]$uri)

# Read "ion injection time"
x2 <- xpathApply(doc, "//x:cvParam[@accession = 'MS:1000927']", namespaces = ns, xmlAttrs)

# Extract the values
xvals2 <- sapply(x2, "[", "value")

# Validity check
length(xvals2) == nrow(fData(rawdata))

# Add ion injection time to MSnExp object
fData(rawdata)$inj2 <- as.numeric(xvals2)
@lgatto
Copy link
Owner

lgatto commented Oct 4, 2016

There is a new addInjectionTime method. It is a bit more complex than the code above because it needs to handle MSnExp objects build from multiple files and with different MS levels.

@lgatto
Copy link
Owner

lgatto commented Oct 5, 2016

Form commit 7aab7fe, injection time is now added by default in readMSData2. (The method that added it has been removed)

@lgatto lgatto closed this as completed Oct 5, 2016
lgatto pushed a commit that referenced this issue Oct 27, 2016
* master:
  fix typo
  document issue 160 in readMSData2 acq num warning
  add a warning if acq num not sorted - close issue #160
  fix confusing typo in news
  update readme
  injection time is now added by default in readMSData2
  mention v2.0 and readMSData2 in main vignette
  suggest on latest msdata
  fix bug in addInjectionTime
  rename to addInjectionTime
  new injectionTime method (see issue #159) - code in previous commit
  specify pattern when getting msdata::proteomics files
  new gh devel version

From: Laurent <[email protected]>

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@122003 bc3139a8-67e5-0310-9ffc-ced21a209358
lgatto pushed a commit that referenced this issue Apr 9, 2017
* master:
  fix typo
  document issue 160 in readMSData2 acq num warning
  add a warning if acq num not sorted - close issue #160
  fix confusing typo in news
  update readme
  injection time is now added by default in readMSData2
  mention v2.0 and readMSData2 in main vignette
  suggest on latest msdata
  fix bug in addInjectionTime
  rename to addInjectionTime
  new injectionTime method (see issue #159) - code in previous commit
  specify pattern when getting msdata::proteomics files
  new gh devel version

From: Laurent <[email protected]>

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@122003 bc3139a8-67e5-0310-9ffc-ced21a209358
lgatto pushed a commit that referenced this issue Sep 7, 2017
* master:
  fix typo
  document issue 160 in readMSData2 acq num warning
  add a warning if acq num not sorted - close issue #160
  fix confusing typo in news
  update readme
  injection time is now added by default in readMSData2
  mention v2.0 and readMSData2 in main vignette
  suggest on latest msdata
  fix bug in addInjectionTime
  rename to addInjectionTime
  new injectionTime method (see issue #159) - code in previous commit
  specify pattern when getting msdata::proteomics files
  new gh devel version

From: Laurent <[email protected]>

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/MSnbase@122003 bc3139a8-67e5-0310-9ffc-ced21a209358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants