Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/asd_sco_binary_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ASDScoBinary <- R6::R6Class("ASDScoBinary",

spec.df <-
data.frame(wavenumber=as.integer(rownames(spec.data)),
intensity=spec.data[1:length(spec.data)])
intensity=spec.data[seq_along(spec.data)])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and seq_len are nice. Admit that I have not seen them before.


meta.list <- list()
meta.list[["name"]] <- colnames(spec.data)
Expand Down
4 changes: 2 additions & 2 deletions R/nicolet_spa_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ key.value.pairs <- function(path) {

for (str in strings.from.spa(path)) {
delimiter <- NULL
if (grepl(str, pattern="=")) {
if (grepl(str, pattern="=", fixed = TRUE)) {
delimiter <- "="
} else if (grepl(str, pattern=":")) {
} else if (grepl(str, pattern=":", fixed = TRUE)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fair point.

delimiter <- ":"
}

Expand Down
10 changes: 5 additions & 5 deletions R/parse_raw_file_for_reading.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(!dir.exists(out.directory)){dir.create(out.directory)}

SpecSets <- unique(indf$SampleSpectrumSetId)

for(i in 1:length(SpecSets)){
for(i in seq_along(SpecSets)){
print(paste0('Processing Spectral Set ', i, ' of ', length(SpecSets)))
specid <- SpecSets[i]
idxs <- which(indf$SampleSpectrumSetId==specid)
Expand All @@ -39,11 +39,11 @@ if(!dir.exists(out.directory)){dir.create(out.directory)}
idxS <- which(specdf$Type=='SAMPLE')
sampDF <- specdf[idxS,]

for (j in 1:nrow(sampDF)) {
srec = sampDF[j,]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can at least say that this was not code I wrote. :) Easy to do though.

for (j in seq_len(nrow(sampDF))) {
srec <- sampDF[j,]
#brec = specdf[1,]

fname = paste0(srec$'Sample ID', '_', srec$SampleSpectrumSetId, '_', srec$SpectrumId)
fname <- paste0(srec$'Sample ID', '_', srec$SampleSpectrumSetId, '_', srec$SpectrumId)
odf <- rbind(bkgDF, srec)
write.csv(odf, paste0(out.directory, '/', fname, '.hlr'), row.names = F)

Expand Down Expand Up @@ -93,7 +93,7 @@ parse.scans <- function(path, out.directory) {

indf <- read.csv(path, header = T, check.names=F)

for(i in 1:nrow(indf)){
for(i in seq_len(nrow(indf))){
rec <- indf[i,]
print(paste0('Processing Spectra ', i, ' of ', nrow(indf)))
specid <- paste0( rec$core.label, '_', rec$core_position)
Expand Down