Commit f47b81fb authored by Marie  BOURDON's avatar Marie BOURDON
Browse files

add folder stuart.Rcheck

parent b207d759
Package: stuart
Title: stuaRt
Version: 0.1.0
Authors@R:
person(given = "Marie",
family = "Bourdon",
role = c("aut", "cre"),
email = "mariefbourdon@gmail.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: Sorts markers of miniMUGA genotyping for F2 or N2 individuals, for Rqtl analysis.
License: GPL-3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Imports: dplyr, tidyr, utils, stringr, rapportools
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Depends: R (>= 3.5.0)
NeedsCompilation: no
Packaged: 2021-04-30 13:52:23 UTC; mbourdon
Author: Marie Bourdon [aut, cre] (YOUR-ORCID-ID)
Maintainer: Marie Bourdon <mariefbourdon@gmail.com>
Built: R 4.0.3; ; 2021-04-30 13:53:56 UTC; windows
# Generated by roxygen2: do not edit by hand
export(geno_strains)
export(mark_allele)
export(mark_match)
export(mark_poly)
export(mark_prop)
export(tab_mark)
export(write_rqtl)
import(dplyr)
import(stringr)
import(tidyr)
import(utils)
This diff is collapsed.
Package: stuart
Title: stuaRt
Version: 0.1.0
Authors@R:
person(given = "Marie",
family = "Bourdon",
role = c("aut", "cre"),
email = "mariefbourdon@gmail.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: Sorts markers of miniMUGA genotyping for F2 or N2 individuals, for Rqtl analysis.
License: GPL-3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Imports: dplyr, tidyr, utils, stringr, rapportools
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Depends: R (>= 3.5.0)
NeedsCompilation: no
Packaged: 2021-04-30 13:52:23 UTC; mbourdon
Author: Marie Bourdon [aut, cre] (YOUR-ORCID-ID)
Maintainer: Marie Bourdon <mariefbourdon@gmail.com>
# Generated by roxygen2: do not edit by hand
export(geno_strains)
export(mark_allele)
export(mark_match)
export(mark_poly)
export(mark_prop)
export(tab_mark)
export(write_rqtl)
import(dplyr)
import(stringr)
import(tidyr)
import(utils)
#' Data frame with gigaMUGA markers annotation
#'
#' A dataset containing gigaMUGA markers positions and other information from by Karl Broman (https://kbroman.org/MUGAarrays/new_annotations.html).
#'
#' @format A data frame with 143259 rows and 8 variables
#' \describe{
#' \item{marker}{name of the marker}
#' \item{chr}{chromosome}
#' \item{bp_mm10}{localisation on chromosome in bp (mm10 assembly)}
#' \item{cM_cox}{localisation on chromosome in cM (from Cox et al.)}
#' \item{cM_g2f1}{localisation on chromosome in cM (from Liu et al.)}
#' \item{snp}{marker alleles}
#' \item{unique}{indicates if the marker maps uniquely on mm10}
#' \item{unmapped}{indicates if the marker does not map perfectly on mm10}
#' }
"annot_giga"
#' Data frame with megaMUGA markers annotation
#'
#' A dataset containing megaMUGA markers positions and other information from by Karl Broman (https://kbroman.org/MUGAarrays/new_annotations.html).
#'
#' @format A data frame with 77808 rows and 8 variables
#' \describe{
#' \item{marker}{name of the marker}
#' \item{chr}{chromosome}
#' \item{bp_mm10}{localisation on chromosome in bp (mm10 assembly)}
#' \item{cM_cox}{localisation on chromosome in cM (from Cox et al.)}
#' \item{cM_g2f1}{localisation on chromosome in cM (from Liu et al.)}
#' \item{snp}{marker alleles}
#' \item{unique}{indicates if the marker maps uniquely on mm10}
#' \item{unmapped}{indicates if the marker does not map perfectly on mm10}
#' }
"annot_mega"
#' Data frame with miniMUGA markers annotation
#'
#' A dataset containing miniMUGA markers positions and other information from by Karl Broman (https://kbroman.org/MUGAarrays/mini_revisited.html).
#'
#' @format A data frame with 11125 rows and 8 variables
#' \describe{
#' \item{marker}{name of the marker}
#' \item{chr}{chromosome}
#' \item{bp_mm10}{localisation on chromosome in bp (mm10 assembly)}
#' \item{cM_cox}{localisation on chromosome in cM (from Cox et al.)}
#' \item{cM_g2f1}{localisation on chromosome in cM (from Liu et al.)}
#' \item{snp}{marker alleles}
#' \item{unique}{indicates if the marker maps uniquely on mm10}
#' \item{unmapped}{indicates if the marker does not map perfectly on mm10}
#' }
"annot_mini"
#' Data frame with MUGA markers annotation
#'
#' A dataset containing MUGA markers positions and other information from by Karl Broman (https://kbroman.org/MUGAarrays/muga_annotations.html).
#'
#' @format A data frame with 7854 rows and 8 variables
#' \describe{
#' \item{marker}{name of the marker}
#' \item{chr}{chromosome}
#' \item{bp_mm10}{localisation on chromosome in bp (mm10 assembly)}
#' \item{cM_cox}{localisation on chromosome in cM (from Cox et al.)}
#' \item{cM_g2f1}{localisation on chromosome in cM (from Liu et al.)}
#' \item{snp}{marker alleles}
#' \item{unique}{indicates if the marker maps uniquely on mm10}
#' \item{unmapped}{indicates if the marker does not map perfectly on mm10}
#' }
"annot_muga"
#' @title Create haplotype for a new mouse strain into a reference dataframe
#'
#' @description This functions adds columns for parental strains used in the cross in the annotation data frame, from the genotype data frame in which one or several animal of the parental strains were genotyped.
#' If several animals of one strain were genotyped, a consensus is created from these animals.
#' The consensus is created as follow : if the indivuals carry the same allele, this allele is kept, otherwise, the allele is noted as "N". If individuals show residual heterozygosity, it is encoded as "H".
#' @param ref data frame with the reference genotypes of mouse lines
#' @param geno data frame with the genotyping results for your cross from miniMUGA array
#' @param par1 first parental strain used in the cross, the name must be written as in the geno data frame
#' @param par2 second parental strain used in the cross, the name must be written as in the geno data frame
#' @param name1 name of the first parental strain to use as the column name in the ref data frame
#' @param name2 name of the second parental strain to use as the column name in the ref data frame
#'
#' @import dplyr
#' @import tidyr
#'
#' @export
#'
geno_strains <- function(ref,geno,par1,par2,name1,name2){
#recode genotypes from 2 alleles to 1
geno <- geno %>% mutate_all(as.character)
geno <- geno %>% filter(Sample.ID %in% c(par1,par2))
geno <- geno %>% mutate(Geno=case_when(Allele1...Forward == "-" | Allele2...Forward == "-" ~ "N",
Allele1...Forward == Allele2...Forward ~ Allele1...Forward,
Allele1...Forward %in% c("A","T","G","C") & Allele2...Forward %in% c("A","T","G","C") ~ "H"))
geno <- geno %>% select(SNP.Name,Sample.ID,Geno) %>% pivot_wider(names_from = Sample.ID, values_from = Geno)
#create consensus
if(length(par1)!=1){
geno <- geno %>% mutate(parent1 = ifelse(!!sym(par1[1])==!!sym(par1[2]),!!sym(par1[1]),"N"))
} else {
geno <- geno %>% rename(parent1=!!sym(par1[1]))
}
if(length(par2)!=1){
geno <- geno %>% mutate(parent2 = ifelse(!!sym(par2[1])==!!sym(par2[2]),!!sym(par2[1]),"N"))
} else {
geno <- geno %>% rename(parent2=!!sym(par2[1]))
}
geno <- geno %>% select(SNP.Name,parent1,parent2)
colnames(geno) <- c("SNP.Name",name1,name2)
#merge with ref file
ref <- full_join(ref,geno,by=c("marker"="SNP.Name"))
return(ref)
}
#' Data frame with miniMUGA genotyping of F2 individuals and parental strains
#'
#' A dataset containing the genotypes of 176 F2 individuals
#'
#' @format A data frame with 2002493 observations of 11 variables
"genos"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment