Skip to content

Error in sequence.default(n..1, from = seq.int(s.1, length(df), s.1)) : 'from' contains NAs #105

@zongxiuXu

Description

@zongxiuXu

Dear stringdist developers,

Hello and greetings. I am a basic bioinformatics analyst. I'm using stringdist on the Rstudio platform to perform a large number of short amino acid sequence alignments, and I hope to obtain the distance relationships between these short sequences to create a network graph. My work environment is Ubuntu 24, with 4 physical CPUs and 1TB of RAM.

My code is as follows, where sequences is a character storing amino acid sequences. These sequences vary in length but are all less than 20 characters:

levdist <- stringdistmatrix(sequences, method = "lv")
matrix <- as.matrix(levdist)

When the length of sequences is less than 10,000, the above code works well without any errors. However, when dealing with a large number of amino acid sequences (my goal is six million sequences), the stringdistmatrix function runs successfully, but the resulting levdist object encounters the following error:

> matrix <- as.matrix(levdist)

Error in sequence.default(n..1, from = seq.int(s.1, length(df), s.1)) :
'from' contains NAs
In sequence.default(n..1, from = seq.int(s.1, length(df), s.1)) :
NAs introduced by coercion to integer range

Not only does the as.matrix function cause this error, but even simple operations like unique(levdist) or attempting to directly read levdist result in the same error.

I have tried searching for relevant information online but have not found an answer. I am unsure where the error lies.

Furthermore, do you think there is a problem with my method of converting the dist format to a matrix? Is there a better way to create a network graph besides using the igraph package to interpret the matrix?

I sincerely look forward to your answers and appreciate your help!

Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions