I ran into error message at jCounts step. It seems related to mate pair on different chromosomes. If I filter out bam files for mate pair sitting on different chromosomes (filed 7 with = sign means mate pair on same chromosome): samtools view -h input.bam | awk '($7 == "=")' > output.sam, then it can run.
txdb<-makeTxDbFromEnsembl(organism="Homo sapiens", release=103, circ_seqs=NULL, server="ensembldb.ensembl.org", username="anonymous", password=NULL, port=0L, tx_attrib=NULL) features<-binGenome(txdb) gbcounts <- gbCounts( features = features, targets = samples, minReadLength = 150, maxISize = 50000, libType="PE", strandMode=0) asd<- jCounts(counts = gbcounts,features = features,minReadLength = 150,libType="PE",strandMode=0,threshold = 5,minAnchor = 10) # Error: Error in .local(x, use.names, use.mcols, ...) : For some pairs in 'x', the 2 alignments are not on the same chromosome. Cannot associate a unique genomic range to such # pairs. Please call granges() with 'on.discordant.seqnames="drop"' to drop these pairs, or with 'on.discordant.seqnames="split"' to represent each of them with 2 genomic ranges # in the returned GRanges object. Note that in both cases the returned object won't be parallel to 'x'. Alternatively, please consider using grglist() instead of granges() to turn 'x' # into a GRangesList object instead of a GRanges object. See ?GAlignmentPairs for more information. # sessionInfo( )