R package PopGenome : error with introgression.stats function
0
0
Entering edit mode
23 months ago

Hi everyone,

I'm currently facing a problem while using the R package PopGenome. I'm trying to perform patterson D and df analyses on non overlapping sliding windows but I face an error regarding the outgroup needed to perform such analyses. I checked on the internet but didn't find an answer to my problem. Here is my code :

A <- c("Caz-A", "NILSC1", "NILSC11", "NILSC13", "NILSC16")
B <- c("Ale-A", "Ber-A", "Ber-B", "Ber-C", "Ber-D", "Ber-F", "Bid-A", "Bie-B", "Bie-C", "Bot-X", "Bul-A", "Bul-B", "Bul-C", "CA")
C <- c("NILSC12", "NILSC14", "NILSC17", "NILSC18", "NILSC20")
D <- "Marpal"

chr1 <- readData("VCF_chr1", format = "VCF", outgroup = D, populations = list(A,B,C))
chr1 <- introgression.stats(chr1, do.D = T, do.df = F, block.size = 500)

chr1_slide <- sliding.window.transform(chr1, width = 50000, jump = 50000, type = 2, start.pos = 1, end.pos = 30584173)
chr1_slide <- set.populations(chr1_slide, list(A,B,C))
chr1_slide <- set.outgroup(chr1_slide, new.outgroup = D)
chr1_slide <- introgression.stats(chr1_slide, do.D = T, do.df = T, do.RNDmin = F, block.size = 50)

It's actually working for the whole chromosome (chr1), but when I'm trying to do it on sliding windows (chr1_slide) I get the following error:

Error in calc_D(bial, populations, outgroup, keep.site.info) : 
  This statistic needs an outgroup ! (set.outgroup)

When I check for an outgroup in chr1_slide I get this so I don't understand why the function introgression.stats can't detect the outgroup :

print(chr1_slide@outgroup)
[1] "Marpal"
length(chr1_slide@outgroup)
[1] 1

If anyone have an idea about what is the cause of the error or how can I solve this I would be grateful.

It is my first post here, I hope it's understandable. Have a great day!

PopGenome R • 455 views
ADD COMMENT

Login before adding your answer.

Traffic: 2539 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6