Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ROBIBarcodes
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OBITools
ROBIBarcodes
Commits
c79ba4ea
Commit
c79ba4ea
authored
May 23, 2016
by
Eric Coissac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a view.legend and a maxerror parameters to the mismatchplot function
parent
27b72df0
Pipeline
#2
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
mismatchplot.R
R/mismatchplot.R
+16
-8
No files found.
R/mismatchplot.R
View file @
c79ba4ea
...
...
@@ -26,6 +26,10 @@ NULL
#' @param inset the distance to the margin of the legend box (see the \code{\link{legend}}
#' documentation)
#'
#' @param view.legend if set to \code{FALSE} the legend corresponding to the groups is not dispayed.
#'
#' @param maxerror allows for specifying the maximum of errors to display on the graph.
#'
#' @examples
#'
#' # Load the ROBITools library
...
...
@@ -48,11 +52,14 @@ NULL
#' @export
mismatchplot
=
function
(
ecopcr
,
group
=
NULL
,
col
=
NULL
,
legend
=
NULL
,
legend.cex
=
0.7
,
inset
=
c
(
0.02
,
0.02
))
{
legend.cex
=
0.7
,
inset
=
c
(
0.02
,
0.02
),
view.legend
=
TRUE
,
maxerror
=
NA
)
{
maxforward_error
=
max
(
ecopcr
$
forward_mismatch
)
maxreverse_error
=
max
(
ecopcr
$
reverse_mismatch
)
maxerror
=
max
(
maxforward_error
,
maxreverse_error
)
if
(
is.na
(
maxerror
))
maxerror
=
max
(
maxforward_error
,
maxreverse_error
)
if
(
is.null
(
group
))
group
=
factor
(
rep
(
"all"
,
dim
(
ecopcr
)[
1
]))
...
...
@@ -65,7 +72,7 @@ mismatchplot = function(ecopcr,group=NULL,
actualheight
=
maxerror
+
1
actualwidth
=
maxerror
+
1
if
(
length
(
levels
(
group
))
>
1
)
if
(
length
(
levels
(
group
))
>
1
&
view.legend
)
actualwidth
=
actualwidth
+
2
whitepaper
(
actualwidth
,
actualheight
,
xmin
=
-0.5
,
ymin
=
-0.5
,
asp
=
1
)
...
...
@@ -77,8 +84,8 @@ mismatchplot = function(ecopcr,group=NULL,
labels
=
0
:
maxerror
)
data
=
aggregate
(
group
,
by
=
list
(
forward
=
ecopcr
$
forward_mismatch
,
reverse
=
ecopcr
$
reverse_mismatch
),
data
=
aggregate
(
group
,
by
=
list
(
forward
=
factor
(
ecopcr
$
forward_mismatch
,
levels
=
0
:
maxerror
)
,
reverse
=
factor
(
ecopcr
$
reverse_mismatch
,
levels
=
0
:
maxerror
)
),
table
)
data
<-
data
[
rowSums
(
data
[,
c
(
-1
,
-2
),
drop
=
FALSE
])
>
0
,
,
drop
=
FALSE
]
...
...
@@ -89,8 +96,8 @@ mismatchplot = function(ecopcr,group=NULL,
value
=
data
[,
c
(
-1
,
-2
),
drop
=
FALSE
]
x
=
as.integer
(
data
[,
1
])
y
=
as.integer
(
data
[,
2
])
x
=
as.integer
(
data
[,
1
])
-
1
y
=
as.integer
(
data
[,
2
])
-
1
diam
=
sqrt
(
rowSums
(
value
))
radius
=
diam
/
max
(
diam
)
/
2
...
...
@@ -100,7 +107,7 @@ mismatchplot = function(ecopcr,group=NULL,
label
=
""
,
MoreArgs
=
list
(
col
=
col
))
if
(
length
(
levels
(
group
))
>
1
)
if
(
(
length
(
levels
(
group
)))
>
1
&
view.legend
)
legend
(
'topright'
,
legend
=
legend
,
fill
=
col
,
cex
=
legend.cex
,
inset
=
inset
)
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment