Skip to content

Commit

Permalink
fix bug with bam file dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
ivagljiva committed Dec 7, 2023
1 parent 0159ffc commit 1d8f32e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sandbox/anvi-script-reformat-bam
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ def reformat_BAM(args):
# sanity check for matching number of sequences
run.info("Sequences in BAM file", len(header_dict['SQ']))
if len(rename_dict) != len(header_dict['SQ']):
mismatching_bam = [x for x in header_dict['SQ'] if x not in rename_dict]
mismatching_rename = [x for x in rename_dict if x not in header_dict['SQ']]
all_seqs_in_bam = [x['SN'] for x in header_dict['SQ']]
mismatching_bam = [x for x in all_seqs_in_bam if x not in rename_dict]
mismatching_rename = [x for x in rename_dict if x not in all_seqs_in_bam]
raise ConfigError(f"ERROR: The number of sequences in the BAM file ({len(header_dict['SQ'])}) does "
f"not match to the number of sequences in the reformat report ({len(rename_dict)}). "
f"For example, here are the sequences that are only in the BAM file and not in the "
Expand Down

1 comment on commit 1d8f32e

@telatin
Copy link
Contributor

@telatin telatin commented on 1d8f32e Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ivagljiva :)

Please sign in to comment.