Skip to content

Commit

Permalink
Change order of primer trimming steps for #530.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Jun 2, 2020
1 parent bacac0c commit 2c51f0f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
14 changes: 7 additions & 7 deletions micall/core/trim_fastqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def cut_all(censored_fastq1: Path,
for filename in (censored_fastq1, censored_fastq2)]
ltrimmed_filenames = [Path(str(filename) + '.ltrimmed.fastq')
for filename in (censored_fastq1, censored_fastq2)]
rtrimmed_filenames = [Path(str(filename) + '.rtrimmed.fastq')
dtrimmed_filenames = [Path(str(filename) + '.dtrimmed.fastq')
for filename in (censored_fastq1, censored_fastq2)]
if TrimSteps.adapters in skip:
dedapted_filenames[0].symlink_to(censored_fastq1)
Expand All @@ -126,17 +126,17 @@ def cut_all(censored_fastq1: Path,
dedapted_filenames[1],
ltrimmed_filenames[0],
ltrimmed_filenames[1])
cut_right_primers(ltrimmed_filenames[0],
cut_primer_dimers(ltrimmed_filenames[0],
ltrimmed_filenames[1],
rtrimmed_filenames[0],
rtrimmed_filenames[1])
cut_primer_dimers(rtrimmed_filenames[0],
rtrimmed_filenames[1],
dtrimmed_filenames[0],
dtrimmed_filenames[1])
cut_right_primers(dtrimmed_filenames[0],
dtrimmed_filenames[1],
Path(trimmed_fastq1),
Path(trimmed_fastq2))
purge_temp_files(dedapted_filenames)
purge_temp_files(ltrimmed_filenames)
purge_temp_files(rtrimmed_filenames)
purge_temp_files(dtrimmed_filenames)


def purge_temp_files(filenames):
Expand Down
12 changes: 12 additions & 0 deletions micall/tests/test_trim_fastqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,18 @@ def test_trim(tmpdir):
# Trimmed to nothing
'',
# Trimmed to nothing
),
('primer dimer with partial right match',
'TGGCTATTGATTATAAACACTACACACCCTGCACAAGAAAAGAACTTCACCTGTCTCTTATACACATCTCCGAGCCCACGAGACACTACCTGGAA',
# nCoV-2019_21_LEFT ] [ rev(ADAPTER2) ][ garbage ]
# [ rev(..._81_RIGHT) ] last 5 of 81_RIGHT match start of HCV_Pr3
'GTGAAGTTCTTTTCTTGTGCAGGGTGTGTAGTGTTTATAATCAATAGCCACTGTCTCTTATACACATCTGACGCTGCCGACGAAGGTTCTCAGGA',
# nCoV-2019_81_RIGHT ] [ rev(ADAPTER1) ][ garbage
# [ rev(nCoV-2019_21_LEFT) ]
'',
# Trimmed to nothing
'',
# Trimmed to nothing
)
])
def test_cut_adapters(tmpdir: str,
Expand Down

0 comments on commit 2c51f0f

Please sign in to comment.