-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from kylebittinger/add-min-length
Add min length command-line option
- Loading branch information
Showing
11 changed files
with
117 additions
and
51,505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
19,700 changes: 0 additions & 19,700 deletions
19,700
tests/data/no_primer_Sub10003.V1.sputum.redo_1mm_R1.fastq
This file was deleted.
Oops, something went wrong.
5,055 changes: 0 additions & 5,055 deletions
5,055
tests/data/no_primer_Sub10003.V1.sputum.redo_1mm_R1.log
This file was deleted.
Oops, something went wrong.
20,216 changes: 0 additions & 20,216 deletions
20,216
tests/data/no_primer_Sub10003.V1.sputum.redo_R2.fastq
This file was deleted.
Oops, something went wrong.
5,054 changes: 0 additions & 5,054 deletions
5,054
tests/data/no_primer_Sub10003.V1.sputum.redo_R2.log
This file was deleted.
Oops, something went wrong.
1,432 changes: 0 additions & 1,432 deletions
1,432
...o_primer_Sub10003.V1.sputum.redo_R1.fastq → tests/data/trimmed_example.fastq
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from primertrim.trimmable_reads import TrimmableReads | ||
from primertrim.matcher import PrimerMatch | ||
|
||
|
||
read1 = ("seq1", "ATGTCATGACTTGACTGCGG", "FFFFFFFFFFFFFFFFFFFF") | ||
read2 = ("seq2", "AGTCACGCTGACTGCATTGA", "FFFFFFFFFFFFFFFFFFFF") | ||
read3 = ("seq3", "TACGTCATGCATCGTAGTAA", "FFFFFFFFFFFFFFFFFFFF") | ||
|
||
seq1 = ("seq1", "ATGTCATGACTTGACTGCGG") | ||
seq2 = ("seq2", "AGTCACGCTGACTGCATTGA") | ||
seq3 = ("seq3", "TACGTCATGCATCGTAGTAA") | ||
|
||
log1 = ("seq1", "No match", 20, None, None) | ||
log2 = ("seq2", "No match", 20, None, None) | ||
log3 = ("seq3", "No match", 20, None, None) | ||
|
||
read2_trim10 = ("seq2", "AGTCACGCTG", "FFFFFFFFFF") | ||
log2_trim10 = ("seq2", "Complete", 10, 0, "ACTGCATTGA") | ||
read2_trim0 = ("seq2", "", "") | ||
|
||
|
||
def test_register_match(): | ||
t = TrimmableReads([read1, read2, read3]) | ||
|
||
assert list(t.get_unmatched_seqs()) == [seq1, seq2, seq3] | ||
|
||
m = PrimerMatch("Complete", 10, 0, "ACTGCATTGA") | ||
t.register_match("seq2", m) | ||
|
||
assert list(t.get_unmatched_seqs()) == [seq1, seq3] | ||
|
||
|
||
def test_output(): | ||
t = TrimmableReads([read1, read2, read3]) | ||
|
||
assert list(t.output_reads()) == [read1, read2, read3] | ||
|
||
m = PrimerMatch("Complete", 10, 0, "ACTGCATTGA") | ||
t.register_match("seq2", m) | ||
|
||
assert list(t.output_reads()) == [read1, read2_trim10, read3] | ||
assert list(t.output_loginfo()) == [log1, log2_trim10, log3] | ||
|
||
|
||
def test_output_min_length(): | ||
t = TrimmableReads([read1, read2, read3]) | ||
m = PrimerMatch("Complete", 10, 0, "ACTGCATTGA") | ||
t.register_match("seq2", m) | ||
|
||
# All reads written out | ||
assert list(t.output_reads(min_length=0)) == [read1, read2_trim10, read3] | ||
# Removes read2 | ||
assert list(t.output_reads(min_length=15)) == [read1, read3] | ||
# No reads are long enough | ||
assert list(t.output_reads(min_length=30)) == [] | ||
|
||
|
||
def test_output_zero_length(): | ||
t = TrimmableReads([read1, read2, read3]) | ||
m = PrimerMatch("Complete", 0, 0, "ACTGCATTGA") | ||
t.register_match("seq2", m) | ||
|
||
# All reads written out | ||
assert list(t.output_reads(min_length=0)) == [read1, read2_trim0, read3] | ||
# Negative min_length writes out all reads | ||
assert list(t.output_reads(min_length=-5)) == [read1, read2_trim0, read3] | ||
# Removes read2 | ||
assert list(t.output_reads(min_length=1)) == [read1, read3] |