forked from gaynorr/AlphaSimR
-
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.
Working on writeRecords
- Loading branch information
GAYNOR Chris
committed
Apr 14, 2017
1 parent
a883cb5
commit 18b4571
Showing
14 changed files
with
111 additions
and
7 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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
Package: AlphaSimR | ||
Type: Package | ||
Title: Breeding Program Simulation Tools | ||
Version: 0.1 | ||
Title: Breeding Program Simulations | ||
Version: 0.1.1 | ||
Author: Chris Gaynor | ||
Maintainer: Chris Gaynor <[email protected]> | ||
Description: This package contains classes and functions for simulating plant and animal breeding programs. | ||
License: GPL (>= 2) | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Depends: MASS | ||
Imports: Rcpp (>= 0.12.7), RcppArmadillo (>= 0.7.500.0.0), methods | ||
LinkingTo: Rcpp, RcppArmadillo | ||
RoxygenNote: 5.0.1 | ||
Suggests: knitr, rmarkdown | ||
Suggests: knitr, rmarkdown, testthat | ||
VignetteBuilder: knitr |
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,2 @@ | ||
YEAR: 2017 | ||
COPYRIGHT HOLDER: R Chris Gaynor |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#' @title Write data records | ||
#' | ||
#' @description | ||
#' Saves a population's phenotypic and marker data to a directory. | ||
#' | ||
#' @param pop an object of \code{\link{Pop-class}} | ||
#' @param dir directory for saving output | ||
#' @param snpChip which SNP chip genotype to save. If useQtl=TRUE, this | ||
#' value will indicate which trait's QTL genotype to save. | ||
#' @param useQtl should QTL genotype be written instead of SNP chip | ||
#' genotypes. | ||
#' @param simParam an object of \code{\link{SimParam-class}} | ||
#' | ||
#' @export | ||
writeRecords = function(pop,dir,snpChip,useQtl=FALSE,simParam=SIMPARAM){ | ||
stopifnot(dir.exists(dir)) | ||
if(useQtl){ | ||
nMarkers = simParam@traits[[snpChip]]@nLoci | ||
markerType = paste0("QTL_",snpChip) | ||
}else{ | ||
nMarkers = simParam@snpChips[[snpChip]]@nLoci | ||
markerType = paste0("SNP_",snpChip) | ||
} | ||
#Check that the marker set isn't being changed | ||
markerInfo = data.frame(markerType=markerType, | ||
nMarkers=nMarkers, | ||
stringsAsFactors=FALSE) | ||
markerInfoPath = file.path(dir,"markerInfo.txt") | ||
if(file.exists(markerInfoPath)){ | ||
tmp = read.table(markerInfoPath,stringsAsFactors=FALSE) | ||
stopifnot(identical(tmp,markerInfo)) | ||
}else{ | ||
write.table(markerInfo,markerInfoPath) | ||
} | ||
|
||
|
||
} |
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,14 @@ | ||
#' @title Example MapPop | ||
#' | ||
#' @description An object of \code{\link{MapPop-class}} containing | ||
#' two individuals with one chromosome with one Morgan length. Both | ||
#' individuals are fully inbred and have 1001 segregating sites on | ||
#' 1 chromosome. The first individual has all '1' alleles and the | ||
#' second individual has all '0' alleles. | ||
#' | ||
#' @docType data | ||
#' | ||
#' @usage data(PopTwo) | ||
#' | ||
#' @format An object of \code{\link{MapPop-class}} | ||
"PopTwo" |
Binary file not shown.
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
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.
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 +1,2 @@ | ||
CPPFLAGS = -DARMA_64BIT_WORD=1 | ||
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) |
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,2 +1,3 @@ | ||
|
||
CPPFLAGS = -DARMA_64BIT_WORD=1 | ||
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) |
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,4 @@ | ||
library(testthat) | ||
library(AlphaSimR) | ||
|
||
test_check("AlphaSimR") |