Skip to content

Commit

Permalink
Ran github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
smped committed Feb 2, 2024
1 parent ccf3f8a commit d400bcb
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 33 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: transmogR
Type: Package
Title: Modify a set of reference sequences using a set of variants
Version: 0.99.1
Version: 0.99.2
Authors@R: person("Stevie", "Pederson",
email = "stephen.pederson.au@gmail.com",
role = c("aut", "cre"),
Expand All @@ -22,11 +22,9 @@ Depends:
GenomicRanges
Imports:
BSgenome,
ComplexUpset,
GenomeInfoDb,
GenomicFeatures,
ggplot2,
InteractionSet,
IRanges,
methods,
parallel,
Expand All @@ -39,7 +37,9 @@ Imports:
Suggests:
BiocStyle,
BSgenome.Hsapiens.UCSC.hg38,
ComplexUpset,
extraChIPs,
InteractionSet,
knitr,
rmarkdown,
rtracklayer,
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ importClassesFrom(VariantAnnotation,VcfFile)
importFrom(BSgenome,getSeq)
importFrom(Biostrings,IUPAC_CODE_MAP)
importFrom(Biostrings,getSeq)
importFrom(ComplexUpset,intersection_size)
importFrom(ComplexUpset,upset)
importFrom(ComplexUpset,upset_set_size)
importFrom(GenomeInfoDb,"genome<-")
importFrom(GenomeInfoDb,"seqinfo<-")
importFrom(GenomeInfoDb,"seqlevels<-")
Expand All @@ -41,7 +38,6 @@ importFrom(IRanges,overlapsAny)
importFrom(IRanges,start)
importFrom(IRanges,subsetByOverlaps)
importFrom(IRanges,width)
importFrom(InteractionSet,GInteractions)
importFrom(S4Vectors,"mcols<-")
importFrom(S4Vectors,DataFrame)
importFrom(S4Vectors,mcols)
Expand Down
10 changes: 4 additions & 6 deletions R/genomogrify.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ setMethod(
"genomogrify",
signature = signature(x = "XStringSet", var = "GRanges"),
function(
x, var, alt_col = "ALT", mask, tag = NULL, sep = "_",
x, var, alt_col = "ALT", mask = GRanges(), tag = NULL, sep = "_",
var_tags = FALSE, var_sep = "_", verbose = TRUE, ...
) {

Expand All @@ -72,9 +72,7 @@ setMethod(
## 5. Optionally tag sequence names
## - Use a common tag + specific tags for SNPs/Insertions/Deletions

if (missing(mask)) mask <- GRanges()
stopifnot(is(mask, "GRanges"))

## Check the variants are valid
var <- .checkAlts(var, alt_col)
var <- var[!overlapsAny(var, mask)]
Expand Down Expand Up @@ -129,7 +127,7 @@ setMethod(
"genomogrify",
signature = signature(x = "BSgenome", var = "GRanges"),
function(
x, var, alt_col = "ALT", mask, names, tag = NULL, sep = "_",
x, var, alt_col = "ALT", mask = GRanges(), names, tag = NULL, sep = "_",
var_tags = FALSE, var_sep = "_", verbose = TRUE, ...
) {
## Setup the sequence info
Expand All @@ -153,7 +151,7 @@ setMethod(
"genomogrify",
signature = signature(x = "BSgenome", var = "VcfFile"),
function(
x, var, alt_col = "ALT", mask, names, tag = NULL, sep = "_",
x, var, alt_col = "ALT", mask = GRanges(), names, tag = NULL, sep = "_",
var_tags = FALSE, var_sep = "_", which, verbose = TRUE, ...
) {
var <- .parseVariants(var, alt_col, which)
Expand All @@ -171,7 +169,7 @@ setMethod(
"genomogrify",
signature = signature(x = "XStringSet", var = "VcfFile"),
function(
x, var, alt_col = "ALT", mask, tag = NULL, sep = "_",
x, var, alt_col = "ALT", mask = GRanges(), tag = NULL, sep = "_",
var_tags = FALSE, var_sep = "_", which, verbose = TRUE, ...
) {
var <- .parseVariants(var, alt_col, which)
Expand Down
9 changes: 5 additions & 4 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@
}

#' @keywords internal
#' @importFrom ComplexUpset intersection_size
.makeIntersectionArgs <- function(x){
stopifnot(is(x, "list"))
args <- as.list(formals(intersection_size))
args <- as.list(formals(ComplexUpset::intersection_size))
args <- args[names(args) != "..."]
cmn <- intersect(names(x), names(args))
novel <- setdiff(names(x), names(args))
Expand All @@ -63,10 +62,12 @@
}

#' @importFrom S4Vectors mcols mcols<-
#' @importFrom InteractionSet GInteractions
#' @keywords internal
.giFromSj <- function(sj, tx_col, rank_col) {

if (!requireNamespace('InteractionSet', quietly = TRUE))
stop("Please install 'InteractionSet' to return a GInteractions object.")

stopifnot("site" %in% colnames(mcols(sj)))
stopifnot(all(sj$site %in% c("donor", "acceptor")))
stopifnot(is.numeric(mcols(sj)[[rank_col]]))
Expand All @@ -85,7 +86,7 @@
if (any(is.na(dnr_to_acc))) stop("NA values when mapping junctions")

cols <- setdiff(colnames(mcols(dnr)), c("site", rank_col))
gi <- GInteractions(
gi <- InteractionSet::GInteractions(
anchor1 = granges(dnr)[dnr_to_acc],
anchor2 = granges(acc)[acc_to_dnr]
)
Expand Down
4 changes: 1 addition & 3 deletions R/indelcator.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ setMethod(
signature = signature(x = "XString", indels = "GRanges"),
function(x, indels, exons, alt_col = "ALT", ...) {

## Check classes (Not needed for S4)
cl <- class((x))

## Get the variants matching the exons
indels <- subsetByOverlaps(indels, exons)
strand(indels) <- "*"
Expand Down Expand Up @@ -118,6 +115,7 @@ setMethod(
df$alt <- df$seq
alt <- mcols(indels)[[alt_col]]
names(alt) <- indels$ID
cl <- class((x)) # Needed for coercion at the final step
if (neg_stranded) {
new_cl <- paste0(cl, "Set")
alt <- as.character(reverseComplement(as(alt, new_cl)))
Expand Down
1 change: 0 additions & 1 deletion R/owl.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ setMethod(
function(seq, snps, alt_col = "ALT", ...) {

## Check the SNPs
stopifnot(is(snps, "GenomicRanges"))
snps <- .checkAlts(snps, alt_col)
stopifnot(all(width(snps) == 1)) # Must be single positions
stopifnot(all(nchar(mcols(snps)[[alt_col]]) == 1)) # Must be SNPs
Expand Down
10 changes: 6 additions & 4 deletions R/upsetVarByCol.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#'
#' @importFrom S4Vectors splitAsList mcols
#' @importFrom IRanges subsetByOverlaps
#' @importFrom ComplexUpset intersection_size upset_set_size upset
#' @importFrom ggplot2 aes geom_bar geom_text after_stat ggtitle position_stack
#' @importFrom ggplot2 scale_y_reverse scale_y_continuous expansion ylab
#' @importFrom rlang list2 :=
Expand All @@ -55,6 +54,9 @@ upsetVarByCol <- function(
hjust_counts = 1.1, set_lab = "Set Size", title
){

if (!requireNamespace('ComplexUpset', quietly = TRUE))
stop("Please install 'ComplexUpset' to use this function.")

stopifnot(is(gr, "GRanges"))
mcol <- match.arg(mcol, colnames(mcols(gr)))

Expand All @@ -79,11 +81,11 @@ upsetVarByCol <- function(
df_list <- list(ids = ol_ids, lapply(ol, \(x) ol_ids %in% x))
df <- as.data.frame(df_list)
base_args <- .makeIntersectionArgs(intersection_args)
base_ann <- do.call("intersection_size", base_args) +
base_ann <- do.call(ComplexUpset::intersection_size, base_args) +
scale_y_continuous(expand = expansion(c(0, 0.05)))
if (is.character(title)) base_ann <- base_ann + ggtitle(title)

sets <- upset_set_size(geom = set_geom) + ylab(set_lab) +
sets <- ComplexUpset::upset_set_size(geom = set_geom) + ylab(set_lab) +
scale_y_reverse(expand = expansion(c(set_expand, 0)))
if (set_counts) {
count <- c()
Expand All @@ -92,7 +94,7 @@ upsetVarByCol <- function(
)
}

upset(
ComplexUpset::upset(
df, names(var_list),
base_annotations = list2("{intersection_lab}" := base_ann),
set_sizes = sets, ...
Expand Down
8 changes: 4 additions & 4 deletions man/genomogrify-methods.Rd

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

5 changes: 1 addition & 4 deletions vignettes/creating_a_new_reference.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ require installation.
```r
if (!"BiocManager" %in% rownames(installed.packages()))
install.packages("BiocManager")
pkg <- c(
"rtracklayer", "BSgenome.Hsapiens.UCSC.hg38", "extraChIPs", "transmogR"
)
BiocManager::install(pkg, update = FALSE)
BiocManager::install("transmogR")
```

Once these packages are installed, we can load them easily
Expand Down

0 comments on commit d400bcb

Please sign in to comment.