Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bug on small alignment https://github.com/lbbe-software/seqinr/issues/10 #11

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: seqinr
Title: Biological Sequences Retrieval and Analysis
Version: 4.2-39
Version: 4.2-41
Depends: R (>= 2.10.0)
Imports: ade4,segmented
Authors@R: c(person("Delphine", "Charif", role = "aut"),
Expand Down
8 changes: 6 additions & 2 deletions R/read.alignment.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ read.alignment <- function(file, format, forceToLower = TRUE,
white <- characters[-length(characters)] == " "
black <- characters[-1] != " "
istart <- which(white & black)[1]

# Get sequence names
nam <- character()
nseq <- 1
Expand All @@ -74,6 +73,12 @@ read.alignment <- function(file, format, forceToLower = TRUE,
nseq <- nseq - 1
break # alredy seen
}
# this happens with short alignments because seqname is never found
# in mam
if (seqname == 'NA') {
nseq <- nseq - 1
break
}
nam[nseq] <- seqname
nseq <- nseq + 1
}
Expand Down Expand Up @@ -101,7 +106,6 @@ read.alignment <- function(file, format, forceToLower = TRUE,
seq[[iseq]] <- paste0(filecontent[ii], collapse = "")
if(forceToLower) seq[[iseq]] <- tolower(seq[[iseq]])
}
#
return(as.alignment(nb = nseq, nam = nam, seq = seq, com = NA))
}

Expand Down
Loading