Skip to content
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 with vcf2pcadapt command #30

Closed
fkatharina opened this issue Jan 30, 2019 · 8 comments
Closed

error with vcf2pcadapt command #30

fkatharina opened this issue Jan 30, 2019 · 8 comments

Comments

@fkatharina
Copy link

Dear Michael,

I wonder if you could help with an error I encounter using the pcadapt package?
I am following the manual to load vcf data into R, wanting to dentify outlier loci using the pcadapt command.

I first read the data into R using vcfR, as the manual suggests:
data <- read.vcfR("data.vcf")

However, when I then use the following command for conversion, I get an error message:
data_pcadapt <- vcf2pcadapt(data, output = "data.pcadapt", allele.sep = c("/", "|"))
Error in vcfR::read.vcfR(input, verbose = FALSE) : The parameter file is expected to be a character.

I have already browsed the web but cannot understand why it would not recognize the vcf file if I loaded it according to pcadapt-manual-instructions...?

Any advice you can provide would be greatly appreciated.

best regards,
Katharina

@Mary-00
Copy link

Mary-00 commented Jan 30, 2019

Hi,
I also recently use pcadapt (v 4.0.3), the below command works well and reads the vcf file:
vcf2pcadapt(data, output = "data.pcadapt", allele.sep = c("/", "|"))

Best

@fkatharina
Copy link
Author

Hi Mary,
thanks for your reply. This is exactly the same command I am using, but I continuously get this error:
Error in vcfR::read.vcfR(input, verbose = FALSE) :
The parameter file is expected to be a character.

With which command did you load your vcf file into R?

I load it with vcfR and when doing this get a "large vcfR" object. Is this the same for you?

thanks ,
Katharina

@Mary-00
Copy link

Mary-00 commented Jan 30, 2019

I used just this command to load vcf to the package. Please try it without your first command.

Hope it helps

@privefl
Copy link
Member

privefl commented Jan 30, 2019

Note that you should not use vcf2pcadapt.
The correct way to use pcadapt (for any type of data, here vcf) is to use

filename <- read.pcadapt(path_to_vcf, type = "vcf")
x <- pcadapt(filename, K = 20) 

@Mary-00
Copy link

Mary-00 commented Jan 30, 2019

Hi Privefl,
I used that command to convert vcf file to pcadapt format based on the manual. then used
file2 <- read.pcadapt ("file.pcadapt", type="pcadapt") and other steps and get the results without error. however, my results are a bit strange that posted as an issue here.

@mblumuga
Copy link
Member

@Mary-00 and @fkatharina, can you use the solution proposed by @privefl and tell us if it works.

@fkatharina
Copy link
Author

just gave it a try and it works, many thanks to all and particularly to @privefl for the right solution!

@mblumuga
Copy link
Member

Great, glad that it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants