Skip to content

Commit

Permalink
Fix #265, support reference genomes with no 'chr' prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Aug 27, 2020
1 parent ab2f086 commit 92ae7b5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 37 deletions.
4 changes: 2 additions & 2 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This package was submitted to CRAN on 2020-08-25.
Once it is accepted, delete this file and tag the release (commit f750974add).
This package was submitted to CRAN on 2020-08-27.
Once it is accepted, delete this file and tag the release (commit ab2f086).
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# sigminer 1.0.13

- Supported `BSgenome.Hsapiens.1000genomes.hs37d5` in `sig_tally()`.
- Remove changing `MT` to `M` in mutation data.
- Fixed bug in extract numeric signature names and signature orderings in `show_sig_exposure()`.
- Added `letter_colors` as an unexported discrete palette.

Expand Down
21 changes: 14 additions & 7 deletions R/sig_tally.R
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,6 @@ sig_tally.MAF <- function(object, mode = c("SBS", "DBS", "ID", "ALL"),
ignore.case = TRUE
)

query$Chromosome <- sub(
pattern = "MT",
replacement = "M",
x = as.character(query$Chromosome),
ignore.case = TRUE
)

# detect and transform chromosome 23 to "X"
query$Chromosome <- sub("23", "X", query$Chromosome)
# detect and transform chromosome 24 to "Y"
Expand All @@ -488,6 +481,20 @@ sig_tally.MAF <- function(object, mode = c("SBS", "DBS", "ID", "ALL"),
ref_seqs_lvls <- BSgenome::seqnames(x = ref_genome)
query_seq_lvls_missing <- query_seq_lvls[!Chromosome %in% ref_seqs_lvls]

if (nrow(query_seq_lvls_missing) > 3) {
## Some reference genome builds have no 'chr' prefix
send_warning("Too many chromosome names cannot match reference genome. Try dropping 'chr' prefix to fix it...")
query$Chromosome <- sub(
pattern = "chr",
replacement = "",
x = as.character(query$Chromosome),
ignore.case = TRUE
)
query_seq_lvls <- query[, .N, Chromosome]
query_seq_lvls_missing <- query_seq_lvls[!Chromosome %in% ref_seqs_lvls]
send_info("Dropped.")
}

if (nrow(query_seq_lvls_missing) > 0) {
send_warning(paste0(
"Chromosome names in MAF must match chromosome names in reference genome.\nIgnorinig ",
Expand Down
58 changes: 30 additions & 28 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 92ae7b5

Please sign in to comment.