# HG changeset patch
# User jackcurragh
# Date 1650467880 0
# Node ID c8d8675697c6f76ed10909a67089d754a3382436
# Parent 3ac12b611d7fe7fb5e74b0934182a6d9bb2e1a8f
Uploaded
diff -r 3ac12b611d7f -r c8d8675697c6 trips_bam_to_sqlite/bam_to_sqlite.py
--- a/trips_bam_to_sqlite/bam_to_sqlite.py Sun Apr 17 08:44:20 2022 +0000
+++ b/trips_bam_to_sqlite/bam_to_sqlite.py Wed Apr 20 15:18:00 2022 +0000
@@ -228,8 +228,8 @@
return (pos_modifier, readlen_modifier, mismatches)
-def process_bam(bam_filepath, transcriptome_info_dict_path, outputfile):
- desc = "NULL"
+def process_bam(bam_filepath, transcriptome_info_dict_path, outputfile, desc):
+ desc = desc
start_time = time.time()
study_dict = {}
nuc_count_dict = {"mapped": {}, "unmapped": {}}
@@ -289,6 +289,7 @@
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}_n_sorted.bam", "rb")
header = infile.header["HD"]
unsorted = False
@@ -721,9 +722,10 @@
sys.exit()
bam_filepath = sys.argv[1]
annotation_sqlite_filepath = sys.argv[2]
- # try:
- # desc = sys.argv[3]
- # except:
- # desc = bam_filepath.split("/")[-1]
- outputfile = bam_filepath + "v2.sqlite"
- process_bam(bam_filepath, annotation_sqlite_filepath, outputfile)
+ try:
+ desc = sys.argv[3]
+ except:
+ desc = bam_filepath.split("/")[-1]
+
+ outputfile = sys.argv[4]
+ process_bam(bam_filepath, annotation_sqlite_filepath, outputfile, desc)
diff -r 3ac12b611d7f -r c8d8675697c6 trips_bam_to_sqlite/test-data/test_n_sorted.bamv2.sqlite
Binary file trips_bam_to_sqlite/test-data/test_n_sorted.bamv2.sqlite has changed
diff -r 3ac12b611d7f -r c8d8675697c6 trips_bam_to_sqlite/trips_bam_to_sqlite.xml
--- a/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Sun Apr 17 08:44:20 2022 +0000
+++ b/trips_bam_to_sqlite/trips_bam_to_sqlite.xml Wed Apr 20 15:18:00 2022 +0000
@@ -2,11 +2,11 @@
Convert BAM file to SQLITE for TRIPS-Viz
pysam
- sqlitedict
+ sqlitedict
sqlite