invalid class “ScanBamParam” object
Closed this issue · 10 comments
Hi
I tried to run the "MitoTrace works on single cell 10X genomics data" tutorial but I got this error when I run this line of code: mae_res <- MitoTrace(bam_list = bams, fasta = fasta_loc, chr_name = "MT", min_read = 100)
the error was:
[1] "Extracting barcodes from single BAM file and running pileup for each barcode separately"
Error in validObject(.Object) : invalid class “ScanBamParam” object: 'tagFilter' must contain only non-NULL, non-NA, non-empty character or integer values
could you help me resolve this error?
I downloaded the bam files from the mentioned source in the tutorial.
Here is the traceback from the error:
Error in validObject(.Object) : invalid class “ScanBamParam” object: 'tagFilter' must contain only non-NULL, non-NA, non-empty character or integer values
- stop(msg, ": ", errors, domain = NA)
- validObject(.Object)
- initialize(value, ...)
- initialize(value, ...)
- new("ScanBamParam", flag = flag, simpleCigar = simpleCigar, reverseComplement = reverseComplement, tag = tag, tagFilter = .normalize_tagFilter(tagFilter), what = what, which = which, mapqFilter = as.integer(mapqFilter))
- ScanBamParam(flag = flag, simpleCigar = simpleCigar, reverseComplement = reverseComplement, tag = tag, tagFilter = tagFilter, what = what, which = which, mapqFilter = as.integer(mapqFilter))
- ScanBamParam(flag = flag, simpleCigar = simpleCigar, reverseComplement = reverseComplement, tag = tag, tagFilter = tagFilter, what = what, which = which, mapqFilter = as.integer(mapqFilter))
- ScanBamParam(tagFilter = filter, which = which)
- ScanBamParam(tagFilter = filter, which = which)
-
- slot(object, "reverseComplement")
- bamReverseComplement(scanBamParam)
- .pileup(bf, scanBamParam = scanBamParam, pileupParam = pileupParam)
- pileup(bam_list, scanBamParam = ScanBamParam(tagFilter = filter, which = which), pileupParam = PileupParam(distinguish_strands = FALSE, max_depth = max_depth, min_base_quality = min_base_quality, min_mapq = min_mapq, min_nucleotide_depth = min_nucleotide_depth, ...
- pileup(bam_list, scanBamParam = ScanBamParam(tagFilter = filter, which = which), pileupParam = PileupParam(distinguish_strands = FALSE, max_depth = max_depth, min_base_quality = min_base_quality, min_mapq = min_mapq, min_nucleotide_depth = min_nucleotide_depth, ...
- FUN(X[[i]], ...)
- lapply(good_barcodes, function(x) { filter <- list(x) names(filter) <- tag_name pileup_bam <- pileup(bam_list, scanBamParam = ScanBamParam(tagFilter = filter, ...
- MitoTrace(bam_list = bams, fasta = fasta_loc, chr_name = "MT", min_read = 100)
Hi I tried to run the "MitoTrace works on single cell 10X genomics data" tutorial but I got this error when I run this line of code: mae_res <- MitoTrace(bam_list = bams, fasta = fasta_loc, chr_name = "MT", min_read = 100)
the error was:
[1] "Extracting barcodes from single BAM file and running pileup for each barcode separately" Error in validObject(.Object) : invalid class “ScanBamParam” object: 'tagFilter' must contain only non-NULL, non-NA, non-empty character or integer values
could you help me resolve this error?
I downloaded the bam files from the mentioned source in the tutorial.
If you are still using this package, I believe the issue is due to the BAM file containing NA names. To address this, I suggest modifying the mitotrace function by adding the line barcodes <- barcodes[!is.na(barcodes)] before obtaining the good_barcodes. This modification should help resolve the problem.
I have the same issue but adding that line did not change anything
@shaohuishi could you solve this issue coz even using your own data gives the same error
@shaohuishi could you solve this issue coz even using your own data gives the same error
Yes, I used this modification and it worked on my own data with no problems in subsequent analyses.
@shaohuishi could you solve this issue coz even using your own data gives the same error
I added this line after line 90 provided by mitotrace package. After modification, it looks like this
if(is.null(barcodes)){
barcodes <- scanBam(bam_list, param = params)
#debug
valid_barcodes <- barcodes[!is.na(barcodes)]
good_barcodes <- names(which(table(valid_barcodes[[1]][[1]][[1]]) > min_read))
}
And I recommend using the parallel package to parallelize the total_mpileups function to improve running speed, especially during formal analysis
@shaohuishi I run it on my 10x scRNAseq data but it takes a very long time without finishing and giving any result. This happens even when I subset the bam or a short list of barcodes, and running it on cluster with big Ram. what could be the issue? I guess it might be because the my bam file is different?
@shaohuishi I run it on my 10x scRNAseq data but it takes a very long time without finishing and giving any result. This happens even when I subset the bam or a short list of barcodes, and running it on cluster with big Ram. what could be the issue? I guess it might be because the my bam file is different?
Sorry, since I am not the author, I cannot pinpoint the problem you are experiencing.
I tried the package on my own data, using the bam files generated by cellranger directly, without providing barcodes. Therefore, I delete lines 93-95 at the same time to prevent interference with the parts I modified.
Another modification is to parallelize total_mpileups through the parallel package. By setting up multi-core parallelism, my own single bam file analysis only takes 4-5h, and each process requires about 800Mb of memory.
I suggest that you can run the main function line by line and observe whether there are any problems with the input and output. If you could provide some demo data I'd be happy to test it.
I had the same problem as @isadeghi87.
With my data I had no problem, but only when there were at least 2 bam files as input. I do not know how that could be the problem, but as soon as you add another file to the input list, it works.
A second problem is that, running MitoTrace() on multiple bam files, I get the matrix with the names of the datasets as the columns. This way I do not have the information for each single barcode, and I need it for the t-sne.
Thank you for your help
There was a bug which caused combined BAMs (i.e. 10x data) to throw the ScanBamParam error.
We have fixed this bug.