Skip to content

Commit

Permalink
Check for identical ion header in readMgfData()
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatto committed Nov 5, 2023
1 parent 4d9a034 commit da115ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,6 +1,6 @@
Package: MSnbase
Title: Base Functions and Classes for Mass Spectrometry and Proteomics
Version: 2.29.0
Version: 2.29.1
Description: MSnbase provides infrastructure for manipulation,
processing and visualisation of mass spectrometry and
proteomics data, ranging from raw to quantitative and
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,5 +1,10 @@
# MSnbase 2.29

## MSnbase 2.29.1

- Check for identical ion header in `readMgfData()` (see [issue
597](https://github.com/lgatto/MSnbase/issues/597)).

## MSnbase 2.29.0

- New devel
Expand Down
8 changes: 7 additions & 1 deletion R/readWriteMgfData.R
Expand Up @@ -53,7 +53,7 @@ writeMgfDataFile <- function(splist, con, COM = NULL, TITLE = NULL,
}
cat(paste0("COM=",COM), file = con, sep = "")


verbose <- verbose & length(splist) > 1

if (verbose)
Expand Down Expand Up @@ -161,6 +161,12 @@ readMgfData <- function(filename,

fdata <- do.call(rbind, fdata)

## This checks that the headers are all the same
fdn <- sapply(fdata, names, simplify = FALSE)
fdn1 <- fdn[[1]]
for (i in fdn)
stopifnot(identical(fdn1, i), "Ion headers identical.")

names(spectra) <- paste0("X", seq_along(spectra))
assaydata <- list2env(spectra)
process <- new("MSnProcess",
Expand Down

0 comments on commit da115ab

Please sign in to comment.