-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79d07b5
commit 8795c19
Showing
9 changed files
with
141 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
|
||
|
||
rPar <- rainbowPlot(parrotDF, seed=12345) | ||
# remove multiple outliers | ||
toRemove <- interceptPositionPlot(rPar, highlightOutliers=T) | ||
parrotDF2 <- parrotDF[!parrotDF$Position %in% toRemove,] | ||
rainbowPlot(parrotDF2, seed=12345) | ||
|
||
|
||
rHum <- rainbowPlot(humanDF, seed=12345) | ||
# automatic outlier detection would remove SNPs that look OK | ||
remHum <- interceptPositionPlot(rHum, highlightOutliers = T) | ||
|
||
# select single outlier "by hand" | ||
which.max(coef(summary(rHum$lmer.model))[,1]) | ||
|
||
humanDF2 <- humanDF[humanDF$Position != 310,] # remove "by hand" | ||
rainbowPlot(humanDF2, seed=12345) | ||
divEst(parrotFX) | ||
|
||
# generate plots for manuscript | ||
#pdf("hopper.pdf", width=6, height=7) | ||
|
||
#download.file("https://tinyurl.com/4mtrbkzc", destfile = "hopper.csv") | ||
hopperDF <- read.table("hopper.csv") | ||
|
||
hopperFit <- rainbowPlot(hopperDF, | ||
seed = 12345, printout = FALSE, title = "Grasshopper") | ||
#dev.off() | ||
|
||
|
||
#pdf("parrot.pdf", width=6, height=7) | ||
rainbowPlot(parrotDF2, | ||
seed = 12345, printout = FALSE, title = "Parrot") | ||
#dev.off() | ||
|
||
#pdf("human.pdf", width=6, height=7) | ||
rainbowPlot(humanDF2, | ||
seed = 12345, printout = FALSE, title = "Human") | ||
#dev.off() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: vagrantDNA | ||
Type: Package | ||
Title: Estimating the proportion of vagrant DNA in a genome | ||
Version: 1.1.1 | ||
Version: 1.2.0 | ||
Author: Richard Nichols and Hannes Becher | ||
Maintainer: The package maintainer <[email protected]> | ||
Description: The package two functions rainbowPlot and divEst. They produce two different estimates of the proportion of DNA from a particular vagrant genome. They exploit low coverge data from multiple individuals in which the vagrant DNA has taken residence (see Becher and Nichols 2022). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
|
||
#' Intercept-position-plot for loci seect by rainbowPlot() | ||
#' Intercept-position-plot for loci selected by \code{rainbowPlot()} | ||
#' | ||
#' @param ff A `rainbowPlot()` fit. | ||
#' @param ff A \code{rainbowPlot()} fit. | ||
#' @param main Plot caption, default is "Intercept-position-plot" | ||
#' @param ... Arguments to be passed to `plot()` | ||
#' @param highlightOutliers Logical. Whether or not to highlight sites with | ||
#' outlier intercepts according to \code{boxplot.stats}. Default \code{F} | ||
#' @param ... Arguments to be passed to \code{plot()} | ||
#' @return Returns invisibly a vector of positions where the intercept estimate | ||
#' were outliers according to \code{boxplot.stats} | ||
#' | ||
#' @export | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' humanFit <- rainbowPlot(humanDF) | ||
#' interceptPositionPlot(humanFit) | ||
#' rPar <- rainbowPlot(parrotDF) | ||
#' toRemove <- interceptPositionPlot(rPar, highlightOutliers=T) | ||
#' parrotDF2 <- parrotDF[!parrotDF$Position %in% toRemove,] | ||
#' rainbowPlot(parrotDF2) | ||
#' } | ||
interceptPositionPlot <- function(ff, main="Intercept-position-plot", ...){ | ||
interceptPositionPlot <- function(ff, | ||
highlightOutliers=F, | ||
main="Intercept-position-plot", | ||
...){ | ||
coefs.a <- as.data.frame(coef(summary(ff$lmer.model))) | ||
coefs.a$site.numeric <- as.numeric(substr(rownames(coefs.a), 9, 30)) | ||
bounds <- boxplot.stats(coefs.a$Estimate)$stat | ||
coefs.a$out <- coefs.a$Estimate < bounds[1] | coefs.a$Estimate > bounds[5] | ||
if(highlightOutliers) { | ||
plot(Estimate ~ site.numeric, | ||
data=coefs.a, | ||
col=out+1, | ||
main=main, | ||
...) | ||
} else { | ||
plot(Estimate ~ site.numeric, | ||
data=coefs.a, | ||
main=main, | ||
...) | ||
} | ||
l01 <- loess(Estimate ~ site.numeric, | ||
data=coefs.a) | ||
lines(predict(l01, coefs.a$site.numeric)~coefs.a$site.numeric) | ||
return(invisible(coefs.a$site.numeric[coefs.a$out])) | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.