-
Notifications
You must be signed in to change notification settings - Fork 14
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 import vcf to hierfstat #74
Comments
Dear Didier, could you check the structure of your Also the results of Cheers |
Hi Jérôme So here are the results of the structure of the data (just the beginning in each case): str(data) Classes ‘loci’ and 'data.frame': 67 obs. of 10000 variables: str(data_hierfstat) 'data.frame': 67 obs. of 10001 variables: I tried with gaston as follows: data2 <- read.VCF("RAD_spec_denovo_SNPfiltr.vcf", convert.chr = FALSE) I got this file, but how can I use it with hierfstat now? str(data2) Formal class 'bed.matrix' [package "gaston"] with 8 slots Didier |
Thanks Didier. So With Best wishes |
Thanks, it works with the fs.dosage function after import with gaston. Erreur dans Class@package : Thanks! |
Could you send a toy example dataset reproducing the error please? perhaps something like Cheers |
yes, here is a subsampled dataset, which still gets the error "" "pop" "loc5_pos1" "loc6_pos80" "loc7_pos69" "loc8_pos8" "loc10_pos5" "loc12_pos0" "loc14_pos122" "loc15_pos13" "loc16_pos62" "loc18_pos31" "loc21_pos6" "loc23_pos62" "loc25_pos14" "loc27_pos27" "loc28_pos21" "loc34_pos9" "loc35_pos96" "loc36_pos41" "loc38_pos2" "loc43_pos37" "loc44_pos51" "loc45_pos16" "loc46_pos7" "loc50_pos30" "loc53_pos31" "loc55_pos61" "loc57_pos12" "loc62_pos7" "loc65_pos1" "loc67_pos8" |
aurelle_toy.txt > dat<-read.table("aurelle_toy.txt",header=TRUE)
> str(dat)
'data.frame': 67 obs. of 31 variables:
$ pop : chr "hybrid" "hybrid" "hybrid" "hybrid" ...
$ loc5_pos1 : int 22 22 22 22 NA 22 22 22 22 22 ...
$ loc6_pos80 : int 11 13 11 13 11 11 11 11 11 11 ...
$ loc7_pos69 : int 22 24 24 NA 24 24 22 22 24 22 ...
$ loc8_pos8 : int 34 33 34 33 33 34 34 33 33 33 ...
$ loc10_pos5 : int 22 NA 24 44 44 44 22 24 44 44 ...
$ loc12_pos0 : int 33 33 NA 33 33 33 33 33 NA 33 ...
$ loc14_pos122: int 22 11 11 11 11 11 11 21 22 11 ...
$ loc15_pos13 : int 44 NA 44 NA 44 NA 44 44 44 44 ...
$ loc16_pos62 : int 44 NA 44 NA 44 44 44 44 44 44 ...
$ loc18_pos31 : int 33 NA 33 33 33 33 33 33 33 33 ...
$ loc21_pos6 : int 44 44 44 44 44 44 44 44 44 44 ...
$ loc23_pos62 : int 33 NA 31 NA 31 11 11 31 NA NA ...
$ loc25_pos14 : int 44 42 44 44 42 42 44 NA 44 44 ...
$ loc27_pos27 : int 44 NA 44 44 44 44 44 44 44 44 ...
$ loc28_pos21 : int 33 33 33 NA 33 33 33 33 33 33 ...
$ loc34_pos9 : int 11 NA 11 11 11 11 11 13 11 NA ...
$ loc35_pos96 : int 44 44 42 44 44 42 44 44 42 44 ...
$ loc36_pos41 : int 44 NA 44 44 22 NA 44 44 44 44 ...
$ loc38_pos2 : int 33 NA 33 33 33 33 33 33 33 33 ...
$ loc43_pos37 : int 33 33 33 33 33 33 33 33 33 33 ...
$ loc44_pos51 : int 42 44 44 44 44 44 44 44 44 44 ...
$ loc45_pos16 : int 33 NA 33 33 33 33 33 33 33 33 ...
$ loc46_pos7 : int 22 22 22 22 22 22 22 22 22 22 ...
$ loc50_pos30 : int 22 NA 23 22 22 22 23 33 23 22 ...
$ loc53_pos31 : int 11 NA NA NA 11 11 11 11 11 NA ...
$ loc55_pos61 : int 33 NA 33 33 33 NA 33 33 33 33 ...
$ loc57_pos12 : int 22 NA 22 22 22 22 22 NA 22 NA ...
$ loc62_pos7 : int 22 22 22 NA 22 22 22 22 22 22 ...
$ loc65_pos1 : int 44 44 44 44 44 44 44 44 44 44 ...
$ loc67_pos8 : int 22 22 22 22 22 22 22 22 21 22 ...
> bs<-basic.stats(dat)
> bs
$perloc
Ho Hs Ht Dst Htp Dstp Fst
loc5_pos1 0.0000 0.1336 0.2477 0.1141 0.2857 0.1521 0.4606
loc6_pos80 0.1079 0.1489 0.1602 0.0113 0.1639 0.0151 0.0705
loc7_pos69 0.3428 0.4489 0.5060 0.0571 0.5250 0.0761 0.1128
loc8_pos8 0.1695 0.1400 0.1562 0.0162 0.1616 0.0216 0.1035
loc10_pos5 0.2097 0.2991 0.4933 0.1942 0.5581 0.2589 0.3936
loc12_pos0 0.0341 0.0332 0.0339 0.0007 0.0341 0.0009 0.0194
loc14_pos122 0.0250 0.1582 0.1701 0.0118 0.1740 0.0158 0.0696
loc15_pos13 0.0000 0.0000 0.3750 0.3750 0.5000 0.5000 1.0000
loc16_pos62 0.1429 0.1048 0.1333 0.0285 0.1429 0.0380 0.2140
loc18_pos31 0.0357 0.0346 0.0354 0.0008 0.0357 0.0011 0.0231
loc21_pos6 0.1071 0.1310 0.2202 0.0893 0.2500 0.1190 0.4052
loc23_pos62 0.1963 0.2310 0.4592 0.2282 0.5353 0.3043 0.4970
loc25_pos14 0.1989 0.1951 0.2043 0.0093 0.2074 0.0123 0.0453
loc27_pos27 0.0714 0.0635 0.0694 0.0060 0.0714 0.0080 0.0860
loc28_pos21 0.0455 0.0453 0.3972 0.3519 0.5145 0.4691 0.8859
loc34_pos9 0.0909 0.1083 0.1085 0.0003 0.1086 0.0004 0.0026
loc35_pos96 0.1786 0.1785 0.2024 0.0239 0.2103 0.0318 0.1180
loc36_pos41 0.1314 0.2128 0.2364 0.0235 0.2442 0.0314 0.0996
loc38_pos2 0.0417 0.0398 0.0412 0.0014 0.0417 0.0019 0.0337
loc43_pos37 0.0526 0.0526 0.0517 -0.0009 0.0514 -0.0012 -0.0173
loc44_pos51 0.0817 0.0952 0.0976 0.0023 0.0983 0.0031 0.0241
loc45_pos16 0.0395 0.0380 0.0391 0.0011 0.0395 0.0014 0.0278
loc46_pos7 0.2000 0.1221 0.1805 0.0585 0.2000 0.0779 0.3238
loc50_pos30 0.2076 0.2844 0.5030 0.2186 0.5758 0.2914 0.4345
loc53_pos31 0.0732 0.0898 0.0925 0.0027 0.0934 0.0036 0.0295
loc55_pos61 0.0000 0.0000 0.3750 0.3750 0.5000 0.5000 1.0000
loc57_pos12 0.0500 0.0472 0.3493 0.3021 0.4500 0.4028 0.8649
loc62_pos7 0.0000 0.0000 0.3750 0.3750 0.5000 0.5000 1.0000
loc65_pos1 0.1667 0.1137 0.1534 0.0397 0.1667 0.0529 0.2588
loc67_pos8 0.0536 0.0518 0.0526 0.0008 0.0529 0.0011 0.0160
Fstp Fis Dest
loc5_pos1 0.5324 1.0000 0.1756
loc6_pos80 0.0918 0.2751 0.0177
loc7_pos69 0.1449 0.2364 0.1380
loc8_pos8 0.1335 -0.2104 0.0251
loc10_pos5 0.4640 0.2991 0.3695
loc12_pos0 0.0256 -0.0263 0.0009
loc14_pos122 0.0907 0.8420 0.0188
loc15_pos13 1.0000 NaN 0.5000
loc16_pos62 0.2663 -0.3630 0.0425
loc18_pos31 0.0305 -0.0315 0.0011
loc21_pos6 0.4760 0.1821 0.1369
loc23_pos62 0.5685 0.1504 0.3957
loc25_pos14 0.0595 -0.0198 0.0153
loc27_pos27 0.1115 -0.1255 0.0085
loc28_pos21 0.9119 -0.0028 0.4914
loc34_pos9 0.0035 0.1603 0.0004
loc35_pos96 0.1514 -0.0005 0.0388
loc36_pos41 0.1285 0.3825 0.0399
loc38_pos2 0.0445 -0.0466 0.0019
loc43_pos37 -0.0233 0.0004 -0.0013
loc44_pos51 0.0318 0.1422 0.0035
loc45_pos16 0.0367 -0.0381 0.0015
loc46_pos7 0.3897 -0.6386 0.0888
loc50_pos30 0.5061 0.2699 0.4072
loc53_pos31 0.0389 0.1845 0.0040
loc55_pos61 1.0000 NaN 0.5000
loc57_pos12 0.8951 -0.0592 0.4228
loc62_pos7 1.0000 NaN 0.5000
loc65_pos1 0.3177 -0.4656 0.0597
loc67_pos8 0.0212 -0.0344 0.0012
$overall
Ho Hs Ht Dst Htp Dstp Fst Fstp Fis
0.1018 0.1201 0.2173 0.0973 0.2498 0.1297 0.4476 0.5193 0.1520
Dest
0.1474 |
Very strange: I reinstalled the packages, downloaded your file (my toy file!), imported with read.table and it works! |
Perhaps try saving your file as text and reimport it? |
Yes, I tried but it didn't work. Maybe this is link to the OS? I work on Linux |
I don't think the OS matters. Perhaps the first column, containing names (e.g. "EC-X-MFNB") is misinterpreted. try removing it, or removing the "" with |
Hi @didier-aurelle , did you manage to solve the issue? If so, can I close it? Thanks! |
Hi |
an update: some functions work. For example allele.count, allelic.richness, |
Could you send me a toy example (file+commands) in order for me to replicate the error? |
toy_30SNPs.vcf.txt Yes, I attach the vcf file (renamed .txt to allow attachment) and the pop definition file, the script is below library(adegenet) setwd("~/Nextcloud2/Speciation_Eunicella/RAD_speciation_reference/denovo/") popsEunicella <- read.table("poplist_denovo_SNPfiltr.txt", header = TRUE) read vcf filedata <- read.vcf("toy_30SNPs.vcf") bs_stats <- basic.stats(data_hierfstat, diploid = TRUE) |
OK, I think I found the problem, it was in function Many thanks for pointing the issue, if you're happy with the results, you can close it |
Yes, it works now! |
Hi,
I tried to import a vcf file to be analysed with hierfstat as follows:
read population definition file
popsEunicella <- read.csv("poplist_denovo_SNPfiltr.txt", sep = "", header = TRUE)
import vcf file
data <- read.vcf("RAD_spec_denovo_SNPfiltr.vcf")
data_genind <- loci2genind(data)
pop(data_genind) <- popsEunicella$POP
data_hierfstat <- genind2hierfstat(data_genind)
try to compute basic stats
bs_stats <- basic.stats(data_hierfstat, diploid = TRUE)
But when I try to compute some statistics, I get this error:
Erreur dans Class@package :
no applicable method for
@
applied to an object of class "NULL"Is there any mistake in my import?
Thanks
Didier
The text was updated successfully, but these errors were encountered: