Skip to content

Commit

Permalink
Save long VNTRs to the VNTR database (#63)
Browse files Browse the repository at this point in the history
* Remove the constraint on VNTR length in saving to the VNTR database

* Add vntr length threshold to save in database with default value of 10kbp

* Fix indentation
  • Loading branch information
sara-javadzadeh authored Nov 4, 2022
1 parent d316411 commit 0147cf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions advntr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def load_unique_vntrs_data(db_file=None):
return vntrs


def save_vntrs_to_database(processed_vntrs, db_file):
def save_vntrs_to_database(processed_vntrs, db_file, vntr_length_threshold=10000):
with open(processed_vntrs) as input_file:
lines = input_file.readlines()
db = sqlite3.connect(db_file)
Expand All @@ -171,7 +171,7 @@ def save_vntrs_to_database(processed_vntrs, db_file):
for line in lines:
line = line.strip()
vntr_id, overlap, chromosome, start, gene, annotation, pattern, left_flank, right_flank, segments = line.split()
if len(segments.replace(',', '')) > 150:
if len(segments.replace(',', '')) > vntr_length_threshold:
continue
cursor.execute('''INSERT INTO vntrs(id, nonoverlapping, chromosome, ref_start, gene_name, annotation, pattern,
left_flanking, right_flanking, repeats, scaled_score) VALUES(?,?,?,?,?,?,?,?,?,?,?)''',
Expand Down

0 comments on commit 0147cf8

Please sign in to comment.