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

Error in if (n > 1) { : missing value where TRUE/FALSE needed when perform neutrality.stats #3

Open
xiekunwhy opened this issue Oct 31, 2017 · 4 comments

Comments

@xiekunwhy
Copy link

Hi,
PopGenome is a good software for population diversity analysis.
When I performed neutrality.stats sliding windows, I got following errors.
|===Error in if (n > 1) { : missing value where TRUE/FALSE needed
Calls: popgenome_diversity ... neutrality.stats -> neutrality.stats -> calc_freqstats -> init_coef
Execution halted
I think it was happened because no enough SNP to use in these windows.
I was wonder that if you can skip these windows or gives NAs back instead of stopping the program?

@xiekunwhy
Copy link
Author

Hi,
I modified your R code, and it work through.
calc_freqstats, from 86 line

STATISTICS

####TAJIMA ##########
if(length(data)!=0){
n <- ceiling(data_length[xx]/data_total_length)
}else {
if(is.na(samplesize[xx])){
n <- 1
}else if(samplesize[xx] > 0){
n <- samplesize[xx]
}else {
n <- 1
}
}
coef <- init_coef(n)

@krystal915
Copy link

Hi, @xiekunwhy!

I have encountered the same problem with you. Thank you for posting your solution! But since I am new to R. I wonder where I can modifiy and refresh my package, for I loaded library(PopGenome) directly before I ran performed neutrality.stats sliding windows.

I may be a silly question, but I do need your help.

Best wishes!

@xiekunwhy
Copy link
Author

@krystal915 ,here is the modified source code, extract it and install it using devtools:
devtools::install_local("/local/path/to/PopGenome_2.2.4/PopGenome", force = TRUE)
PopGenome_2.2.4.zip

@krystal915
Copy link

Hi, @xiekunwhy!

It is a wonderful thing to receive your prompt response. I did as you suggested and It works now! Thank you again! ;-)

cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants