Skip to content

Commit

Permalink
Fix for #42
Browse files Browse the repository at this point in the history
  • Loading branch information
jdidion committed Oct 16, 2017
1 parent 6d4c2aa commit 95b83d1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ A [preprint](https://peerj.com/preprints/2452/) is available and the submitted p
* Consider supporting different error rates for read1 vs read2.
* Add a ClipOverlapping modifier that will remove read overlaps (as opposed to merging).
* Add option to InsertAdapter to trim overhangs without adapter matching.
* Look more closely at providing solutions to the Illumina two-color chemistry issue:
* Provide and option to exempt G calls from the assessment of quality
* Trim 3′ Gs from reads

### 1.6

Expand Down
3 changes: 1 addition & 2 deletions atropos/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ def random_match_probabilities(self):
for idx, base in enumerate(seq, 1):
cur_p *= base_probs[0 if base in c_bases else 1]
probabilities[idx] = cur_p

return probabilities

def summarize(self):
Expand All @@ -484,7 +483,7 @@ def summarize(self):
total_front=total_front,
total_back=total_back,
total=total_front + total_back,
match_probabilities=self.random_match_probabilities())
match_probabilities=Const(self.random_match_probabilities()))

where = self.where
assert (
Expand Down
1 change: 1 addition & 0 deletions atropos/align/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def get_info_record(self):
# 8. https://github.com/yamada-kd/nepal
# 9. The SeqAn C++ library implements several alignment algorithms:
# http://www.sciencedirect.com/science/article/pii/S0168165617315420
# 10. Could we treat paired end read + adapter alignment as an MSA problem?

class InsertAligner(object):
"""Implementation of an insert matching algorithm.
Expand Down
1 change: 1 addition & 0 deletions atropos/commands/detect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# ntCard https://github.com/bcgsc/ntCard
# https://github.com/TGAC/KAT
# https://arxiv.org/pdf/1707.01743.pdf
# https://github.com/splatlab/squeakr

# TODO: In KnownContaminantDetector, accept template sequences with wildcards
# to match against.
Expand Down
15 changes: 14 additions & 1 deletion tests/test_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def test_insert_align():
assert match1.length == 10
assert match2.rstart == 20
assert match2.length == 10

def test_short_adapter_overlap():
a1_seq = 'TTAGACATAT'
a2_seq = 'CAGTGGAGTA'
Expand All @@ -165,6 +165,19 @@ def test_short_adapter_overlap():
assert match2.rstart == 28
assert match2.length == 2

def test_insert_align_different_lengths():
# Test for #51. This is the alignment:
# TTAGGCTATGGCTTCTCGGGTTGAGGCTACAAGTTTTGGACCCTCCAGAGCAAAGCAGGTCTCTTTGACATCAGCTGCACAGCACTTGTCTACAAAAGCTGCAAA
# AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT
# ATAGGCTATGGCTTCTCGAGTTGAAGCTACAAGTTTTGGACCCTCCAGAGCAAAGCAGGTCTCTTTGACATCAGCTGCACAGCACTTGTCTACAAAAGCTGCAAAAGATCGGAAGAGCGTCTCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGACGTATCATTAAAAAAAAAAACACATCACATCAACAAGATAACACGACTTCTCCATCCACAGTACCGATGACCTCAACATTAGT
#
# The inserts should align even though there is a gap at the 5' end of read1.
a1_seq = 'AGATCGGAAGAGCACACGTCTGAACTCCAGTCACACAGTGATCTCGTATGCCGTCTTCTGCTTG'
a2_seq = 'AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT'
seq1 = 'TTTGCAGCTTTTGTAGACAAGTGCTGTGCAGCTGATGTCAAAGAGACCTGCTTTGCTCTGGAGGGTCCAAAACTTGTAGCCTCAACCCGAGAAGCCATAGCCTAA'
seq2 = 'ATAGGCTATGGCTTCTCGAGTTGAAGCTACAAGTTTTGGACCCTCCAGAGCAAAGCAGGTCTCTTTGACATCAGCTGCACAGCACTTGTCTACAAAAGCTGCAAAAGATCGGAAGAGCGTCTCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGACGTATCATTAAAAAAAAAAACACATCACATCAACAAGATAACACGACTTCTCCATCCACAGTACCGATGACCTCAACATTAGT'


def test_multi_aligner_no_mismatches():
from atropos.align._align import MultiAligner
a = MultiAligner(max_error_rate=0, min_overlap=3)
Expand Down

0 comments on commit 95b83d1

Please sign in to comment.