Skip to content

Commit

Permalink
Merge pull request #19 from bcgsc/release/v1.5.1
Browse files Browse the repository at this point in the history
Release v1.5.1: Summary split read call fix
  • Loading branch information
creisle authored Jan 3, 2018
2 parents 025985c + b763f86 commit 0218368
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mavis/cluster/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'max_proximity', 5000,
defn='the maximum distance away from an annotation before the region in considered to be uninformative')
DEFAULTS.add(
'uninformative_filter', True,
'uninformative_filter', False,
defn='flag that determines if breakpoint pairs which are not within max_proximity to any annotations are filtered '
'out prior to clustering')
DEFAULTS.add(
Expand Down
3 changes: 2 additions & 1 deletion mavis/pairing/pairing.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def pair_by_distance(calls, distances, log=devnull, against_self=False):
comparisons = 0
for i in range(0, len(break1_sorted)):
current = break1_sorted[i]
distance_pairings.setdefault(product_key(current), set())
for j in range(i + 1, len(break1_sorted)):
other = break1_sorted[j]

Expand All @@ -175,7 +176,7 @@ def pair_by_distance(calls, distances, log=devnull, against_self=False):
if not against_self and current.library == other.library and current.protocol == other.protocol:
continue # do not pair within a single library
if equivalent(current, other, distances=distances):
distance_pairings.setdefault(product_key(current), set()).add(product_key(other))
distance_pairings[product_key(current)].add(product_key(other))
distance_pairings.setdefault(product_key(other), set()).add(product_key(current))
current = break2_sorted[i]
for j in range(i + 1, len(break2_sorted)):
Expand Down
5 changes: 5 additions & 0 deletions mavis/summary/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def main(
COLUMNS.protein_synon,
COLUMNS.cdna_synon,
COLUMNS.net_size,
COLUMNS.tracking_id,
'dgv',
'summary_pairing']
}, COLUMNS.call_method: CALL_METHOD.INPUT},
Expand Down Expand Up @@ -255,6 +256,10 @@ def main(
annotate_dgv(bpps_by_library[lib], dgv_annotation, distance=10) # TODO make distance a parameter
log('adding pairing states for', lib)
for row in bpps_by_library[lib]:
# in case no pairing was done, add default (applicable to single library summaries)
row.data.setdefault(COLUMNS.inferred_pairing, '')
row.data.setdefault(COLUMNS.pairing, '')
row.data.setdefault(COLUMNS.library, lib)
# filter pairing ids based on what is still kept?
paired_libraries = set([p.split('_')[0] for p in row.pairing.split(';')])
inferred_paired_libraries = set([p.split('_')[0] for p in row.inferred_pairing.split(';')])
Expand Down
11 changes: 6 additions & 5 deletions mavis/summary/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def group_events(events):
COLUMNS.spanning_reads, COLUMNS.flanking_pairs, COLUMNS.tools,
COLUMNS.product_id, COLUMNS.event_type, COLUMNS.annotation_id,
COLUMNS.pairing, COLUMNS.annotation_figure,
COLUMNS.contig_remapped_reads, COLUMNS.tools
COLUMNS.contig_remapped_reads, COLUMNS.tools,
COLUMNS.tracking_id
]:
new_data = sorted(list({bpp.data[col] for bpp in events}))
new_bpp.data[col] = new_data[0] if len(new_data) == 1 else ';'.join([str(v) for v in new_data])
Expand All @@ -131,7 +132,7 @@ def group_by_distance(calls, distances):
grouped_calls = []
for component in get_connected_components(pairing):
if len(component) == 1:
grouped_calls.append(mapping[component.pop()])
grouped_calls.extend(mapping[component.pop()])
else:
pairs = []
for key in component:
Expand Down Expand Up @@ -239,15 +240,15 @@ def filter_by_evidence(
bpp.break2_split_reads < filter_min_split_reads,
all([
bpp.event_type != SVTYPE.INS,
bpp.break2_split_reads_forced + bpp.break1_split_reads_forced < filter_min_linking_split_reads
bpp.linking_split_reads < filter_min_linking_split_reads
]),
all([
bpp.event_type == SVTYPE.INS,
bpp.flanking_pairs < filter_min_linking_split_reads,
bpp.break2_split_reads_forced + bpp.break1_split_reads_forced < filter_min_linking_split_reads
]),
bpp.break1_split_reads + bpp.break2_split_reads -
(bpp.break2_split_reads_forced + bpp.break1_split_reads_forced) < 1
bpp.break1_split_reads - bpp.break1_split_reads_forced < 1,
bpp.break2_split_reads - bpp.break2_split_reads_forced < 1
]):
removed.append(bpp)
continue
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def check_nonpython_dependencies():

setup(
name='mavis',
version='1.5.0',
version='1.5.1',
url='https://github.com/bcgsc/mavis.git',
packages=find_packages(),
install_requires=[
Expand Down

0 comments on commit 0218368

Please sign in to comment.