KlausVigo / phangorn

Phylogenetic analysis in R
http://klausvigo.github.io/phangorn/
205 stars 38 forks source link

Error message 'R session aborted' when running modelTest(primates) #157

Open Zhangvvv opened 11 months ago

Zhangvvv commented 11 months ago

H i, I am currently facing an issue while using the modelTest function in R, and I would greatly appreciate your assistance in resolving it. Every time I run the code modelTest(primates) in RStudio, I encounter an error message stating that the R session has aborted. The only option available to me is to start a new session. I have attempted various troubleshooting steps, including reinstalling the package, restarting my computer, and even switching to a different computer, but I consistently receive the same error message. To investigate further, I also tested the code with previously successful data, but I still encountered the same error. The size of my data is within 200 KB and stored in a FASTA file format. 截屏2023-12-15 23 32 20

Here is the code I am using:

library(ape)
library(seqinr)
library(adegenet)
library(phangorn)
bin_name <- fasta2DNAbin(file = "./g1a.fasta")
primates <- as.phyDat(bin_name)
modelTest(primates)

The alignment of my dna data is as follows: 截屏2023-12-16 00 10 33

Information about version:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] phangorn_2.11.1 adegenet_2.1.7  ade4_1.7-19     seqinr_4.2-16   ape_5.7-1      

I would be grateful if you could provide any insights or advice on how to resolve this issue. Please let me know if there is any additional information or steps I can provide to assist in troubleshooting.

Thank you very much for your time and support. I look forward to your response.

KlausVigo commented 11 months ago

Dear @Zhangvvv,

What version of phangorn are you using? First, you can shorten your code a bit

library(phangorn)
g1a <- read.phyDat(file = "./g1a.fasta", fomat="fasta)

From the image it looks like your sequences are not very well aligned, but that is hard to judge from this image alone. What kind of sequences are you using? And is it possible to send or share the sequences with me? Can you run

dm <- dist.hamming(ga1)
max(dm)

If max(dm) is close to 0.75 or larger edge length will be large (or infinity) and this could be the reason for the error.

The alignment of my dna data is as follows: 截屏2023-12-16 00 10 33

Information about version:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] phangorn_2.11.1 adegenet_2.1.7  ade4_1.7-19     seqinr_4.2-16   ape_5.7-1      

I would be grateful if you could provide any insights or advice on how to resolve this issue. Please let me know if there is any additional information or steps I can provide to assist in troubleshooting.

Thank you very much for your time and support. I look forward to your response.

Zhangvvv commented 11 months ago

Dear@KlausVigo Thank you very much for taking the time to help me with my issue amid your busy schedule.

My phangorn version is: phangorn_2.11.1

I've just executed the code you provided, and my results are as follows:

g1a <- read.phyDat(file = "./g1a.fasta", format="fasta")
dm <- dist.hamming(g1a)
max(dm)
[1] 0.658671

Previously, I was able to run this code perfectly, but now I'm unsure why it's suddenly not working as expected. To help you better understand the issue, I've uploaded my raw data, the code for data processing, and the processed data to a GitHub repository. The link is provided below:

https://github.com/Zhangvvv/error-about-modelTest

I'm looking forward to your response and further guidance. Once again, thank you for your assistance!