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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Miroslav Kratochvil
shinyscreen
Commits
cba4bac3
Commit
cba4bac3
authored
5 years ago
by
Todor Kondic
Browse files
Options
Downloads
Patches
Plain Diff
Add README.org
* README.org: New file.
parent
fc52ed7f
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/mix.R
+32
-15
32 additions, 15 deletions
R/mix.R
R/run.R
+2
-2
2 additions, 2 deletions
R/run.R
man/presc.plot.Rd
+9
-0
9 additions, 0 deletions
man/presc.plot.Rd
with
43 additions
and
17 deletions
R/mix.R
+
32
−
15
View file @
cba4bac3
...
...
@@ -470,10 +470,12 @@ presc.p<-function(cl,fn_data,fn_cmpd_l,mode,ppm_lim_fine=10,EIC_limit=0.001) {
##' @param wd Sequence of data dirs containing the prescreen subdir.
##' @param out The name of the output file.
##' @param pal ColorBrewer palette name.
##' @param cex As in legend.
##' @param digits Number of significant digits for peak ret times.
##' @return Nothing useful.
##' @author Todor Kondić
##' @export
presc.plot
<-
function
(
wd
,
out
=
"prescreen.pdf"
,
pal
=
"Dark2"
)
{
presc.plot
<-
function
(
wd
,
out
=
"prescreen.pdf"
,
pal
=
"Dark2"
,
cex
=
0.75
,
digits
=
6
)
{
dfdir
<-
file.path
(
wd
,
"prescreen"
)
pdf
(
out
)
## Get the basenames of eic files.
...
...
@@ -493,20 +495,40 @@ presc.plot <- function(wd,out="prescreen.pdf",pal="Dark2") {
dfs
<-
lapply
(
dfs
,
function
(
x
)
data.frame
(
rt
=
x
$
rt
/
60
.
,
intensity
=
x
$
intensity
))
## Find existing children.
maybes
<-
file.path
(
dfdir
,
maybekid
)
indkids
<-
which
(
file.exists
(
maybes
))
kids
<-
maybes
[
indkids
]
dfs_kids
<-
lapply
(
kids
,
read.csv
,
stringsAsFactors
=
F
)
dfs_kids
<-
lapply
(
dfs_kids
,
function
(
x
)
data.frame
(
rt
=
x
$
retentionTime
/
60
.
,
intensity
=
-
x
$
intensity
))
## Find max intensities.
w_max
<-
sapply
(
dfs
,
function
(
x
)
which.max
(
x
$
intensity
))
rt_max
<-
Map
(
function
(
df
,
w
)
df
$
rt
[[
w
]],
dfs
,
w_max
)
i_max
<-
Map
(
function
(
df
,
w
)
df
$
intensity
[[
w
]],
dfs
,
w_max
)
symbs
<-
LETTERS
[
1
:
length
(
w_max
)]
## Find max intensities in children
w_max_kids
<-
sapply
(
dfs_kids
,
function
(
x
)
which.max
(
abs
(
x
$
intensity
)))
rt_max_kids
<-
Map
(
function
(
df
,
w
)
df
$
rt
[[
w
]],
dfs_kids
,
w_max_kids
)
i_max_kids
<-
Map
(
function
(
df
,
w
)
df
$
intensity
[[
w
]],
dfs_kids
,
w_max_kids
)
symbs_kids
<-
letters
[
indkids
]
rt_rng
<-
range
(
sapply
(
dfs
,
function
(
x
)
x
$
rt
))
int_rng
<-
range
(
sapply
(
dfs
,
function
(
x
)
x
$
intensity
))
plot.window
(
rt_rng
,
c
(
int_rng
[[
1
]],
1.
1
*
int_rng
[[
2
]]))
int_rng
<-
range
(
sapply
(
append
(
dfs_kids
,
dfs
)
,
function
(
x
)
x
$
intensity
))
plot.window
(
rt_rng
,
c
(
1.2
*
int_rng
[[
1
]],
1.
3
*
int_rng
[[
2
]]))
box
()
cols
<-
RColorBrewer
::
brewer.pal
(
n
=
length
(
dfs
),
name
=
pal
)
legend
(
"top"
,
horiz
=
T
,
legend
=
lbls
,
col
=
cols
,
fill
=
cols
)
lgnd
<-
Map
(
function
(
k
,
v
)
paste
(
k
,
"= "
,
v
,
sep
=
''
),
symbs
,
format
(
rt_max
,
digits
=
digits
))
linfo
<-
legend
(
"topleft"
,
horiz
=
T
,
legend
=
lbls
,
col
=
cols
,
fill
=
cols
,
bty
=
"n"
,
cex
=
cex
)
legend
(
x
=
linfo
$
rect
$
left
,
y
=
linfo
$
rect
$
top
-0.5
*
linfo
$
rect
$
h
,
horiz
=
T
,
legend
=
lgnd
,
fill
=
cols
,
bty
=
"n"
,
cex
=
cex
)
cols_kids
<-
cols
[
indkids
]
lgnd_kids
<-
Map
(
function
(
k
,
v
)
paste
(
k
,
"= "
,
v
,
sep
=
''
),
symbs_kids
,
format
(
rt_max_kids
,
digits
=
digits
))
if
(
length
(
lgnd_kids
)
>
0
)
legend
(
x
=
"bottomleft"
,
horiz
=
T
,
legend
=
lgnd_kids
,
fill
=
cols
[
indkids
],
bty
=
"n"
,
cex
=
cex
)
## Plot eic across the directory set.
for
(
n
in
seq
(
length
(
dfs
)))
{
...
...
@@ -515,19 +537,14 @@ presc.plot <- function(wd,out="prescreen.pdf",pal="Dark2") {
lines
(
df
$
intensity
~
df
$
rt
,
col
=
col
)
}
## Find existing children and plot them across the directory
## set.
maybes
<-
file.path
(
dfdir
,
maybekid
)
indkids
<-
which
(
file.exists
(
maybes
))
kids
<-
maybes
[
indkids
]
dfs
<-
lapply
(
kids
,
read.csv
,
stringsAsFactors
=
F
)
for
(
df
in
dfs
)
{
lines
(
intensity
~
retentionTime
,
data
=
df
,
type
=
"h"
,
col
=
"black"
)
if
(
length
(
dfs_kids
)
>
0
)
{
for
(
k
in
1
:
length
(
indkids
))
{
lines
(
intensity
~
rt
,
data
=
dfs_kids
[[
k
]],
type
=
"h"
,
col
=
cols_kids
[[
k
]])
}
}
title
(
main
=
i
,
xlab
=
"retention time [min]"
,
ylab
=
"intensity"
)
for
(
i
in
seq
(
length
(
w_max
)))
text
(
rt_max
[[
i
]],
i_max
[[
i
]],
labels
=
rt_max
[[
i
]],
pos
=
4
)
for
(
k
in
seq
(
length
(
w_max
)))
text
(
rt_max
[[
k
]],
i_max
[[
k
]],
labels
=
symbs
[[
k
]],
pos
=
4
,
offset
=
0.5
*
k
)
if
(
length
(
dfs_kids
)
>
0
)
for
(
k
in
seq
(
length
(
w_max_kids
)))
text
(
rt_max_kids
[[
k
]],
i_max_kids
[[
k
]],
labels
=
symbs_kids
[[
k
]],
pos
=
4
,
offset
=
0.5
*
k
)
axis
(
1
)
axis
(
2
)
gc
()
...
...
This diff is collapsed.
Click to expand it.
R/run.R
+
2
−
2
View file @
cba4bac3
...
...
@@ -68,7 +68,7 @@ sw.do<-function(fn_data,fn_cmpd_list,mode,rdir=".",combine=F,proc=F) {
stgs
<-
sapply
(
basename
(
wdirs
),
function
(
nm
)
paste
(
nm
,
"yml"
,
sep
=
'.'
))
if
(
proc
)
{
cl
<-
parallel
::
makeCluster
(
proc
)
cl
<-
parallel
::
makeCluster
(
proc
,
type
=
'FORK'
)
p.sw
(
fn_data
,
stgs
,
wdirs
,
fn_cmpd_list
,
mode
,
combine
=
combine
,
cl
=
cl
)
}
else
{
v
(
fn_data
,
stgs
,
wdirs
,
fn_cmpd_list
,
mode
,
combine
=
combine
)
...
...
@@ -116,7 +116,7 @@ mb.do<-function(mb,rdir=".",proc=F) {
fn_stgs
<-
sapply
(
names
(
mb
),
function
(
n
)
file.path
(
idir
(
n
),
attch
(
n
,
'.ini'
)))
if
(
proc
)
{
cl
<-
parallel
::
makeCluster
(
proc
)
cl
<-
parallel
::
makeCluster
(
proc
,
type
=
'FORK'
)
mb.p
(
mb
,
infodir
,
fn
<-
stgs
,
cl
=
cl
)
}
else
{
mb.v
(
mb
,
infodir
,
fn_stgs
)
...
...
This diff is collapsed.
Click to expand it.
man/presc.plot.Rd
+
9
−
0
View file @
cba4bac3
...
...
@@ -4,7 +4,11 @@
\alias{presc.plot}
\title{Plot the Output of Prescreen}
\usage{
presc.plot(wd, out = "prescreen.pdf", pal = "Dark2", cex = 0.75,
digits = 6)
presc.plot(wd, out = "prescreen.pdf", pal = "Accent")
}
\arguments{
\item{wd}{Sequence of data dirs containing the prescreen subdir.}
...
...
@@ -12,6 +16,11 @@ presc.plot(wd, out = "prescreen.pdf", pal = "Accent")
\item{out}{The name of the output file.}
\item{pal}{ColorBrewer palette name.}
\item{cex}{As in legend.}
\item{digits}{Number of significant digits for peak ret times.}
}
\value{
Nothing useful.
...
...
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