diff --git a/src/read_groups.py b/src/read_groups.py index 78a7d8eb..b141966b 100644 --- a/src/read_groups.py +++ b/src/read_groups.py @@ -186,7 +186,8 @@ def split_read_group_table(table_file, sample, read_id_column_index, group_id_co for bam_file in bam_files: bam = pysam.AlignmentFile(bam_file, "rb") for chr_id in bam.references: - read_group_files[chr_id] = open(sample.read_group_file + "_" + chr_id, "w") + if chr_id not in read_group_files: + read_group_files[chr_id] = open(sample.read_group_file + "_" + chr_id, "w") for read_alignment in bam: chr_id = read_alignment.reference_name if not chr_id: