Skip to content

Commit

Permalink
Fix on make_matrix for custom reference genomes
Browse files Browse the repository at this point in the history
fix custom reference genomes
  • Loading branch information
dgulhan-bio authored Jul 8, 2019
2 parents 045ea54 + 7f7306b commit d988bc3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions R/make_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,16 @@ conv_snv_matrix_to_df <- function(genomes_matrix){
chrom_nums <- as.vector(GenomicRanges::seqnames(gr_context))
}

if(sum(grepl('MT', chrom_nums)) > 0){
seq_start <- seq_start[!grepl('MT', chrom_nums)]
seq_end <- seq_end[!grepl('MT', chrom_nums)]
ref_vector <- ref_vector[!grepl('MT', chrom_nums)]
alt_vector <- alt_vector[!grepl('MT', chrom_nums)]
chrom_nums <- chrom_nums[!grepl('MT', chrom_nums)]
if(length(chrom_nums) > 0){
inds <- unlist(lapply(chrom_nums,
function(x){
sum(grepl(paste0(paste0('chr', c(as.character(1:22), 'X', 'Y')), collapse = '|'), x)) > 0
}))
seq_start <- seq_start[inds]
seq_end <- seq_end[inds]
ref_vector <- ref_vector[inds]
alt_vector <- alt_vector[inds]
chrom_nums <- chrom_nums[inds]
}

context_seq <- VariantAnnotation::getSeq(ref_genome,
Expand Down

0 comments on commit d988bc3

Please sign in to comment.