This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error with reading fasta file into R - "arguments imply differing number of rows"

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.

library(phangorn)

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!

r alignment software error fasta read.phydat

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.

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.

0 answers

No answers yet.

Log in to answer this question.