Skip to content

Commit

Permalink
version 0.1.2
Browse files Browse the repository at this point in the history
One more bug fix in `create_symbol_mapping()` and `create_id_mapping()`
  • Loading branch information
ramiromagno committed Jul 5, 2024
1 parent 2935309 commit 80b5ed6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mgi.report.reader
Title: Read Mouse Genome Informatics Reports
Version: 0.1.1
Version: 0.1.2
Authors@R: c(
person("Ramiro", "Magno", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5226-3441")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# mgi.report.reader 0.1.2

* Fix a bug in `create_symbol_mapping()` and `create_id_mapping()` regarding the
removal of rows that appear more than once, but that are effectively the same
mapping.

# mgi.report.reader 0.1.1

* Fix a bug in `create_symbol_mapping()` and `create_id_mapping()` regarding the
Expand Down
9 changes: 8 additions & 1 deletion R/crosswalks.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ create_symbol_mapping <- function(rpt) {

# Retains only those rows that appear exactly once, as other rows
# correspond to unresolvable mappings.
rpt_dt <- rpt_dt[, if (.N == 1) .SD, by = marker_symbol]
# rpt_dt <- rpt_dt[marker_symbol != marker_symbol_now, if (.N == 1) .SD, by = marker_symbol]
rpt_dt <- rpt_dt[, if (!((.N > 1) & (any(marker_symbol != marker_symbol_now)))) .SD, by = marker_symbol]

# Remove duplicated rows
rpt_dt <- rpt_dt[!duplicated(rpt_dt)]

# Key the marker_symbol column for performance in joins
data.table::setkey(rpt_dt, marker_symbol)
Expand Down Expand Up @@ -93,6 +97,9 @@ create_id_mapping <- function(rpt) {
# Remove rows with any NA values
rpt_dt <- stats::na.omit(rpt_dt, cols = c("marker_symbol", "marker_id_now"))

# Remove duplicated rows
rpt_dt <- rpt_dt[!duplicated(rpt_dt)]

# Retains only those rows that appear exactly once, as other rows
# correspond to unresolvable mappings.
rpt_dt <- rpt_dt[, if (.N == 1) .SD, by = marker_symbol]
Expand Down

0 comments on commit 80b5ed6

Please sign in to comment.