Error in `*tmp*`[[xx]] : subscript out of bounds with popgenome package in R
0
0
Entering edit mode
2.7 years ago
ahusnoo • 0

I am presently working with the PopGenome package in R to calculate the haplotype diversity in a large list of exons in immune genes. All went well for around 550 exons. However, the analysis has stopped at one of the exons, giving the following error message:

Error in tmp[[xx]] : subscript out of bounds Calls: diversity.stats -> diversity.stats Execution halted

The code is as follows:

library(PopGenome)

AFR <- readLines("/home/.../AFR.txt")
AMR <- readLines("/home/.../AMR.txt")
EAS <- readLines("/home/.../EAS.txt")
EUR <- readLines("/home/.../EUR.txt")
SAS <- readLines("/home/.../SAS.txt")

GENOME.class <- readVCF("/data/.../ALL.chr19.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz", 10000,"19", 54701102, 54701178, include.unknown=FALSE, approx=FALSE, parallel=FALSE)

GENOME.class.pop <- set.populations(GENOME.class,list(AFR,AMR,EAS,EUR,SAS), diploid=TRUE)
div.stat <- diversity.stats(GENOME.class.pop)

hap.div <- div.stat@hap.diversity.within

outputfile <-write.csv(hap.div, "/home/.../1K_KIR2DL1_1_HaplotypeDiversity.csv", row.names = FALSE)

I am presently working with the PopGenome package in R to calculate the haplotype diversity in a large list of exons in immune genes. All went well for around 550 exons. However, the analysis has stopped at one of the exons, giving the following error message:

Error in tmp[[xx]] : subscript out of bounds Calls: diversity.stats -> diversity.stats Execution halted

The code is as follows:

library(PopGenome)

AFR <- readLines("/home/.../AFR.txt")
AMR <- readLines("/home/.../AMR.txt")
EAS <- readLines("/home/.../EAS.txt")
EUR <- readLines("/home/.../EUR.txt")
SAS <- readLines("/home/.../SAS.txt")

GENOME.class <- readVCF("/data/.../ALL.chr19.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz", 10000,"19", 54701102, 54701178, include.unknown=FALSE, approx=FALSE, parallel=FALSE)

GENOME.class.pop <- set.populations(GENOME.class,list(AFR,AMR,EAS,EUR,SAS), diploid=TRUE)
div.stat <- diversity.stats(GENOME.class.pop)

hap.div <- div.stat@hap.diversity.within

outputfile <-write.csv(hap.div, "/home/.../1K_KIR2DL1_1_HaplotypeDiversity.csv", row.names = FALSE)

I tried to do a google search and figure out what is wrong, but I am unable to find out how to solve the problem.

The code for another exon that worked fine is as follows:

library(PopGenome)

AFR <- readLines("/home/.../AFR.txt")
AMR <- readLines("/home/.../AMR.txt")
EAS <- readLines("/home/.../EAS.txt")
EUR <- readLines("/home/.../EUR.txt")
SAS <- readLines("/home/.../SAS.txt")

GENOME.class <- readVCF("/data/.../ALL.chr19.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz", 10000,"19", 54701102, 54701178, include.unknown=FALSE, approx=FALSE, parallel=FALSE)

GENOME.class.pop <- set.populations(GENOME.class,list(AFR,AMR,EAS,EUR,SAS), diploid=TRUE)

div.stat <- diversity.stats(GENOME.class.pop)

hap.div <- div.stat@hap.diversity.within

outputfile <-write.csv(hap.div, "/home/.../1K_KIR2DL1_1_HaplotypeDiversity.csv", row.names = FALSE)

Any help would be most appreciated. Thank you!!

Subscript popgenome bounds out R • 388 views
ADD COMMENT

Login before adding your answer.

Traffic: 2085 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