Search
Question: Can I create a GmapGenome with a relative file path?
0
gravatar for Kyle Johnsen
11 months ago by
United States
Kyle Johnsen0 wrote:

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.

ADD COMMENTlink modified 11 months ago by Michael Lawrence10.0k • written 11 months ago by Kyle Johnsen0

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

ADD REPLYlink written 11 months ago by Michael Lawrence10.0k

Yes it does

ADD REPLYlink written 11 months ago by Kyle Johnsen0
0
gravatar for Michael Lawrence
11 months ago by
Michael Lawrence10.0k
United States
Michael Lawrence10.0k wrote:

Ok, I've fixed it in 1.19.1.

ADD COMMENTlink written 11 months ago by Michael Lawrence10.0k

Great, thank you!

ADD REPLYlink modified 11 months ago • written 11 months ago by Kyle Johnsen0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 192 users visited in the last hour