How to use the cutadapt.modifiers.UnconditionalCutter function in cutadapt

To help you get started, we’ve selected a few cutadapt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marcelm / cutadapt / tests / test_modifiers.py View on Github external
def test_unconditional_cutter():
    UnconditionalCutter(length=5)
    s = 'abcdefg'
    assert UnconditionalCutter(length=2)(s, []) == 'cdefg'
    assert UnconditionalCutter(length=-2)(s, []) == 'abcde'
    assert UnconditionalCutter(length=100)(s, []) == ''
    assert UnconditionalCutter(length=-100)(s, []) == ''
github marcelm / cutadapt / src / cutadapt / __main__.py View on Github external
if len(cut_arg) == 2 and cut_arg[0] * cut_arg[1] > 0:
            raise CommandLineError("You cannot remove bases from the same end twice.")
        for c in cut_arg:
            if c == 0:
                continue
            if i == 0:  # R1
                if paired:
                    assert isinstance(pipeline, PairedEndPipeline)
                    pipeline.add(UnconditionalCutter(c), None)
                else:
                    assert isinstance(pipeline, SingleEndPipeline)
                    pipeline.add(UnconditionalCutter(c))
            else:
                # R2
                assert isinstance(pipeline, PairedEndPipeline)
                pipeline.add(None, UnconditionalCutter(c))
github marcelm / cutadapt / src / cutadapt / __main__.py View on Github external
if not cut_arg:
            continue
        if len(cut_arg) > 2:
            raise CommandLineError("You cannot remove bases from more than two ends.")
        if len(cut_arg) == 2 and cut_arg[0] * cut_arg[1] > 0:
            raise CommandLineError("You cannot remove bases from the same end twice.")
        for c in cut_arg:
            if c == 0:
                continue
            if i == 0:  # R1
                if paired:
                    assert isinstance(pipeline, PairedEndPipeline)
                    pipeline.add(UnconditionalCutter(c), None)
                else:
                    assert isinstance(pipeline, SingleEndPipeline)
                    pipeline.add(UnconditionalCutter(c))
            else:
                # R2
                assert isinstance(pipeline, PairedEndPipeline)
                pipeline.add(None, UnconditionalCutter(c))
github mhalushka / miRge / src / mirge / utils / trim_file.py View on Github external
def __init__(self, queue=None, results=None, adapter=None, phred64=False):
		super(Worker, self).__init__()
		self.queue=queue
		self.results = results
		self.phred = 64 if phred64 else 33
		self.modifiers = [QualityTrimmer(0, 10, self.phred)]
		self.adapters = []
		self.error_rate = 0.12
		self.min_length = 16
		if adapter.startswith('+'):
			self.modifiers.append(UnconditionalCutter(int(adapter)))
		elif adapter == 'none':
			self.adapter = None
		else:
			self.adapters = parse_adapters(adapter, error_rate=self.error_rate)
			adapter_cutter = AdapterCutter(self.adapters)
			self.modifiers.append(adapter_cutter)