Skip to content

Commit

Permalink
pysam import can take a long time.
Browse files Browse the repository at this point in the history
only do it when necessary?
  • Loading branch information
meren committed Dec 4, 2023
1 parent c96e224 commit c4d4590
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions anvio/filesnpaths.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import json
import time
import pysam
import shutil
import tarfile
import tempfile
Expand Down Expand Up @@ -305,8 +304,10 @@ def is_file_bam_file(file_path, dont_raise=False, ok_if_not_indexed=False):

is_file_exists(file_path)

from pysam import AlignmentFile

try:
bam_file = pysam.AlignmentFile(file_path, "rb")
bam_file = AlignmentFile(file_path, "rb")
except Exception as e:
if dont_raise:
return False
Expand Down

0 comments on commit c4d4590

Please sign in to comment.