# HG changeset patch # User jackcurragh # Date 1654620576 0 # Node ID 2c6f630c732f835c2e3dca0f442e7e488101d91c # Parent 1be4bbe849e3819ee47cbfd2e31726a6a7b3e796 Uploaded diff -r 1be4bbe849e3 -r 2c6f630c732f trips_bam_to_sqlite/bam_to_sqlite.py --- a/trips_bam_to_sqlite/bam_to_sqlite.py Tue Jun 07 16:20:36 2022 +0000 +++ b/trips_bam_to_sqlite/bam_to_sqlite.py Tue Jun 07 16:49:36 2022 +0000 @@ -288,8 +288,9 @@ master_offset_dict = {"fiveprime": {}, "threeprime": {}} master_metagene_stop_dict = {"fiveprime": {}, "threeprime": {}} + os.system(f'samtools sort -n {bam_filepath} -o {bam_filepath}_n_sorted.bam') pysam.set_verbosity(0) - infile = pysam.Samfile(f"{bam_filepath}", "rb") + infile = pysam.Samfile(f"{bam_filepath}_n_sorted.bam", "rb") header = infile.header["HD"] unsorted = False if "SO" in header: diff -r 1be4bbe849e3 -r 2c6f630c732f trips_bam_to_sqlite/trips_bam_to_sqlite.xml --- a/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Tue Jun 07 16:20:36 2022 +0000 +++ b/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Tue Jun 07 16:49:36 2022 +0000 @@ -1,9 +1,10 @@ - + Convert BAM file to SQLITE for Trips-Viz pysam sqlitedict sqlite + samtools