Skip to content

Commit

Permalink
Fix stats (#20)
Browse files Browse the repository at this point in the history
* fixed bam stats bug

* updated version
  • Loading branch information
jonas-fuchs authored Aug 7, 2024
1 parent cb4d1f4 commit 32e5b46
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bamdash/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""interactively visualize coverage and tracks"""
_program = "bamdash"
__version__ = "0.3"
__version__ = "0.3.1"
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 32e5b46

Please sign in to comment.