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
a905e0e9
Commit
a905e0e9
authored
5 years ago
by
Todor Kondic
Browse files
Options
Downloads
Patches
Plain Diff
...
parent
30986b4e
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
DESCRIPTION
+0
-1
0 additions, 1 deletion
DESCRIPTION
R/mix.R
+78
-4
78 additions, 4 deletions
R/mix.R
man/RMB_EIC_prescreen_intrn.Rd
+28
-0
28 additions, 0 deletions
man/RMB_EIC_prescreen_intrn.Rd
with
106 additions
and
5 deletions
DESCRIPTION
+
0
−
1
View file @
a905e0e9
...
@@ -23,5 +23,4 @@ Imports:
...
@@ -23,5 +23,4 @@ Imports:
RMassBank,
RMassBank,
parallel,
parallel,
yaml,
yaml,
ReSOLUTION,
mzR
mzR
This diff is collapsed.
Click to expand it.
R/mix.R
+
78
−
4
View file @
a905e0e9
...
@@ -303,6 +303,83 @@ v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="ar
...
@@ -303,6 +303,83 @@ v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="ar
}
}
}
}
##' Prescreens. Ripped off from ReSOLUTION
##'
##'
##' @title Prescreen
##' @param archive_name ...
##' @param RMB_mode ...
##' @param FileList ...
##' @param cmpd_list ...
##' @param ppm_limit_fine ...
##' @param EIC_limit ...
##' @author Emma Schymanski
RMB_EIC_prescreen_intrn
<-
function
(
archive_name
,
RMB_mode
,
FileList
,
cmpd_list
,
ppm_limit_fine
=
10
,
EIC_limit
=
0.001
)
{
pdf_title
<-
paste
(
archive_name
,
"_EICscan.pdf"
,
sep
=
""
)
pdf
(
pdf_title
)
n_spec
<-
0
cmpd_RT_maxI
<-
""
msms_found
<-
""
rts
<-
0
max_I_prec
<-
""
cmpd_RT_maxI_min
<-
""
file_list
<-
read.csv
(
FileList
,
stringsAsFactors
=
FALSE
)
cmpd_info
<-
read.csv
(
cmpd_list
,
stringsAsFactors
=
FALSE
)
f
<-
mzR
::
openMSfile
(
file_list
$
Files
[
1
])
for
(
i
in
1
:
length
(
file_list
$
ID
))
{
cpdID
<-
file_list
$
ID
[
i
]
n_spec
<-
n_spec
+
1
smiles
<-
tryCatch
(
RMassBank
::
findSmiles
(
cpdID
),
error
=
function
(
e
)
NA
)
if
(
!
is.na
(
smiles
))
{
mz
<-
as.numeric
(
RMassBank
::
findMz
(
cpdID
,
RMB_mode
)[
3
])
}
else
{
mz
<-
as.numeric
(
RMassBank
::
findMz
(
cpdID
,
RMB_mode
,
retrieval
=
"unknown"
)[
3
])
}
eic
<-
RMassBank
::
findEIC
(
f
,
mz
,
limit
=
EIC_limit
)
msms_found
[
n_spec
]
<-
FALSE
msms
<-
RMassBank
::
findMsMsHR.mass
(
f
,
mz
,
0.5
,
ppm
(
mz
,
ppm_limit_fine
,
p
=
TRUE
))
max_I_prec_index
<-
which.max
(
eic
$
intensity
)
cmpd_RT_maxI
[
n_spec
]
<-
eic
[
max_I_prec_index
,
1
]
max_I_prec
[
n_spec
]
<-
eic
[
max_I_prec_index
,
2
]
cmpd_RT_maxI_min
[
n_spec
]
<-
as.numeric
(
cmpd_RT_maxI
[
n_spec
])
/
60
plot.new
()
plot.window
(
range
(
eic
$
rt
),
range
(
eic
$
intensity
))
box
()
lines
(
eic
$
intensity
~
eic
$
rt
)
for
(
specs
in
msms
)
{
if
(
specs
@
found
==
TRUE
)
{
df
<-
do.call
(
rbind
,
lapply
(
specs
@
children
,
function
(
sp
)
c
(
sp
@
rt
,
intensity
=
max
(
sp
@
intensity
))))
lines
(
intensity
~
retentionTime
,
data
=
df
,
type
=
"h"
,
col
=
"blue"
)
msms_found
[
n_spec
]
<-
TRUE
}
}
title
(
main
=
cpdID
,
xlab
=
"RT (sec)"
,
ylab
=
"Intensity"
)
text
(
as.numeric
(
cmpd_RT_maxI
[
n_spec
]),
as.numeric
(
max_I_prec
[
n_spec
]),
labels
=
as.numeric
(
cmpd_RT_maxI_min
[
n_spec
]),
pos
=
4
)
axis
(
1
)
axis
(
2
)
gc
()
rts
[
i
]
<-
(
cmpd_RT_maxI
[
n_spec
])
}
dev.off
()
write.csv
(
cbind
(
file_list
$
ID
,
cmpd_info
$
mz
,
cmpd_info
$
Name
,
cmpd_RT_maxI
,
cmpd_RT_maxI_min
,
max_I_prec
,
msms_found
),
file
=
paste
(
archive_name
,
"_RTs_wI.csv"
,
sep
=
""
),
row.names
=
F
)
}
##' Wrapper for a single prescreening call. Produces output in the
##' Wrapper for a single prescreening call. Produces output in the
##' usual mix method places.
##' usual mix method places.
##'
##'
...
@@ -329,11 +406,8 @@ presc.single <- function(fn_data,stgs_alist,wd,mode,fn_cmpd_l,ppm_lim_fine=10,EI
...
@@ -329,11 +406,8 @@ presc.single <- function(fn_data,stgs_alist,wd,mode,fn_cmpd_l,ppm_lim_fine=10,EI
## Generate file table.
## Generate file table.
fn_table
<-
gen_file_table
(
fn_data
,
n_cmpd
,
wd
)
fn_table
<-
gen_file_table
(
fn_data
,
n_cmpd
,
wd
)
print
(
fn_comp
)
print
(
n_cmpd
)
print
(
fn_table
)
curd
<-
setwd
(
wd
)
curd
<-
setwd
(
wd
)
res
<-
ReSOLUTION
::
RMB_EIC_prescreen
(
archive_name
=
nm_arch
,
RMB_mode
=
mode
,
res
<-
RMB_EIC_prescreen
_intrn
(
archive_name
=
nm_arch
,
RMB_mode
=
mode
,
FileList
=
fn_table
,
FileList
=
fn_table
,
cmpd_list
=
fn_comp
,
cmpd_list
=
fn_comp
,
ppm_limit_fine
=
ppm_lim_fine
,
ppm_limit_fine
=
ppm_lim_fine
,
...
...
This diff is collapsed.
Click to expand it.
man/RMB_EIC_prescreen_intrn.Rd
0 → 100644
+
28
−
0
View file @
a905e0e9
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mix.R
\name{RMB_EIC_prescreen_intrn}
\alias{RMB_EIC_prescreen_intrn}
\title{Prescreen}
\usage{
RMB_EIC_prescreen_intrn(archive_name, RMB_mode, FileList, cmpd_list,
ppm_limit_fine = 10, EIC_limit = 0.001)
}
\arguments{
\item{archive_name}{...}
\item{RMB_mode}{...}
\item{FileList}{...}
\item{cmpd_list}{...}
\item{ppm_limit_fine}{...}
\item{EIC_limit}{...}
}
\description{
Prescreens. Ripped off from ReSOLUTION
}
\author{
Emma Schymanski
}
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