Skip to content

Commit

Permalink
modify bugs for singe breakend functions
Browse files Browse the repository at this point in the history
  • Loading branch information
friend1ws committed Mar 8, 2021
1 parent 020ed8f commit 5eac94b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nanomonsv/cluster_sbnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def cluster_supporting_reads_sbnd(input_file, output_file, control_bed = None,
for line in hin:

tchr, _, tpos, treadid, _, tdir, tinfo = line.rstrip('\n').split('\t')
tstart = int(tpos) - sbnd_cluster_margin_size
tstart = max(int(tpos) - sbnd_cluster_margin_size, 0)
tend = int(tpos) + sbnd_cluster_margin_size

# skip single breakend from secondary alignment
Expand Down
6 changes: 6 additions & 0 deletions nanomonsv/locate_bp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ def get_refined_bp(contig, fasta_file_ins, chr1, start1, end1, dir1, chr2, start

if mode != "i":

ref_len1 = fasta_file_ins.get_reference_length(chr1)
ref_len2 = fasta_file_ins.get_reference_length(chr2)

bstart1, bend1 = max(int(start1) - rd_margin, 1), int(end1) + rd_margin
bstart2, bend2 = max(int(start2) - rd_margin, 1), int(end2) + rd_margin

if ref_len1 < bend1: bend1 = ref_len1
if ref_len2 < bend2: bend2 = ref_len2

region1_seq = fasta_file_ins.fetch(chr1, bstart1 - 1, bend1)
region2_seq = fasta_file_ins.fetch(chr2, bstart2 - 1, bend2)

Expand Down
8 changes: 6 additions & 2 deletions nanomonsv/locate_bp_sbnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ def get_refined_bp_sbnd(tconsensus, fasta_file_h, tchr, tstart, tend, tdir, hout

tconsensus_part = tconsensus[:1000] if len(tconsensus) > 1000 else tconsensus

ref_len = fasta_file_h.get_reference_length(tchr)
if tstart < 1: tstart = 1
if ref_len < tend: tend = ref_len

if tdir == '+':
qseq = fasta_file_h.fetch(tchr, int(tstart) - margin, int(tend))
qseq = fasta_file_h.fetch(tchr, max(int(tstart) - margin, 0), int(tend))
else:
qseq = fasta_file_h.fetch(tchr, int(tstart), int(tend) + margin)
qseq = fasta_file_h.fetch(tchr, max(int(tstart) - 1, 0), int(tend) + margin)
qseq = reverse_complement(qseq)

user_matrix = parasail.matrix_create("ACGT", 1, -2)
Expand Down

0 comments on commit 5eac94b

Please sign in to comment.