Skip to content

Commit

Permalink
fix: all_ok check for empyt GRangesList (see issue jorainer#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgatto committed Dec 31, 2021
1 parent 7e90f99 commit 25d85fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/proteinToX.R
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ proteinToGenome <- function(x, db, id = "name", idType = "protein_id") {
message("Checking CDS and protein sequence lengths ... ", appendLF = FALSE)
cds_genome <- .cds_matching_protein(db, cds_genome)
are_ok <- unlist(lapply(cds_genome, function(z) {
if (is(z, "GRangesList"))
if (is(z, "GRangesList") & length(z) > 0)
all(z[[1]]$cds_ok)
else NA
}))
message(sum(are_ok, na.rm = TRUE), "/", length(are_ok), " OK")
are_ok <- are_ok[!is.na(are_ok)]
## We've got now a list of GRanges
message(sum(are_ok), "/", length(are_ok), " OK")
## Perform the mapping for each input range with each mapped cds
res <- mapply(
cds_genome, as(coords_cds, "IRangesList"), as(x, "IRangesList"),
Expand Down

0 comments on commit 25d85fa

Please sign in to comment.