Can I create a GmapGenome with a relative file path?
1
0
Entering edit mode
Kyle Johnsen ▴ 20
@kyle-johnsen-11443
Last seen 5.1 years ago
United States/Brigham Young University

I'm developing a package which uses a GmapGenome in calling variants, and therefore am trying to create a small GmapGenome (out of a fasta file for just one chromosome) in my unit tests. The problem I run into, however, is that GmapGenome seems not to work for relative file paths.

I confirmed this for myself in the console by inputting a relative path as a fasta file: 

faf <- FastaFile("./tests/testthat/test_data/ref_genome_fastas/chr5.fa")
GmapGenome(faf, name = "dan_rerio_chr5_test", create=TRUE)

Which yielded this error:

Can't open file ./tests/testthat/test_data/ref_genome_fastas/chr5.fa at /home/kylej13/R/x86_64-pc-linux-gnu-library/3.3/gmapR/usr/bin//fa_coords line 193.
Opening file ./tests/testthat/test_data/ref_genome_fastas/chr5.fa
/home/kylej13/R/x86_64-pc-linux-gnu-library/3.3/gmapR/usr/bin//fa_coords   -o ./dan_rerio_chr5_test.coords "./tests/testthat/test_data/ref_genome_fastas/chr5.fa" failed with return code 512 at /home/kylej13/R/x86_64-pc-linux-gnu-library/3.3/gmapR/usr/bin/gmap_build line 179.
Error in .gmap_build(db = genome(genome), dir = path(directory(genome)),  : 
  system call returned a non-0 status: /home/kylej13/R/x86_64-pc-linux-gnu-library/3.3/gmapR/usr/bin/gmap_build --db=dan_rerio_chr5_test --dir=/home/kylej13/.local/share/gmap --kmer=15 --sort=none -B /home/kylej13/R/x86_64-pc-linux-gnu-library/3.3/gmapR/usr/bin/ ./tests/testthat/test_data/ref_genome_fastas/chr5.fa

But when I used an absolute path

faf <- FastaFile("~/MMAPPR2/tests/testthat/test_data/ref_genome_fastas/chr5.fa"

it worked fine.

 

I think I can work around this by using normalizePath() or something to get the absolute path, but it would be nice to fix this or to know if there's a reason GmapGenome doesn't take relative paths.

gmapgenome gmapr fastafile • 1.4k views
ADD COMMENT
0
Entering edit mode

Does file.exists() return true for that path? Just making sure that e.g. the working directory is right.

ADD REPLY
0
Entering edit mode

Yes it does

ADD REPLY
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.3 years ago
United States

Ok, I've fixed it in 1.19.1.

ADD COMMENT
0
Entering edit mode

Great, thank you!

ADD REPLY

Login before adding your answer.

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