Skip to content

Commit

Permalink
test v0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjslee committed Jul 11, 2024
1 parent cb661c5 commit 038def0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build-backend = "maturin"

[project]
name = "vstol"
version = "0.2.3"
version = "0.2.4"
requires-python = ">=3.10"
keywords = [
"somatic variants",
Expand Down
19 changes: 6 additions & 13 deletions python/vstolib/vcf/cutesv.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


import pandas as pd
import re
from collections import OrderedDict
from typing import Dict
from ..constants import NucleicAcidTypes, VariantCallingMethods, VariantTypes
Expand Down Expand Up @@ -134,20 +135,12 @@ def parse_cutesv_callset(
if 'AF' in attributes.keys():
alternate_allele_fraction = get_typed_value(value=attributes['AF'], default_value=-1.0, type=float)

# Update chromosome_2 for 'BND' or 'TRA'
# Update chromosome_2 and position_2 for 'BND' or 'TRA'
if variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]:
chromosome_2 = alternate_allele.split(":")[0]
chromosome_2 = chromosome_2.replace("[", "")
chromosome_2 = chromosome_2.replace("]", "")
chromosome_2 = chromosome_2.replace("N", "")

# Update position_2 for 'BND' or 'TRA'
if variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]:
position_2 = alternate_allele.split(":")[1]
position_2 = position_2.replace("[", "")
position_2 = position_2.replace("]", "")
position_2 = position_2.replace("N", "")
position_2 = int(position_2)
pattern = re.compile(r'(chr\S+):(\d+)')
matches = pattern.findall(str(row['ALT']))
chromosome_2 = str(matches[0][0])
position_2 = int(matches[0][1])

# Update variant_size for 'BND' or 'TRA'
if (variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]) and \
Expand Down
2 changes: 1 addition & 1 deletion python/vstolib/vcf/savana.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def parse_savana_callset(

# Update chromosome_2 and position_2 for 'BND'
if variant_type == VariantTypes.BREAKPOINT or variant_type == VariantTypes.TRANSLOCATION:
pattern = re.compile(r'(chr(?:\d+|X|Y|MT|M)):(\d+)')
pattern = re.compile(r'(chr\S+):(\d+)')
matches = pattern.findall(str(row['ALT']))
chromosome_2 = str(matches[0][0])
position_2 = int(matches[0][1])
Expand Down
2 changes: 1 addition & 1 deletion python/vstolib/vcf/sniffles2.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def parse_sniffles2_callset(

# Update position_2 for 'BND'
if variant_type == VariantTypes.BREAKPOINT or variant_type == VariantTypes.TRANSLOCATION:
pattern = re.compile(r'(chr(?:\d+|X|Y|MT|M)):(\d+)')
pattern = re.compile(r'(chr\S+):(\d+)')
matches = pattern.findall(str(row['ALT']))
position_2 = int(matches[0][1])

Expand Down
20 changes: 6 additions & 14 deletions python/vstolib/vcf/svim.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


import pandas as pd
import re
from collections import OrderedDict
from typing import Dict
from ..constants import NucleicAcidTypes, VariantCallingMethods, VariantTypes
Expand Down Expand Up @@ -136,21 +137,12 @@ def parse_svim_callset(
if 'READS' in attributes.keys():
alternate_allele_read_ids = attributes['READS'].split(',')

# Update chromosome_2 for 'BND'
# Update chromosome_2 and position_2 for 'BND' or 'TRA'
if variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]:
alt_val = alternate_allele.split(":")[0]
alt_val = alt_val.replace("[", "")
alt_val = alt_val.replace("]", "")
alt_val = alt_val.replace("N", "")
chromosome_2 = str(alt_val)

# Update position_2 for 'BND'
if variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]:
alt_val = alternate_allele.split(":")[1]
alt_val = alt_val.replace("[", "")
alt_val = alt_val.replace("]", "")
alt_val = alt_val.replace("N", "")
position_2 = int(alt_val)
pattern = re.compile(r'(chr\S+):(\d+)')
matches = pattern.findall(str(row['ALT']))
chromosome_2 = str(matches[0][0])
position_2 = int(matches[0][1])

# Update variant_size 'BND'
if (variant_type in [VariantTypes.BREAKPOINT, VariantTypes.TRANSLOCATION]) and \
Expand Down

0 comments on commit 038def0

Please sign in to comment.