Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RMassBank_by_MaliRemorker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Environmental Cheminformatics
RMassBank_by_MaliRemorker
Commits
085369d5
Unverified
Commit
085369d5
authored
5 years ago
by
MaliRemorker
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2 from MaliRemorker/devel
Devel
parents
7a74f64d
f2ff1c43
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/leCsvAccess.R
+31
-19
31 additions, 19 deletions
R/leCsvAccess.R
R/msmsRead.R
+5
-6
5 additions, 6 deletions
R/msmsRead.R
man/dot-parseTitleString.Rd
+42
-0
42 additions, 0 deletions
man/dot-parseTitleString.Rd
with
78 additions
and
25 deletions
R/leCsvAccess.R
+
31
−
19
View file @
085369d5
...
...
@@ -10,7 +10,7 @@ assign("listEnv", NULL, envir=.listEnvEnv)
#' \code{listEnv} (which defaults to the global environment) and used by
#' the \code{findMz}, \code{findCAS}, ... functions. The CSV file is required to have at least the following columns, which are used for
#' further processing and must be named correctly (but present in any order): \var{ID, Name, SMILES, RT,
#' CAS}
#' CAS}
. If a dataframe is supplied instead of path, this can be loaded in, too.
#'
#' resetList() clears a currently loaded list.
#'
...
...
@@ -18,10 +18,13 @@ assign("listEnv", NULL, envir=.listEnvEnv)
#' @usage loadList(path, listEnv=NULL, check=TRUE)
#'
#' resetList()
#' @param path Path to the CSV list.
#' @param listEnv The environment to load the list into. By default, the namelist is loaded
#' into an environment internally in RMassBank.
#' @param check A parameter that specifies whether the SMILES-Codes in the list should be checked for readability by rcdk.
#' @param path Path to the CSV list. Alternatively, a data.frame of a
#' previously read in compound list.
#' @param listEnv The environment to load the list into. By default,
#' the namelist is loaded into an environment internally in
#' RMassBank.
#' @param check A parameter that specifies whether the SMILES-Codes in
#' the list should be checked for readability by rcdk.
#' @return No return value.
#' @author Michael Stravs
#' @seealso \code{\link{findMz}}
...
...
@@ -34,20 +37,29 @@ assign("listEnv", NULL, envir=.listEnvEnv)
loadList
<-
function
(
path
,
listEnv
=
NULL
,
check
=
TRUE
)
{
if
(
is.null
(
listEnv
))
listEnv
<-
.listEnvEnv
if
(
!
file.exists
(
path
))
stop
(
"The supplied file does not exist, please supply a correct path"
)
# Try out if the file is comma- or semicolon-separated
compoundList
<-
read.csv
(
path
,
stringsAsFactors
=
FALSE
,
check.names
=
FALSE
)
n
<-
colnames
(
compoundList
)
if
(
!
(
"ID"
%in%
n
)){
# If no ID column, it must be semicolon separated
compoundList
<-
read.csv2
(
path
,
stringsAsFactors
=
FALSE
,
check.names
=
FALSE
)
listEnv
<-
.listEnvEnv
compoundList
<-
if
(
is.data.frame
(
path
))
{
path
}
else
{
if
(
!
file.exists
(
path
))
stop
(
"The supplied file does not exist, please supply a correct path"
)
## Try out if the file is comma- or semicolon-separated.
tmpList
<-
read.csv
(
path
,
stringsAsFactors
=
FALSE
,
check.names
=
FALSE
)
n
<-
colnames
(
tmpList
)
if
(
!
(
"ID"
%in%
n
)){
# If no ID column, it must be semicolon separated
tmpList
<-
read.csv2
(
path
,
stringsAsFactors
=
FALSE
,
check.names
=
FALSE
)
n
<-
colnames
(
tmpList
)
if
(
!
(
"ID"
%in%
n
)){
# ...or there must be something wrong with the column names
stop
(
"There is no 'ID' column in the compound list"
)
}
}
tmpList
}
n
<-
colnames
(
compoundList
)
if
(
!
(
"ID"
%in%
n
)){
# ...or there must be something wrong with the column names
stop
(
"There is no 'ID' column in the compound list"
)
}
}
# Now everything should be fine, at least regarding csv and ssv
...
...
@@ -626,4 +638,4 @@ findMass <- function(cpdID_or_smiles, retrieval="standard", mode = "pH")
mol
<-
getMolecule
(
s
)
return
(
get.exact.mass
(
mol
))
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
R/msmsRead.R
+
5
−
6
View file @
085369d5
...
...
@@ -495,12 +495,10 @@ msmsRead.parallel <- function(cl,w,filetable = NULL, files = NULL, cpdids = NULL
envir
<-
environment
()
## clusterExport(cl,c("count","envir")) # Have no idea what
## # for are those two.
doone
<-
function
(
fn
)
{
doone
<-
function
(
fn
,
cpdID
)
{
## Find compound ID
cpdID
<-
cpdids
[
count
]
retrieval
<-
findLevel
(
cpdID
,
TRUE
)
## Set counter up
envir
$
count
<-
envir
$
count
+
1
## Retrieve spectrum data
spec
<-
findMsMsHR
(
fileName
=
fn
,
...
...
@@ -510,12 +508,13 @@ msmsRead.parallel <- function(cl,w,filetable = NULL, files = NULL, cpdids = NULL
fillPrecursorScan
=
settings
$
findMsMsRawSettings
$
fillPrecursorScan
,
rtMargin
=
settings
$
rtMargin
,
deprofile
=
settings
$
deprofile
,
retrieval
=
retrieval
)
message
(
"File: "
,
fn
,
"Compound: "
,
cpdID
,
"DONE"
)
message
(
"File: "
,
fn
,
"
;
Compound
ID
: "
,
cpdID
,
"
; Status:
DONE"
)
gc
()
return
(
spec
)
}
cllct
<-
parallel
::
parLapply
(
cl
,
w
@
files
,
doone
)
parallel
::
clusterExport
(
cl
,
c
(
"readMethod"
,
"mode"
,
"confirmMode"
,
"useRtLimit"
,
"settings"
),
envir
=
environment
())
cllct
<-
parallel
::
clusterMap
(
cl
,
doone
,
w
@
files
,
cpdids
)
w
@
spectra
<-
as
(
cllct
,
"SimpleList"
)
names
(
w
@
spectra
)
<-
basename
(
as.character
(
w
@
files
))
return
(
w
)
...
...
This diff is collapsed.
Click to expand it.
man/dot-parseTitleString.Rd
0 → 100644
+
42
−
0
View file @
085369d5
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/createMassBank.R
\name{.parseTitleString}
\alias{.parseTitleString}
\title{Parse record title}
\usage{
.parseTitleString(mbrecord)
}
\arguments{
\item{mbrecord}{A MassBank record in list format, as returned from
\code{\link{gatherSpectrum}}.}
}
\value{
A string with the title.
}
\description{
Parses a title for a single MassBank record using the title format
specified in the option titleFormat. Internally used, not exported.
}
\details{
If the option is not set, a standard title format is used (for record definition
version 1 or 2).
}
\examples{
\dontrun{
# used in compileRecord()
title <- .parseTitleString(mbrecord)
}
}
\references{
MassBank record format:
\url{http://www.massbank.jp/manuals/MassBankRecord_en.pdf}
}
\seealso{
\code{\link{compileRecord}}
}
\author{
Michael Stravs, Eawag
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment