def test_demultiplex():
	multiout = os.path.join(os.path.dirname(__file__), 'data', 'tmp-demulti.{name}.fasta')
	params = ['-a', 'first=AATTTCAGGAATT', '-a', 'second=GTTCTCTAGTTCT', '-o', multiout, datapath('twoadapters.fasta')]
	assert cutadapt.main(params) is None
	assert files_equal(cutpath('twoadapters.first.fasta'), multiout.format(name='first'))
	assert files_equal(cutpath('twoadapters.second.fasta'), multiout.format(name='second'))
	assert files_equal(cutpath('twoadapters.unknown.fasta'), multiout.format(name='unknown'))
	os.remove(multiout.format(name='first'))
	os.remove(multiout.format(name='second'))
	os.remove(multiout.format(name='unknown'))
Beispiel #2
0
def test_info_file():
    with temporary_path("infotmp.txt") as infotmp:
        run([
            "--info-file", infotmp, '-a',
            'adapt=GCCGAACTTCTTAGACTGCCTTAAGGACGT'
        ], "illumina.fastq", "illumina.fastq.gz")
        assert files_equal(cutpath('illumina.info.txt'), infotmp)
Beispiel #3
0
def test_paired_end_legacy():
    '''--paired-output, no -A/-B/-G'''
    with temporary_path("paired-tmp.fastq") as pairedtmp:
        # the -m 14 filters out one read, which should then also be filtered out in the second output file
        run(['-a', 'TTAGACATAT', '-m', '14', '--paired-output', pairedtmp],
            'paired.m14.1.fastq', 'paired.1.fastq', 'paired.2.fastq')
        assert files_equal(cutpath('paired.m14.2.fastq'), pairedtmp)
Beispiel #4
0
def test_too_short_no_primer():
    '''--too-short-output and --trim-primer'''
    run(
        "-c -m 5 -a 330201030313112312 --trim-primer --too-short-output tooshort.tmp.fa",
        "minlen.noprimer.fa", "lengths.fa")
    assert files_equal(datapath('tooshort.noprimer.fa'), "tooshort.tmp.fa")
    os.remove('tooshort.tmp.fa')
def test_untrimmed_paired_output():
	with temporary_path("tmp-paired.1.fastq") as tmp1:
		with temporary_path("tmp-paired.2.fastq") as tmp2:
			with temporary_path("tmp-untrimmed.1.fastq") as untrimmed1:
				with temporary_path("tmp-untrimmed.2.fastq") as untrimmed2:
					params = [
						'-a', 'TTAGACATAT',
						'-o', tmp1, '-p', tmp2,
						'--untrimmed-output', untrimmed1,
						'--untrimmed-paired-output', untrimmed2, 
						datapath('paired.1.fastq'), datapath('paired.2.fastq')
					]
					assert cutadapt.main(params) is None
					assert files_equal(cutpath('paired-untrimmed.1.fastq'), untrimmed1)
					assert files_equal(cutpath('paired-untrimmed.2.fastq'), untrimmed2)
					assert files_equal(cutpath('paired-trimmed.1.fastq'), tmp1)
					assert files_equal(cutpath('paired-trimmed.2.fastq'), tmp2)
Beispiel #6
0
def test_demultiplex():
    multiout = os.path.join(os.path.dirname(__file__), 'data',
                            'tmp-demulti.{name}.fasta')
    params = [
        '-a', 'first=AATTTCAGGAATT', '-a', 'second=GTTCTCTAGTTCT', '-o',
        multiout,
        datapath('twoadapters.fasta')
    ]
    assert cutadapt.main(params) is None
    assert files_equal(cutpath('twoadapters.first.fasta'),
                       multiout.format(name='first'))
    assert files_equal(cutpath('twoadapters.second.fasta'),
                       multiout.format(name='second'))
    assert files_equal(cutpath('twoadapters.unknown.fasta'),
                       multiout.format(name='unknown'))
    os.remove(multiout.format(name='first'))
    os.remove(multiout.format(name='second'))
    os.remove(multiout.format(name='unknown'))
Beispiel #7
0
def test_untrimmed_paired_output():
    with temporary_path("tmp-paired.1.fastq") as tmp1:
        with temporary_path("tmp-paired.2.fastq") as tmp2:
            with temporary_path("tmp-untrimmed.1.fastq") as untrimmed1:
                with temporary_path("tmp-untrimmed.2.fastq") as untrimmed2:
                    params = [
                        '-a', 'TTAGACATAT', '-o', tmp1, '-p', tmp2,
                        '--untrimmed-output', untrimmed1,
                        '--untrimmed-paired-output', untrimmed2,
                        datapath('paired.1.fastq'),
                        datapath('paired.2.fastq')
                    ]
                    assert cutadapt.main(params) is None
                    assert files_equal(cutpath('paired-untrimmed.1.fastq'),
                                       untrimmed1)
                    assert files_equal(cutpath('paired-untrimmed.2.fastq'),
                                       untrimmed2)
                    assert files_equal(cutpath('paired-trimmed.1.fastq'), tmp1)
                    assert files_equal(cutpath('paired-trimmed.2.fastq'), tmp2)
def test_too_long():
	'''--too-long-output'''
	run("-c -M 5 --too-long-output toolong.tmp.fa -a 330201030313112312", "maxlen.fa", "lengths.fa")
	assert files_equal(datapath('toolong.fa'), "toolong.tmp.fa")
	os.remove('toolong.tmp.fa')
Beispiel #9
0
def test_explicit_format_with_paired():
    with temporary_path("paired-tmp.fastq") as pairedtmp:
        run([
            '--format=fastq', '-a', 'TTAGACATAT', '-m', '14', '-p', pairedtmp
        ], 'paired.m14.1.fastq', 'paired.1.txt', 'paired.2.txt')
        assert files_equal(cutpath('paired.m14.2.fastq'), pairedtmp)
Beispiel #10
0
def test_restfront():
    with temporary_path("rest.txt") as path:
        run(['-g', 'ADAPTER', '-N', '-r', path], "restfront.fa", "rest.fa")
        assert files_equal(datapath('restfront.txt'), path)
Beispiel #11
0
def test_untrimmed_output():
    with temporary_path('untrimmed.tmp.fastq') as tmp:
        run(['-a', 'TTAGACATATCTCCGTCG', '--untrimmed-output', tmp],
            'small.trimmed.fastq', 'small.fastq')
        assert files_equal(cutpath('small.untrimmed.fastq'), tmp)
Beispiel #12
0
def test_rest():
    '''-r/--rest-file'''
    with temporary_path('rest.tmp') as rest_tmp:
        run(['-b', 'ADAPTER', '-N', '-r', rest_tmp], "rest.fa", "rest.fa")
        assert files_equal(datapath('rest.txt'), rest_tmp)
def test_paired_end_legacy():
	'''--paired-output, no -A/-B/-G'''
	with temporary_path("paired-tmp.fastq") as pairedtmp:
		# the -m 14 filters out one read, which should then also be filtered out in the second output file
		run(['-a', 'TTAGACATAT', '-m', '14', '--paired-output', pairedtmp], 'paired.m14.1.fastq', 'paired.1.fastq', 'paired.2.fastq')
		assert files_equal(cutpath('paired.m14.2.fastq'), pairedtmp)
def test_rest():
	'''-r/--rest-file'''
	with temporary_path('rest.tmp') as rest_tmp:
		run(['-b', 'ADAPTER', '-N', '-r', rest_tmp], "rest.fa", "rest.fa")
		assert files_equal(datapath('rest.txt'), rest_tmp)
def test_untrimmed_output():
	with temporary_path('untrimmed.tmp.fastq') as tmp:
		run(['-a', 'TTAGACATATCTCCGTCG', '--untrimmed-output', tmp], 'small.trimmed.fastq', 'small.fastq')
		assert files_equal(cutpath('small.untrimmed.fastq'), tmp)
Beispiel #16
0
def test_too_short():
    '''--too-short-output'''
    run("-c -m 5 -a 330201030313112312 --too-short-output tooshort.tmp.fa",
        "minlen.fa", "lengths.fa")
    assert files_equal(datapath('tooshort.fa'), "tooshort.tmp.fa")
    os.remove('tooshort.tmp.fa')
def test_too_short_no_primer():
	'''--too-short-output and --trim-primer'''
	run("-c -m 5 -a 330201030313112312 --trim-primer --too-short-output tooshort.tmp.fa", "minlen.noprimer.fa", "lengths.fa")
	assert files_equal(datapath('tooshort.noprimer.fa'), "tooshort.tmp.fa")
	os.remove('tooshort.tmp.fa')
def test_too_short():
	'''--too-short-output'''
	run("-c -m 5 -a 330201030313112312 --too-short-output tooshort.tmp.fa", "minlen.fa", "lengths.fa")
	assert files_equal(datapath('tooshort.fa'), "tooshort.tmp.fa")
	os.remove('tooshort.tmp.fa')
def test_restfront():
	with temporary_path("rest.txt") as path:
		run(['-g', 'ADAPTER', '-N', '-r', path], "restfront.fa", "rest.fa")
		assert files_equal(datapath('restfront.txt'), path)
def test_explicit_format_with_paired():
	with temporary_path("paired-tmp.fastq") as pairedtmp:
		run(['--format=fastq', '-a', 'TTAGACATAT', '-m', '14', '-p', pairedtmp], 'paired.m14.1.fastq', 'paired.1.txt', 'paired.2.txt')
		assert files_equal(cutpath('paired.m14.2.fastq'), pairedtmp)
Beispiel #21
0
def test_too_long():
    '''--too-long-output'''
    run("-c -M 5 --too-long-output toolong.tmp.fa -a 330201030313112312",
        "maxlen.fa", "lengths.fa")
    assert files_equal(datapath('toolong.fa'), "toolong.tmp.fa")
    os.remove('toolong.tmp.fa')
def test_info_file():
	with temporary_path("infotmp.txt") as infotmp:
		run(["--info-file", infotmp, '-a', 'adapt=GCCGAACTTCTTAGACTGCCTTAAGGACGT'], "illumina.fastq", "illumina.fastq.gz")
		assert files_equal(cutpath('illumina.info.txt'), infotmp)