cant import VCF into OneMap, read.vcfR works but onemap_read_vcfR doesn't
1
1
Entering edit mode
2 days ago
dimeresia ▴ 10

I am trying to convert a vcf file to a OneMap file so I can use it in BatchMap (a fork of onemap). Everytime I use the onemap_read_vcfR function I get the following:

Source repository for OneMap (version 3.0.0), and BatchMap (version 1.0.3.0)

My command:

vcf_tfmpop <- onemap_read_vcfR(vcf = system.file("/project/argus/R_analyses/datasets/tfmappopminDP2.vcf.gz", package = "onemap"),
                           parent1 = "verdant", 
                           parent2 = "oklahoma", 
                           cross = "outcross")

Console output:

    > vcf_tfmpop <- onemap_read_vcfR(vcf = system.file("/project/argus/R_analyses/datasets/tfmappopminDP2.vcf.gz", package = "onemap"),
+                                     parent1 = "verdant", 
+                                     parent2 = "oklahoma", 
+                                     cross = "outcross")
1:

I thought I may have an issue with my vcf file so I checked to see if vcfr could import it into R, which it could.

Command:

tfmappopVCF <- read.vcfR("/project/argus/R_analyses/datasets/tfmappopminDP2.vcf.gz")

Console output:

Scanning file to determine attributes.
File attributes:
  meta lines: 114
  header_line: 115
  variant count: 1315014
  column count: 282
Meta line 114 read in.
All meta lines processed.
gt matrix initialized.
Character matrix gt created.
  Character matrix gt rows: 1315014
  Character matrix gt cols: 282
  skip: 0
  nrows: 1315014
  row_num: 0
Processed variant: 1315014
All variants processed

Anybody have any solutions?

Edit: Removed images and added everything as code instead.

R onemap vcf vcfR • 300 views
ADD COMMENT
1
Entering edit mode

Hi, First, please don't post images of your console, post copy-pasted text and format as code instead.

Second, please provide the exact source repository and revision/tag of the package you have been using. If you are using a fork of some other repo, this fork may be at fault. I don't know these packages. However the 1: in the last line betrays that the function is attempting to read from the standard input, like scan() or read.table(file=stdin()), would thereby possibly ignoring the vcf parameter. I propose to inspect the source code of that function (type onemap_read_vcfR in the R console), it may have been altered in that fork. If so, post an issue in the issue tracker of that fork or contact the maintainer. Or use a stable version/tag that is working.

As a side note, people always fork and experiment with other repos. To expect that the main branch of any repo is working properly at any given moment is very optimistic.

ADD REPLY
0
Entering edit mode

Thanks for the reply and feedback. I am pretty new to the scene so I don't always know the community norms. I edited the original post so Its formatted correctly, and added the source repositories. I couldn't figure out how to format the console output without making it look odd when I first posted.

I am not using the BatchMap fork at the moment. My plan was to use the OneMap package to convert the VCF to a OneMap file before using it in the BatchMap fork. And I get the following error when I try to do so:

Error in read.vcfR(vcf, verbose = F) : 
  File:  does not appear to be a VCF file.
  First line of file:

  Should begin with:
##fileformat=VCFv

Which is odd because it definately is a vcf file according vcfR

> head(tfmappopVCF)
[1] "***** Object of class 'vcfR' *****"
[1] "***** Meta section *****"
[1] "##fileformat=VCFv4.2"
[1] "##FILTER=<ID=PASS,Description=\"All filters passed\">"
[1] "##reference=file://./reference_genome/triticum_pv1.0.fasta"
   <<the rest of the header info follows>>

I reported the issue yesterday to the creator of the OneMap package.

ADD REPLY
0
Entering edit mode

OneMap used the vcfR package internally. Try the following: quit your R session and start R with --vanilla then update to the latest version of the vcfR package and try the following:

my.vcfR.obj <- read.vcfR(vcf, verbose = F)

With vcf the path to your vcf file.

If that works, it should also work with the OneMap package, otherwise that would be odd because this is the exact code OneMap is using. Run the pipeline in a vanilla R session (R—-vanilla); don't use R-studio or the Docker environment (you can try that if this approach fails). I suspect a version mashup.

If that still does not work, please provide the output of sessionInfo and the VCF header of your file.

ADD REPLY
1
Entering edit mode
1 day ago
Michael 55k

Also, I just saw a problem with your code, and this will very likely fix your problem.

This should be:

vcf_tfmpop <- onemap_read_vcfR(vcf = "/project/argus/R_analyses/datasets/tfmappopminDP2.vcf.gz",
                       parent1 = "verdant", 
                       parent2 = "oklahoma", 
                       cross = "outcross")

You should not use system.file, I think you got this from the example code in the documentation. But system.file is only for loading files that come with the R packages as examples.

ADD COMMENT

Login before adding your answer.

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