Skip to content

Commit

Permalink
fixed bam stats bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-fuchs committed Aug 7, 2024
1 parent cb4d1f4 commit 95567e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bamdash/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def main(sysargs=sys.argv[1:]):
# dump track data
vcf_track_count, bed_track_count, gb_track_count = 0, 0, 0
if args.dump:
pd.DataFrame.from_dict(stat_dict, orient="index").to_csv("bam_stats.tabular", sep="\t", header=False, index=True)
pd.DataFrame.from_dict(stat_dict, orient="index").to_csv(f"{args.reference}_bam_stats.tabular", sep="\t", header=False, index=True)
if track_data:
for track in track_data:
if track[1] == "vcf":
Expand Down
3 changes: 3 additions & 0 deletions bamdash/scripts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def make_title_string(parsed_bam, coverage_df, reference, min_cov):
stat_dict = {}
# get bam stats for correct chrom
bam_stats = parsed_bam.get_index_statistics()[0]
for bam_stats in parsed_bam.get_index_statistics():
if bam_stats[0] == reference:
break
# pop dict
stat_dict["reference"] = bam_stats[0]
stat_dict["reference length (bp)"] = parsed_bam.get_reference_length(reference)
Expand Down

0 comments on commit 95567e9

Please sign in to comment.