Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genoprob_to_alleleprob return NULL in riself4 #183

Closed
kbroman opened this issue Nov 25, 2020 · 1 comment
Closed

genoprob_to_alleleprob return NULL in riself4 #183

kbroman opened this issue Nov 25, 2020 · 1 comment
Labels

Comments

@kbroman
Copy link
Member

kbroman commented Nov 25, 2020

It was reported at the R/qtl2 discussion group that genoprob_to_alleleprob() returned an empty list for cross type "riself4".

@kbroman kbroman added the bug label Nov 25, 2020
@kbroman
Copy link
Member Author

kbroman commented Nov 30, 2020

It seems to work fine. Here's an example:

# load CC data
library(qtl2)
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/master/CC/cc.zip")
cc <- read_cross2(file)

# subset to chr 17-19
cc <- cc[,17:19]

# convert to 4-way RIL by selfing, by subsetting the founders
cc$crosstype <- "riself4"
for(i in seq_along(cc$founder_geno)) cc$founder_geno[[i]] <- cc$founder_geno[[i]][1:4,]
cc$alleles <- cc$alleles[1:4]
cc$cross_info <- t(apply(cc$cross_info, 1, function(a) a[a <= 4]))

# calculate genotype probabilities and allele probabilities
pr <- calc_genoprob(cc, cores=0)
apr <- genoprob_to_alleleprob(pr, cores=0)     

# check that there the same except for an attribute + column names
attr(apr, "alleleprobs") <- FALSE
for(i in seq_along(apr)) colnames(apr[[i]]) <- colnames(pr[[i]])
testthat::expect_equal(apr, pr)

@kbroman kbroman closed this as completed Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant