gravatar for Akshay Zawar

3 hours ago by

Pune, India


I am running LOHHLA pipeline on some cancer samples. I have successfully set up the pipeline at my end with all the dependencies installed. I was also able to run the pipeline using the example dataset.

Now for my data, I have prepared all the required files. But after running the pipeline, I get an error that relates to function in the code. Here is the error line from the terminal.

Error in editDistance - indelTotals :
  non-numeric argument to binary operator
Execution halted

Here is the snippet from the code which belongs to this function - <- function(BAMfile, n){
  x              <- scanBam(BAMfile, index = BAMfile, param=ScanBamParam(what = scanBamWhat(), tag = 'NM'))
  readIDs        <- x[[1]][['qname']]
  cigar          <- x[[1]][['cigar']]
  editDistance   <- unlist(x[[1]][['tag']])
  insertionCount <- sapply(cigar, FUN = function(boop) {return(length(grep(pattern = 'I', x = unlist(strsplit(boop, split = '')))))} )
  deletionCount  <- sapply(cigar, FUN = function(boop) {return(length(grep(pattern = 'D', x = unlist(strsplit(boop, split = '')))))} )
  indelTotals    <- sapply(cigar, FUN = function(boop) {
    tmp <- unlist(strsplit( gsub("([0-9]+)","~\1~",boop), "~" ))
    Is  <- grep(pattern = 'I', x = tmp)
    Ds  <- grep(pattern = 'D', x = tmp)
    total <- sum(as.numeric(tmp[(Is-1)])) + sum(as.numeric(tmp[Ds-1]))
  misMatchCount <- editDistance - indelTotals
  eventCount <- misMatchCount + insertionCount + deletionCount
  names(eventCount) <- 1:length(eventCount)
  passed     <- eventCount[which(eventCount <= n)]
  y <- readIDs[as.numeric(names(passed))]
  y <- names(table(y)[which(table(y) == 2)])

I tried to debug this error and checked the BAM file for the presence of NM tags which are there in the file. I noticed that the editDistance variable is NULL and indelTotals variable has List class.

Can anyone please help me with this issue?

Source link