lvclark / polyRAD

Genotype Calling with Uncertainty from Sequencing Data in Polyploids 🍌🍓🥔🍠🥝
24 stars 8 forks source link

RADdata2VCF with asSNPs=TRUE gives error #11

Closed tkchafin closed 3 years ago

tkchafin commented 3 years ago

Trying to export VCF file after running genotyping and filtering on my data. No reference was provided when using VCF2RADdata to import the original data. Here's my function call to export the data:

RADdata2VCF(mydata_75, file = "polyrad_out_75.vcf", asSNPs=TRUE, hindhe=TRUE)

Here's the error I get:

  Complete haplotype information not provided; unable to determine SNP positions.  Use refgenome argument in VCF2RADdata.

I can successfully run the function and output the VCF if I wrap the code giving the error [e.g. if(is.null(varok) || varok)] with a "if (asSNPs==FALSE){}" check.

Not sure if this is the desired behavior or if it is an error on my part?

Thanks,

Tyler

lvclark commented 3 years ago

Hi Tyler,

If you use phaseSNPs = TRUE with VCF2RADdata and don't provide a reference genome, it concatenates SNPs together that appear to originate from the same tag, and the SNP positions are lost in the process. Hence, polyRAD won't let you export back to VCF. If you do provide a reference genome, then the reference sequence is inserted between SNPs so that their positions can be recovered.

Just now I also fixed a bug so that if phaseSNPs = FALSE you'd be able to export back to VCF regardless of whether a reference genome was provided.

I hope that helps! Let me know if you need any further clarification.

Lindsay