diff --git a/svtyper/classic.py b/svtyper/classic.py index 76f5393..b2e53e4 100755 --- a/svtyper/classic.py +++ b/svtyper/classic.py @@ -125,7 +125,8 @@ def sv_genotype(bam_string, if b.endswith('.bam'): bam_list.append(pysam.AlignmentFile(b, mode='rb')) elif b.endswith('.cram'): - bam_list.append(pysam.AlignmentFile(b, mode='rc', reference_filename=ref_fasta)) + bam_list.append(pysam.AlignmentFile(b, + mode='rc',reference_filename=ref_fasta,format_options=["required_fields=7167"])) else: sys.stderr.write('Error: %s is not a valid alignment file (*.bam or *.cram)\n' % b) exit(1) diff --git a/svtyper/parsers.py b/svtyper/parsers.py index 2395f52..e17d234 100644 --- a/svtyper/parsers.py +++ b/svtyper/parsers.py @@ -723,6 +723,9 @@ def close(self): # from a single molecule # ================================================== +def rhash(r): + return hash((r.query_name, r.flag)) + class SamFragment(object): def __init__(self, read, lib): self.lib = lib @@ -744,7 +747,7 @@ def is_primary(self, read): def add_read(self, read): # ensure we don't add the same read twice - read_hash = read.__hash__() + read_hash = rhash(read) if read_hash in self.read_set: return else: