Question: Error with reading fasta file into R - "arguments imply differing number of rows"
gravatar for shagunchhikara
6 months ago by
shagunchhikara10 wrote:

Hi, I'm new to using R studio and I'm using the phangorn package. I'm trying to read in an alignment with a fast file containing protein sequences, but it is showing me an error:

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 279, 305, 343, 331, 285, 253, 315, 302, 301, 311, 633, 644, 662, 563

This is what I tried and I cannot figure out why I'm getting the error.


file = "Loxosceles_reclusa.fasta"

dat = read.phyDat("Loxosceles_reclusa.fasta", format = "fasta", type = "AA")

Could someone please help me find out what the problem here is? Thank you so much!

ADD COMMENTlink written 6 months ago by shagunchhikara10

I get the same error. A quick look at the code doesn't reveal much, read.phyDat() calls read.FASTA.AA()and then that function's definition doesn't give me an immediate cause. I suggest you file an issue in github, where the author seems to keep developing.

ADD REPLYlink written 6 months ago by ddiez1.6k

I have seen this error in R before with other tasks I have done. I would start by making sure your fasta file is properly formatted. Is each amino acid sequence only on one line (not a multiline fasta)? Are there no blank lines in the fasta file? Is the line ending character compatible; Windows line ending character (CR and LF) versus Linux line ending character (LF)? Does each fasta record start with the greater than character (>)? Since you are specifying amino acid fasta just double check to be sure the sequences are actually amino acid characters.

ADD REPLYlink written 6 months ago by Tawny110
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: 460 users visited in the last hour