Skip to content

Commit

Permalink
Fixed issue with longer introns; added ability to plot multiple genes
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Hoberecht committed Sep 14, 2022
1 parent a18f5c7 commit bdb0f7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: crisprViz
Title: Visualization Functions for CRISPR gRNAs
Version: 0.99.21
Version: 0.99.22
Authors@R: c(
person("Jean-Philippe", "Fortin", email = "fortin946@gmail.com", role = c("aut", "cre")),
person("Luke", "Hoberecht", email = "lukehob3@gmail.com", role = c("aut"))
Expand Down
22 changes: 12 additions & 10 deletions R/plotGuideSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ plotGuideSet <- function(x,
to <- plotWindowMax + margin * plotWindowSize
}
## have geneTrack adjust to plot window
geneTrack <- .getGeneTrack(geneModel=geneModel,
targetGene=targetGene,
from=from - extend.left,
to=to + extend.right)
geneTrack <- lapply(targetGene, function(x){
.getGeneTrack(geneModel=geneModel,
targetGene=x,
from=from - extend.left,
to=to + extend.right)
})

annotationTrack <- .getAnnotationTrack(annotations=annotations,
chr=chr,
Expand Down Expand Up @@ -300,7 +302,7 @@ plotGuideSet <- function(x,

## for tx_id above that exceed limit, append "exon" beyond limit
exonLeft <- lapply(txLeft, function(x){
strand <- unique(BiocGenerics::strand(splicings))
strand <- unique(BiocGenerics::strand(transcripts))
currentRanks <- splicings$exon_rank[splicings$tx_id == x]
if (length(currentRanks) == 0){
exon_rank <- ifelse(strand == "+", 1, 2)
Expand All @@ -310,11 +312,11 @@ plotGuideSet <- function(x,
exon_rank <- max(currentRanks) + 1
}
GenomicRanges::GRanges(
seqnames=unique(GenomeInfoDb::seqnames(splicings)),
seqnames=unique(GenomeInfoDb::seqnames(transcripts)),
ranges=IRanges::IRanges(start=from-extendDistance, width=1),
strand=strand,
tx_id=x,
gene_id=unique(splicings$gene_id),
gene_id=unique(transcripts$gene_id),
protein_id=NA,
tx_type=NA,
gene_symbol=NA,
Expand All @@ -331,7 +333,7 @@ plotGuideSet <- function(x,
exonLeft <- Reduce(c, exonLeft)

exonRight <- lapply(txRight, function(x){
strand <- unique(BiocGenerics::strand(splicings))
strand <- unique(BiocGenerics::strand(transcripts))
currentRanks <- splicings$exon_rank[splicings$tx_id == x]
if (length(currentRanks) == 0){
exon_rank <- ifelse(strand == "+", 2, 1)
Expand All @@ -341,11 +343,11 @@ plotGuideSet <- function(x,
exon_rank <- min(currentRanks) - 1
}
GenomicRanges::GRanges(
seqnames=unique(GenomeInfoDb::seqnames(splicings)),
seqnames=unique(GenomeInfoDb::seqnames(transcripts)),
ranges=IRanges::IRanges(start=to+extendDistance, width=1),
strand=strand,
tx_id=x,
gene_id=unique(splicings$gene_id),
gene_id=unique(transcripts$gene_id),
protein_id=NA,
tx_type=NA,
gene_symbol=NA,
Expand Down

0 comments on commit bdb0f7e

Please sign in to comment.