Dear All,
I'm new to PopGenome packages and I tried to use it for genetic diversity calculations according to its examples in the manual. However, it produced an error and I don't know how to fix it even after reading the manual. Is there any advice to figure it out or fix it? Thanks. Below is my code and some results:
PopGenome::VCF_split_into_scaffolds("cmVCF_jt_snp_flt2_flt6.vcf","scaffoldVCFs")
allgenomes <- PopGenome::readData("scaffoldVCFs",format="VCF")
get.individuals(allgenomes)[[1]]
pop1 <- c("MSub10")
pop2 <- c("S11")
pop3 <- c("S12")
pop4 <- c("S13")
.....
pop11 <- c("S6")
pop12 <- c("mergeSub")
allgenomes_pop <- PopGenome::set.populations(allgenomes, list(pop1,pop2,pop3,pop4,pop5,pop6,pop7,pop8,pop9,pop10,pop11,pop12))
allgenomes_pop_div <- PopGenome::diversity.stats(allgenomes_pop)
The result of get.individuals(allgenomes)[[1]]:
[1] "MSub10" "S11" "S12" "S13" "S18" "S20"
[7] "S29" "S30" "S32" "S38" "S6" "mergeSub"
The result of allgenomes_pop@populations:
[[1]]
[1] "MSub10"
[[2]] [1] "S11"
[[3]] [1] "S12"
[[4]] [1] "S13"
[[5]] [1] "S18"
[[6]] [1] "S20"
[[7]] [1] "S29"
[[8]] [1] "S30"
[[9]] [1] "S32"
[[10]] [1] "S38"
[[11]] [1] "S6"
[[12]] [1] "mergeSub"
The error produced by PopGenome::diversity.stats(allgenomes_pop):
Error: $ operator is invalid for atomic vectors
I've tried "diversity.stats()" without setting populations, it proceeded without error messages. I've tried "diversity.stats.betwwen()" with setting populations, it proceeded without error messages. And I used PopGenome::, since there are some package mask warnings, when I load the package PopGenome. Below are warnings:
Loading required package: ff Loading required package: bit
Attaching package: ‘bit’
The following object is masked from ‘package:base’:
xor
Attaching package ff - getOption("fftempdir")=="/tmp/RtmpZf0qhS/ff"
getOption("ffextension")=="ff"
getOption("ffdrop")==TRUE
getOption("fffinonexit")==TRUE
getOption("ffpagesize")==65536
getOption("ffcaching")=="mmnoflush" -- consider "ffeachflush" if your system stalls on large writes
getOption("ffbatchbytes")==16777216 -- consider a different value for tuning your system
getOption("ffmaxbytes")==536870912 -- consider a different value for tuning your system
Attaching package: ‘ff’
The following objects are masked from ‘package:utils’:
write.csv, write.csv2
The following objects are masked from ‘package:base’:
is.factor, is.ordered
In addition, when I tried to set populations in R from bash, the cursor just stuck at the 100 % position and didn't return. And I can only type return by myself. Below is the result: allgenomes_pop <- PopGenome::set.populations(allgenomes,list(pop1, pop2, pop3, pop4, pop5, pop6, pop7, pop8, pop9, pop10, pop11, pop12))
| : | : | 100 %
|====================================================>cursor
However, the cursor didn't got stuck when I tried it on R software in my computer.