diff trips_create_annotation/create_annotation_sqlite.py @ 3:f1c72ed4b32c draft

Uploaded
author jackcurragh
date Wed, 20 Apr 2022 15:18:02 +0000
parents d70696d3341e
children cdecd5f9a4d3
line wrap: on
line diff
--- a/trips_create_annotation/create_annotation_sqlite.py	Sun Apr 17 08:45:11 2022 +0000
+++ b/trips_create_annotation/create_annotation_sqlite.py	Wed Apr 20 15:18:02 2022 +0000
@@ -6,6 +6,8 @@
 import sys
 import re
 import sqlite3
+import subprocess
+
 from intervaltree import Interval, IntervalTree
 import itertools
 from sqlitedict import SqliteDict
@@ -24,6 +26,7 @@
 user_gene_name = sys.argv[6]
 # Set to true if transcript version is included in transcript_id, e.g: ENST000000123456.1
 TRAN_VERSION = True
+output = sys.argv[7]
 
 
 if os.path.isfile("{}.sqlite".format(organism)):
@@ -610,7 +613,7 @@
 # print (list(tree_dict))
 
 
-connection = sqlite3.connect("{}.sqlite".format(organism))
+connection = sqlite3.connect(output)
 cursor = connection.cursor()
 cursor.execute(
     "CREATE TABLE IF NOT EXISTS transcripts (transcript VARCHAR(50), gene VARCHAR(50), length INT(6), cds_start INT(6), cds_stop INT(6), sequence VARCHAR(50000), strand CHAR(1), stop_list VARCHAR(10000), start_list VARCHAR(10000), exon_junctions VARCHAR(1000), tran_type INT(1), gene_type INT(1), principal INT(1), version INT(2),gc INT(3),five_gc INT(3), cds_gc INT(3), three_gc INT(3), chrom VARCHAR(20));"
@@ -969,9 +972,9 @@
                     transcript, tup[0], tup[1]
                 )
             )
-
-connection.commit()
-connection.close()
+# print(cursor.execute(
+#     ".tables"
+#     ))
 
 print("delim", delimiters)
 if (nuc_dict["starts"]["other"] / nuc_dict["starts"]["starts"]) > 0.05:
@@ -992,3 +995,10 @@
             len(notinannotation)
         )
     )
+
+
+
+connection.commit()
+connection.close()
+
+