Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ngs_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
bioinfo
ngs_tools
Commits
2b5d595c
Commit
2b5d595c
authored
10 years ago
by
Melanie Schneider
Browse files
Options
Downloads
Patches
Plain Diff
new variable names
parent
8d217177
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
dge_workflow/cutadapt_summary.R
+28
-24
28 additions, 24 deletions
dge_workflow/cutadapt_summary.R
with
28 additions
and
24 deletions
dge_workflow/cutadapt_summary.R
+
28
−
24
View file @
2b5d595c
...
...
@@ -6,6 +6,7 @@
devtools
::
source_url
(
"https://dl.dropboxusercontent.com/u/113630701/datautils/R/core_commons.R"
)
devtools
::
source_url
(
"https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R"
)
require
(
knitr
)
## can we access variables from the parent spin.R process?
#echo("rscript is ", r_script)
...
...
@@ -17,7 +18,6 @@ argv = commandArgs(TRUE)
if
(
length
(
argv
)
!=
1
){
stop
(
"Usage: First_try.R <directory with cutadapt log files>"
)
echo
}
baseDir
=
argv
[
1
]
...
...
@@ -47,14 +47,13 @@ echo(info3)
parameters
=
readLines
(
pipe
(
paste
(
"grep -F 'Command line parameters' "
,
logDataFiles
[
1
])
))
echo
(
parameters
)
echo
(
"Some explanation:"
)
#' #### Some explanations:
if
(
grepl
(
"-a"
,
parameters
)
==
TRUE
)
echo
(
"-a indicates that the following is a 3' adapter."
)
echo
(
"-a indicates that the following is a 3'
end
adapter."
)
if
(
grepl
(
"-g"
,
parameters
)
==
TRUE
)
echo
(
"-g indicates that the following is a 5' adapter."
)
echo
(
"-g indicates that the following is a 5'
end
adapter."
)
if
(
grepl
(
"-b"
,
parameters
)
==
TRUE
)
echo
(
"-b indicates that the adapter is 3' or 5' (both possible)."
)
echo
(
"-b indicates that the adapter is
located at the
3' or 5'
end
(both possible)."
)
if
(
grepl
(
"-m"
,
parameters
)
==
TRUE
)
echo
(
"Reads shorter than -m bases are thrown away."
)
if
(
grepl
(
"-q"
,
parameters
)
==
TRUE
)
...
...
@@ -68,19 +67,19 @@ if (grepl("-O", parameters) ==TRUE)
if
(
grepl
(
"-N"
,
parameters
)
==
TRUE
)
echo
(
"Wildcard characters in the adapter are enabled by -N."
)
echo
(
"
For more detailed information on cutadapt go to https://cutadapt.readthedocs.org/en/latest/index.html
"
)
#' ####
For more detailed information on cutadapt go to https://cutadapt.readthedocs.org/en/latest/index.html
#' ## Trimming Overview
genTable1
<-
function
(
logFile
){
data.frame
(
r
un
=
sub
(
"^([^.]*).*"
,
"\\1"
,
basename
(
logFile
)),
num_pro
Reads
=
(
paste
(
"grep -F 'Processed reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9]+"
)
%>%
unlist
()
%>%
as.numeric
())[
2
],
num_pro
Bases
=
(
paste
(
"grep -F 'Processed bases' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9]+"
)
%>%
unlist
()
%>%
as.numeric
())[
2
],
t
rim
_r
eads
=
(
paste
(
"grep -F 'Trimmed reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
3
],
q
ual
_
trimmed
=
(
paste
(
"grep -F 'Quality-trimmed' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
4
],
t
rim
_b
ases
=
(
paste
(
"grep -F 'Trimmed bases' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
4
],
t
oo_short
=
(
paste
(
"grep -F 'Too short reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
3
]
R
un
=
sub
(
"^([^.]*).*"
,
"\\1"
,
basename
(
logFile
)),
No_of_processed_
Reads
=
(
paste
(
"grep -F 'Processed reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9]+"
)
%>%
unlist
()
%>%
as.numeric
())[
2
],
No_of_processed_
Bases
=
(
paste
(
"grep -F 'Processed bases' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9]+"
)
%>%
unlist
()
%>%
as.numeric
())[
2
],
T
rim
med_R
eads
=
(
paste
(
"grep -F 'Trimmed reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
3
],
Q
ual
ity
-
trimmed
=
(
paste
(
"grep -F 'Quality-trimmed' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
4
],
T
rim
med_B
ases
=
(
paste
(
"grep -F 'Trimmed bases' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
4
],
T
oo_short
_Reads
=
(
paste
(
"grep -F 'Too short reads' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
strsplit
(
"[^0-9\\.]+"
)
%>%
unlist
()
%>%
as.numeric
())[
3
]
)
}
trimmingStats
<-
logDataFiles
%>%
ldply
(
genTable1
)
...
...
@@ -95,11 +94,11 @@ write.delim(trimmingStats, file="cutadapt_summary.trimmingStats.txt")
genTable2
<-
function
(
logFile
){
#browser()
data.frame
(
r
un
=
sub
(
"^([^.]*).*"
,
"\\1"
,
basename
(
logFile
)),
a
dapter
=
(
paste
(
"grep -F '=== Adapter ' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"'"
,
3
))[,
2
],
t
rimmed
=
(
paste
(
"grep -F '; Trimmed: ' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
6
))[,
5
]
%>%
as.numeric
(),
o
verlapped
5
=
(
paste
(
"grep -F 'overlapped the 5' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
2
)
)[,
1
]
%>%
as.numeric
(),
o
verlapped
3
=
(
paste
(
"grep -F 'overlapped the 3' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
2
)
)[,
1
]
%>%
as.numeric
()
R
un
=
sub
(
"^([^.]*).*"
,
"\\1"
,
basename
(
logFile
)),
A
dapter
=
(
paste
(
"grep -F '=== Adapter ' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"'"
,
3
))[,
2
],
T
rimmed
=
(
paste
(
"grep -F '; Trimmed: ' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
6
))[,
5
]
%>%
as.numeric
(),
O
verlapped
_at_5prime
=
(
paste
(
"grep -F 'overlapped the 5' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
2
)
)[,
1
]
%>%
as.numeric
(),
O
verlapped
_at_3prime
=
(
paste
(
"grep -F 'overlapped the 3' "
,
logFile
)
%>%
pipe
()
%>%
readLines
()
%>%
str_split_fixed
(
"[^0-9]+"
,
2
)
)[,
1
]
%>%
as.numeric
()
)
}
adapterTrimmingStats
<-
logDataFiles
%>%
ldply
(
genTable2
)
...
...
@@ -112,8 +111,13 @@ write.delim(adapterTrimmingStats, file="cutadapt_summary.adapterTrimmingStats.tx
#' [Adapter Statistics](cutadapt_summary.adapterTrimmingStats.txt)
#+ fig.height=10, fig.width=10
ggplot
(
trimmingStats
,
aes
(
run
,
num_proReads
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
run
,
trimmed
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
adapter
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
run
,
overlapped5
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
adapter
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
run
,
overlapped3
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
adapter
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
No_of_processed_Reads
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
No_of_processed_Bases
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
Trimmed_Reads
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
Quality
-
trimmed
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
Trimmed_Bases
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
trimmingStats
,
aes
(
Run
,
Too_short_Reads
))
+
geom_bar
(
stat
=
'identity'
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
Run
,
Trimmed
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
Adapter
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
Run
,
Overlapped_at_5prime
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
Adapter
)
+
coord_flip
()
ggplot
(
adapterTrimmingStats
,
aes
(
Run
,
Overlapped_at_3prime
))
+
geom_bar
(
stat
=
'identity'
)
+
facet_wrap
(
~
Adapter
)
+
coord_flip
()
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