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_seqs() function not working for me #171

Closed
Rikkiff opened this issue Dec 9, 2023 · 9 comments
Closed

read_seqs() function not working for me #171

Rikkiff opened this issue Dec 9, 2023 · 9 comments

Comments

@Rikkiff
Copy link

Rikkiff commented Dec 9, 2023

I have attempted to create a seq track using the function read_seqs() with either my .fna or .gff3 file as argument. But in any case get an empty tibble as object. Meanwhile, using read_gff3() function with my .gff3 file works just fine.

@iimog
Copy link
Collaborator

iimog commented Dec 14, 2023

This is strange. Can you confirm that this returns a tibble with 6 rows:

read_seqs(ex("emales/emales.fna"))

If so, can you share your fasta file so I can have a look what's going wrong?

@dmckeow
Copy link

dmckeow commented Dec 14, 2023

I am having the same issue using the emales example data. The resulting tibble has no information in it:
Reading in gff information works though

read_seqs(ex("emales/emales.fna"))

Reading'fasta' withread_seq_len():

* file_id: emales [C:/Users/Dean Mckeown/AppData/Local/R/win-library/4.2/gggenomes/extdata/emales/emales.fna]
# A tibble: 0 × 4
# ℹ 4 variables: file_id , seq_id , seq_desc , length

@Rikkiff
Copy link
Author

Rikkiff commented Dec 15, 2023 via email

@iimog
Copy link
Collaborator

iimog commented Dec 15, 2023

Thank you for checking. I can reproduce the problem on my Windows machine. On Linux it works as expected. My first guess, line endings, does not seem to cause the issue. I'll dig into it.

@iimog
Copy link
Collaborator

iimog commented Dec 15, 2023

Sequences from fasta are internally processed by gggenomes via the perl script exec/seq-len. The problem is, that perl is not available on Windows by default. I'm not sure whether it would work if perl were available. The way it is invoked might not work on Windows at all. So the problem is not related to any specific fasta file. I don't see an easy fix to make the perl script working across platforms. It is probably easier to implement this functionality in R or using an R dependency (e.g. seqinr). What is your opinion @thackl ?

@dmckeow
Copy link

dmckeow commented Dec 15, 2023

I think that I found a way around it.
Instead of read_fasta, I used read_fai on the .fai index of the fasta file, and I get the required tibble, and I could generate the visualisation. One column is missing, the "file_id", but that could be easily added.
I had to use the fasta index that I manually downloaded, as it seems to not be available via ex():

read_fai("C:/Users/Dean Mckeown/Downloads/emales/emales/emales.fna.seqkit.fai")

# A tibble: 33 × 3
seq_id seq_desc length

1 BVI_023A emale_type=EMALE05 is_typespecies=FALSE 19600
2 Cflag_131 emale_type=EMALE03 is_typespecies=FALSE 32544
3 RCC970_025 emale_type=EMALE05 is_typespecies=FALSE 20006
4 RCC970_122 emale_type=EMALE04 is_typespecies=FALSE 5473
5 BVI_055A emale_type=EMALE02 is_typespecies=FALSE 23989
6 BVI_055B emale_type=EMALE04 is_typespecies=TRUE 19849
7 Cflag_215 emale_type=EMALE04 is_typespecies=FALSE 12202
8 RCC970_016A emale_type=EMALE03 is_typespecies=TRUE 19438
9 RCC970_016B emale_type=EMALE01 is_typespecies=FALSE 20152
10 E4-10_053 emale_type=EMALE05 is_typespecies=FALSE 19840
# ℹ 23 more rows
# ℹ Use print(n = ...) to see more rows

@Rikkiff
Copy link
Author

Rikkiff commented Dec 15, 2023

I think that I found a way around it. Instead of read_fasta, I used read_fai on the .fai index of the fasta file, and I get the required tibble, and I could generate the visualisation. One column is missing, the "file_id", but that could be easily added. I had to use the fasta index that I manually downloaded, as it seems to not be available via ex():

read_fai("C:/Users/Dean Mckeown/Downloads/emales/emales/emales.fna.seqkit.fai")

A tibble: 33 × 3 seq_id seq_desc length 1 BVI_023A emale_type=EMALE05 is_typespecies=FALSE 19600 2 Cflag_131 emale_type=EMALE03 is_typespecies=FALSE 32544 3 RCC970_025 emale_type=EMALE05 is_typespecies=FALSE 20006 4 RCC970_122 emale_type=EMALE04 is_typespecies=FALSE 5473 5 BVI_055A emale_type=EMALE02 is_typespecies=FALSE 23989 6 BVI_055B emale_type=EMALE04 is_typespecies=TRUE 19849 7 Cflag_215 emale_type=EMALE04 is_typespecies=FALSE 12202 8 RCC970_016A emale_type=EMALE03 is_typespecies=TRUE 19438 9 RCC970_016B emale_type=EMALE01 is_typespecies=FALSE 20152 10 E4-10_053 emale_type=EMALE05 is_typespecies=FALSE 19840 # ℹ 23 more rows # ℹ Use print(n = ...) to see more rows

See my earlier post for the same solution :)

@iimog
Copy link
Collaborator

iimog commented Dec 18, 2023

Thank you, @Rikkiff and @dmckeow, for documenting your workarounds. I still hope to fix the read_seqs function on Windows or at least issue a warning rather than just returning an empty tibble.

@iimog
Copy link
Collaborator

iimog commented Jul 4, 2024

read_seqs is implemented in R in the latest release (that is also available on CRAN 🎉). So this should no longer be an issue.

@iimog iimog closed this as completed Jul 4, 2024
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

3 participants