Skip to content

Commit 2fbdb32

Browse files
authored
Merge pull request #52 from J35P312/find_sv_from_seq
Find sv from seq
2 parents b113297 + 82d0757 commit 2fbdb32

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
ext_modules = []
2020

2121
setup(name='svdb',
22-
version='2.6.1',
22+
version='2.6.2',
2323
url="https://github.com/J35P312/SVDB",
2424
author="Jesper Eisfeldt",
2525
author_email="jesper.eisfeldt@scilifelab.se",

svdb/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def make_query_calls (args, queries, keyword):
3636
query_module.main(args)
3737

3838
def main():
39-
version = "2.6.1"
39+
version = "2.6.2"
4040
parser = argparse.ArgumentParser(
4141
"""SVDB-{}, use the build module to construct databases, use the query module to query the database usign vcf files, or use the hist module to generate histograms""".format(version), add_help=False)
4242
parser.add_argument('--build', help="create a db",

svdb/merge_vcf_module.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ def print_header(vcf_list, vcf_dictionary, args, command_line):
109109
print(subheader[entry].strip())
110110
if not args.notag:
111111
print("##INFO=<ID=VARID,Number=1,Type=String,Description=\"The variant ID of merged samples\">")
112+
print("##INFO=<ID=FOUNDBY,Number=1,Type=Integer,Description=\"The number of files containing the variant\">")
112113
print("##INFO=<ID=set,Number=1,Type=String,Description=\"Source VCF for the merged record in SVDB\">")
113114
print("##INFO=<ID=svdb_origin,Number=1,Type=String,Description=\"pipe separated list of the VCF for the merged record in SVDB\">")
114115

svdb/merge_vcf_module_cython.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ def merge(variants, samples, sample_order, sample_print_order, priority_order, a
331331
if not args.notag:
332332
set_tag = determine_set_tag(priority_order, files)
333333
line[7] += ";set={}".format(set_tag)
334+
line[7] += ";FOUNDBY={}".format( len(set(filters_tag.keys())) )
334335

335336
#add chrom information of all merged variants
336337
callers=[]

svdb/readVCF.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,43 @@ def readVCFLine(line):
5252
elif "]" not in variation[4] and "[" not in variation[4]:
5353

5454
chrB = chrA
55+
posB = posA
56+
5557
if "END" in description:
5658
posB = int(description["END"])
57-
5859
elif "SVLEN" in description:
5960
posB = posA + abs(int(description["SVLEN"]))
60-
else:
61-
posB = posA
61+
6262
# sometimes the fermikit intra chromosomal events are inverted i.e the end pos is a lower position than the start pos
6363
if posB < posA:
6464
tmp = posB
6565
posB = posA
6666
posA = tmp
67-
event_type = variation[4].strip("<").rstrip(">")
6867

68+
nucleotides=set(["A","T","C","G","N"])
69+
#SVtype is given in alt column
6970
if "<" in variation[4] and ">" in variation[4]:
71+
event_type = variation[4].strip("<").rstrip(">")
7072
if "DUP" in event_type:
7173
event_type = "DUP"
72-
else:
73-
if "SVTYPE" in description:
74-
event_type = description["SVTYPE"]
74+
75+
#SVtype present in INFO
76+
elif "SVTYPE" in description:
77+
event_type = description["SVTYPE"]
78+
79+
#no SVTYPE, actual sequence is written in alt
80+
elif set(list(variation[4])).union(nucleotides) == nucleotides:
81+
if len(variation[4]) > len(variation[3]):
82+
event_type="INS"
83+
else:
84+
event_type="DEL"
85+
posB=posA+len(variation[3])-1
86+
7587
#treat the insertion as single points
7688
if "INS" in event_type:
7789
posA=int(variation[1])
7890
posB=int(variation[1])
7991

80-
81-
8292
# if the variant is given as a breakpoint, it is stored as a precise variant in the db
8393
else:
8494
B = variation[4]

0 commit comments

Comments
 (0)