Skip to content

Commit

Permalink
clean hg19 refs
Browse files Browse the repository at this point in the history
clean hg19 refs to make it truly portable genome
  • Loading branch information
temizna authored Sep 11, 2017
1 parent 9bbaf15 commit 596cec6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/mut.to.sigs.input.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ mut.to.sigs.input = function(mut.ref, sample.id = 'Sample', chr = 'chr', pos = '
# If set to default, carry on happily
if(is.null(bsg)){
# Remove any entry in chromosomes that do not exist in the BSgenome.Hsapiens.UCSC.hg19::Hsapiens object
unknown.regions <- levels(mut[, chr])[which(!(levels(mut[, chr]) %in% GenomeInfoDb::seqnames(BSgenome.Hsapiens.UCSC.hg19::Hsapiens)))]
unknown.regions <- levels(mut[, chr])[which(!(levels(mut[, chr]) %in% GenomeInfoDb::seqnames(bsg)))]
if (length(unknown.regions) > 0) {
unknown.regions <- paste(unknown.regions, collapse = ',\ ')
warning(paste('Check chr names -- not all match BSgenome.Hsapiens.UCSC.hg19::Hsapiens object:\n', unknown.regions, sep = ' '))
mut <- mut[mut[, chr] %in% GenomeInfoDb::seqnames(BSgenome.Hsapiens.UCSC.hg19::Hsapiens), ]
warning(paste('Check chr names -- not all match',bsg,' object:\n', unknown.regions, sep = ' '))
mut <- mut[mut[, chr] %in% GenomeInfoDb::seqnames(bsg), ]
}
# Add in context
mut$context = BSgenome::getSeq(BSgenome.Hsapiens.UCSC.hg19::Hsapiens, mut[,chr], mut[,pos]-1, mut[,pos]+1, as.character = T)
mut$context = BSgenome::getSeq(bsg, mut[,chr], mut[,pos]-1, mut[,pos]+1, as.character = T)
}

# If set to another build, use that one
Expand Down

0 comments on commit 596cec6

Please sign in to comment.