Question: Error while reading mlc file from CODEML into ggtree/treeio in R
gravatar for astronautmike02
9 months ago by
astronautmike020 wrote:

I'm trying to read an mlc file (output from CODEML program) using the read.codeml_mlc function from the treeio package in R, as follows:

tree <- read.codeml_mlc(mlc_file)

However, I'm getting the following error:

Error in strsplit(., split = "[[:space:]]") : non character argument

Does anyone have an idea of what could be wrong? This is an ordinary mlc output from PAML from a free ratio branch model, I have not modified or altered it. However, the error seems to be related to my file, because I have tried running the example from the tutorial (reading the mlc file provided with the package) and it works fine.

Put it some other way: Where does the strsplit function come about when reading the mlc file and what part exactly of the file is it referring to? Maybe knowing that will help solve my problem.

Thanks in advance for any help that could be provided!!

ADD COMMENTlink modified 9 months ago by zx87549.9k • written 9 months ago by astronautmike020
gravatar for Fatima
9 months ago by
United states
Fatima890 wrote:

It might be the strsplit at the end of this script:

nodeNum <- strsplit(paml[edge.idx], split="\\.\\.") %>%
        unlist %>% strsplit(split="[[:space:]]") %>% unlist

Is this the sample file that you used?

You can compare your edge indexes, branch and node Numbers with your file to see if they are valid.

ADD COMMENTlink modified 9 months ago • written 9 months ago by Fatima890

Hello Fatima! You're right, there is a problem with my mlc output file. For some reason, it does not contain the elements that indicate the branch and node numbers, so I guess the solution is fixing that from PAML and then trying treeio again! Thanks so much!!

ADD REPLYlink written 9 months ago by astronautmike020


I have run into the same issue trying to read example input mlc file from the source you provided. I simply took the example mlc file from the source and saved it as "example.mlc". Here is my command mlcfile <- system.file("Users/Documents/ACE_PAML_analysis/", "example.mlc", package="treeio"). The command returns a n empty data file shown as " " in my R environment. Am I using the the example command correctly? Any guidance is greatly appreciated. Thank you.

ADD REPLYlink modified 5 days ago • written 5 days ago by nataliagru160
Please log in to add an answer.


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