Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
shinyscreen
Manage
Activity
Members
Labels
Plan
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review 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
shinyscreen
Commits
a672cbf3
Commit
a672cbf3
authored
5 years ago
by
Todor Kondic
Browse files
Options
Downloads
Patches
Plain Diff
Add various auxiliary functions
* R/mix.R(gen_stgs_and_load,gen_cmpdl_and_load,gen_file_table): New functions.
parent
43d1a566
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/mix.R
+56
-0
56 additions, 0 deletions
R/mix.R
with
56 additions
and
0 deletions
R/mix.R
+
56
−
0
View file @
a672cbf3
...
@@ -92,6 +92,62 @@ gen_comp_list<-function(src_fn,dest_fn) {
...
@@ -92,6 +92,62 @@ gen_comp_list<-function(src_fn,dest_fn) {
length
(
nms
)
length
(
nms
)
}
}
##' Generates settings file and loads it.
##'
##'
##' @title Generate and Load the RMassBank Settings File
##' @param fn_data The mzML filename.
##' @param stgs_alist Settings named list, or a settings filename.
##' @param wd Directory under which results are archived.
##' @return result of RMassBank::loadRmbSettings
##' @author Todor Kondić
gen_stgs_and_load
<-
function
(
fn_data
,
stgs
,
wd
)
{
wd
<-
normalizePath
(
wd
)
fn_data
<-
normalizePath
(
fn_data
)
stgs_alist
<-
if
(
is.character
(
stgs_alist
))
yaml
::
yaml.load_file
(
stgs_alist
)
else
stgs_alist
sfn
<-
file.path
(
wd
,
paste
(
basename
(
fn_data
),
".ini"
,
sep
=
''
))
mk_sett_file
(
stgs_alist
,
sfn
)
RMassBank
::
loadRmbSettings
(
sfn
)
}
##' Generates the RMassBank compound list and loads it.
##'
##'
##' @title Generate and Load the RMassBank Compound List
##' @param fn_data The mzML filename.
##' @param wd Directory under which results are archived.
##' @return Named list. The key `fn_cmpdl` is the path of the
##' generated compound list and the key `n` the number of
##' compounds.
##' @author Todor Kondić
gen_cmpdl_and_load
<-
function
(
fn_data
,
wd
,
fn_cmpdl
)
{
wd
<-
normalizePath
(
wd
)
fn_data
<-
normalizePath
(
fn_data
)
fn_comp
<-
file.path
(
wd
,
paste
(
basename
(
fn_data
),
".comp.csv"
,
sep
=
''
))
n_cmpd
<-
gen_comp_list
(
fn_cmpd_l
,
fn_comp
)
list
(
fn_cmpdl
=
fn_comp
,
n
=
n_cmpd
)
}
##' Generates file table.
##'
##'
##' @title Generate and Load the RMassBank Settings File
##' @param fn_data The mzML filename.
##' @param n_cmpd Number of compounds.
##' @param wd Directory under which results are archived.
##' @return NULL
##' @author Todor Kondić
gen_file_table
<-
function
(
fn_data
,
n_cmpd
,
wd
)
{
wd
<-
normalizePath
(
wd
)
fn_data
<-
normalizePath
(
fn_data
)
df_table
<-
data.frame
(
Files
=
rep
(
fn_data
,
n_cmpd
),
ID
=
1
:
n_cmpd
)
fn_table
<-
file.path
(
wd
,
paste
(
"fn-table."
,
basename
(
fn_data
),
".csv"
,
sep
=
''
))
write.csv
(
x
=
df_table
,
file
=
fn_table
,
row.names
=
F
)
NULL
}
##' Runs a compound mixture workflow on a single mzML file.
##' Runs a compound mixture workflow on a single mzML file.
##'
##'
##' @title RMassBank Spectral Workflow on a Single Compound Mixture
##' @title RMassBank Spectral Workflow on a Single Compound Mixture
...
...
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