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
1257b85a
Commit
1257b85a
authored
2 years ago
by
Todor Kondić
Browse files
Options
Downloads
Patches
Plain Diff
Remove main bits of setid table processing.
parent
1d41c576
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/api.R
+3
-7
3 additions, 7 deletions
R/api.R
R/mix.R
+0
-17
0 additions, 17 deletions
R/mix.R
with
3 additions
and
24 deletions
R/api.R
+
3
−
7
View file @
1257b85a
...
@@ -151,8 +151,6 @@ load_compound_input <- function(m) {
...
@@ -151,8 +151,6 @@ load_compound_input <- function(m) {
cmpds
[,(
"known"
)
:=
.
(
the_ifelse
(
!
is.na
(
SMILES
),
"structure"
,
the_ifelse
(
!
is.na
(
Formula
),
"formula"
,
"mz"
)))]
cmpds
[,(
"known"
)
:=
.
(
the_ifelse
(
!
is.na
(
SMILES
),
"structure"
,
the_ifelse
(
!
is.na
(
Formula
),
"formula"
,
"mz"
)))]
m
$
input
$
tab
$
cmpds
<-
cmpds
m
$
input
$
tab
$
cmpds
<-
cmpds
fn_setid
<-
file.path
(
m
$
run
$
paths
$
project
,
m
$
conf
$
compounds
$
sets
)
fn_setid
<-
file.path
(
m
$
run
$
paths
$
project
,
m
$
conf
$
compounds
$
sets
)
m
$
input
$
tab
$
setid
<-
read_setid
(
fn_setid
,
m
$
input
$
tab
$
cmpds
)
m
m
}
}
...
@@ -190,18 +188,16 @@ load_inputs <- function(m) {
...
@@ -190,18 +188,16 @@ load_inputs <- function(m) {
mk_comp_tab
<-
function
(
m
)
{
mk_comp_tab
<-
function
(
m
)
{
message
(
"Stage: comptab"
)
message
(
"Stage: comptab"
)
setid
<-
m
$
input
$
tab
$
setid
setkey
(
setid
,
set
)
mzml
<-
m
$
input
$
tab
$
mzml
mzml
<-
m
$
input
$
tab
$
mzml
setkey
(
mzml
,
set
)
setkey
(
mzml
,
set
)
cmpds
<-
m
$
input
$
tab
$
cmpds
cmpds
<-
m
$
input
$
tab
$
cmpds
setkey
(
cmpds
,
ID
)
setkey
(
cmpds
,
set
,
ID
)
assert
(
nrow
(
cmpds
)
>
0
,
msg
=
"No compound lists have been provided."
)
assert
(
nrow
(
cmpds
)
>
0
,
msg
=
"No compound lists have been provided."
)
assert
(
all
(
mzml
[,
unique
(
set
)]
%in%
setid
[,
unique
(
set
)]),
msg
=
"Not all set names in the `datatab' data file table match those in the provided set list."
)
assert
(
all
(
mzml
[,
unique
(
set
)]
%in%
cmpds
[,
unique
(
set
)]),
msg
=
"Not all set names in the `datatab' data file table match those in the provided set list."
)
assert
(
all
(
mzml
[,
!
is.na
(
unique
(
adduct
))]),
msg
=
"Some data file entries do not have selected adducts."
)
assert
(
all
(
mzml
[,
!
is.na
(
unique
(
adduct
))]),
msg
=
"Some data file entries do not have selected adducts."
)
message
(
"Begin generation of the comprehensive table."
)
message
(
"Begin generation of the comprehensive table."
)
comp
<-
cmpds
[
setid
,
on
=
"ID"
][
mzml
,
.
(
tag
,
adduct
,
ID
,
RT
,
set
,
Name
,
file
,
SMILES
,
Formula
,
mz
,
known
),
on
=
"set"
,
allow.cartesian
=
T
]
comp
<-
cmpds
[
mzml
,
.
(
tag
,
adduct
,
ID
,
RT
,
set
,
Name
,
file
,
SMILES
,
Formula
,
mz
,
known
),
on
=
"set"
,
allow.cartesian
=
T
]
tab2file
(
tab
=
comp
,
file
=
paste0
(
"setidmerge"
,
".csv"
))
tab2file
(
tab
=
comp
,
file
=
paste0
(
"setidmerge"
,
".csv"
))
setkey
(
comp
,
known
,
set
,
ID
)
setkey
(
comp
,
known
,
set
,
ID
)
message
(
"Merged all sets."
)
message
(
"Merged all sets."
)
...
...
This diff is collapsed.
Click to expand it.
R/mix.R
+
0
−
17
View file @
1257b85a
...
@@ -489,23 +489,6 @@ vald_comp_tab<-function(df,ndf,checkSMILES=F,checkMz=F,checkNames=F) {
...
@@ -489,23 +489,6 @@ vald_comp_tab<-function(df,ndf,checkSMILES=F,checkMz=F,checkNames=F) {
df
df
}
}
read_setid
<-
function
(
fn
,
cmpds
)
{
assert
(
file.exists
(
fn
),
msg
=
paste
(
"Please provide valid compounds set table:"
,
fn
))
assert
(
nrow
(
cmpds
)
>
0
,
msg
=
"Please provide at least one compounds list."
)
setid
<-
file2tab
(
fn
,
colClasses
=
c
(
ID
=
"character"
))
x
<-
cmpds
[
setid
,
on
=
'ID'
][,
.SD
,
.SDcols
=
c
(
colnames
(
setid
),
'known'
)]
sids
<-
unique
(
setid
$
ID
)
cids
<-
unique
(
cmpds
$
ID
)
diff
<-
setdiff
(
sids
,
cids
)
assert
(
length
(
diff
)
==
0
,
msg
=
paste
(
"The following IDs from set table have not been found in the compound table:"
,
"------"
,
print_table
(
dtable
(
diff
)),
"------"
,
sep
=
"\n"
))
x
}
verify_cmpd_l
<-
function
(
dt
,
fn
)
{
verify_cmpd_l
<-
function
(
dt
,
fn
)
{
fields
<-
colnames
(
EMPTY_CMPD_LIST
)
fields
<-
colnames
(
EMPTY_CMPD_LIST
)
dtflds
<-
colnames
(
dt
)
dtflds
<-
colnames
(
dt
)
...
...
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