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

read_bed fails on existing file with non-.bed extension #2

Closed
richelbilderbeek opened this issue Jun 29, 2021 · 2 comments
Closed

read_bed fails on existing file with non-.bed extension #2

richelbilderbeek opened this issue Jun 29, 2021 · 2 comments

Comments

@richelbilderbeek
Copy link

richelbilderbeek commented Jun 29, 2021

Dear genio maintainers,

genio is great!

There is something unexpected I found that I try to convince is a bit weird :-)

Usually, read_bed works awesome:

bim <- genio::read_bim(file = "demo_assoc.bim")
fam <- genio::read_fam(file = "demo_assoc.fam")
genio::read_bed(
  file = "demo_assoc.bed",
  names_loci = bim$id,
  names_ind = fam$id
)

When I copy the .bed file to a filename with another extension, I do expect read_bed to keep working:

file.copy("demo_assoc.bed", "other.ext")
genio::read_bed(
  file = "other.ext",
  names_loci = bim$id,
  names_ind = fam$id
)

Unexpectedly, it does not work:

Reading: other.ext.bed
Error in genio::read_bed(file = "other.ext", names_loci = bim$id, names_ind = fam$id) :
  File does not exist: other.ext.bed

The error message is clear: genio adds a .bed file extension unnecessarily, resulting in that file path the be absent.

I suggest to allow read_bed to also read files with a non-.bed file extension.

Here are all the input files and script I used:

genio_issue.zip

@alexviiia
Copy link
Member

alexviiia commented Jul 1, 2021

Hi Richel!
I corrected this particular issue in the latest commit. I have an internal test that replicates this scenario and confirms the solution, but of course if you're still having problems let me know.
I'm working on the next issue, may have a solution later today.
-Alex

@richelbilderbeek
Copy link
Author

Hi @alexviiia, thanks so much!

richelbilderbeek pushed a commit to richelbilderbeek/reports that referenced this issue Jul 2, 2021
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

2 participants