bcm-uga / pcadapt

Performing highly efficient genome scans for local adaptation with R package pcadapt v4
https://bcm-uga.github.io/pcadapt
39 stars 10 forks source link

pcadapt: variant(s) have been discarded as they are not SNPs #78

Closed KatherinOtalora closed 2 years ago

KatherinOtalora commented 2 years ago

Hello everyone

I am trying to run this script https://rstudio-pubs-static.s3.amazonaws.com/680310_344908e815c043ea8ef2bd9de9b1a45d.html that considers PCAdapt and I have had a complication when running the line snps_pvalues <- cbind(snp, data_pcadapt$pvalues I get an error because the values dont match and this is because when reading my vcf in PCAdapt 40 variant(s) have been discarded as they are not SNPs, how can I know which were these discarded variables to continue with the analysis.

Thank you so much.

privefl commented 2 years ago

When do these variants get discarded? In read.vcfR()? Don't you have a way to get the variant names read from that?

Otherwise, please follow the recommended instruction as using PLINK to convert the vcf to a bed file + doing some QC. Information on the variants can then be obtained from the bim file.

Also, this is not recommended to run pcadapt with only 5K variants, please see this issue.

KatherinOtalora commented 2 years ago

Thank you very much for your answer.

  1. I am running the analysis with a total of 143272 variants.

  2. When running the following script:

data <- read.pcadapt("intSample.vcf", type = "vcf"),

the output was:

40 variant(s) have been discarded as they are not SNPs. Summary:

- input file: intSample.vcf
- output file: /var/folders/sx/vgh3tb2j4w5_0m__xt0snqhw0000gn/T//RtmpSxC6BS/file85da6eca5f1b.pcadapt

- number of individuals detected: 100
- number of loci detected: 143272

143232 lines detected. 100 columns detected.

  1. I checked the output in the output folder and I have two files, the file.bed and the other with the 143232 variants (without the 40 variants, already removed) but no names.

  2. I'm going to explore the Plink option to see if I can fix it.

Thanks again.

privefl commented 2 years ago

I'm sorry the vcf reader from pcadapt is kind of deprecated. I'm not familiar with it, so I can't really help you with it. I would just recommend converting to bed/bim/fam files using PLINK.

privefl commented 2 years ago

Any update on this?

KatherinOtalora commented 2 years ago

Yes, I used PLINK, and it fixed it.

Thank you so much