From 19f44ae58a5dac344f15151cdc93334c219ef0f0 Mon Sep 17 00:00:00 2001 From: baptwr Date: Mon, 2 Feb 2026 09:41:30 +0100 Subject: [PATCH] Modified pysam import to class attribute --- checkm/coverage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/checkm/coverage.py b/checkm/coverage.py index 24a3393..a027227 100755 --- a/checkm/coverage.py +++ b/checkm/coverage.py @@ -50,6 +50,7 @@ def __init__(self, threads): # pysam can be a challenge to install and most users # will not use this functionality so importing pysam here import pysam + self.pysam = pysam self.logger = logging.getLogger('timestamp') self.totalThreads = threads @@ -128,7 +129,7 @@ def _processBam(self, bamFile, bAllReads, minAlignPer, maxEditDistPer, minQC, co workerQueue = mp.Queue() writerQueue = mp.Queue() - bamfile = pysam.Samfile(bamFile, 'rb') + bamfile = self.pysam.Samfile(bamFile, 'rb') refSeqIds = bamfile.references refSeqLens = bamfile.lengths @@ -190,7 +191,7 @@ def __workerThread(self, bamFile, bAllReads, minAlignPer, maxEditDistPer, minQC, if seqIds == None: break - bamfile = pysam.Samfile(bamFile, 'rb') + bamfile = self.pysam.Samfile(bamFile, 'rb') for seqId, seqLen in zip(seqIds, seqLens): numReads = 0