Skip to content

Commit

Permalink
Decrease too long min. overlap to adapter length
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Jun 17, 2024
1 parent 8a54b7a commit d6e2cbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 7 additions & 5 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ development version

* Added ``--action=crop`` for removing everything *except* the adapter sequence.
(The sequence before and after the adapter is removed.) This can be useful if the
"adapter" contains wildcards (such as ``N`` nucleotides) that you are interested
in.
"adapter" contains wildcards (such as ``N``) that you are interested in.
* :issue:`788`: Added option ``-L`` as a counterpart to ``-l``/``--length``,
which allows shortening R1 and R2 to different lengths.
* :issue:`784`: Fix some unexpected trimming results for anchored 5'
* A too long minimum overlap is now automatically decreased to the length of
the adapter. That is, you can use ``-a 'ACGT;o=99'`` to force full-length
matches.
* :issue:`784`: Fixed some unexpected trimming results for anchored 5'
adapters (due to an incorrectly initialized alignment score matrix).

v4.8 (2024-04-12)
-------------------

* :issue:`772`: Restore ability to provide input files via
* :issue:`772`: Restored ability to provide input files via
process substitution.
* :issue:`773`: Fix crash when writing interleaved data to stdout
* :issue:`773`: Fixed crash when writing interleaved data to stdout
(that is, when no ``-o`` option is provided).

v4.7 (2024-03-14)
Expand Down
5 changes: 1 addition & 4 deletions src/cutadapt/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,7 @@ def parse(cls, spec: str, adapter_type: str) -> "AdapterSpecification":
)

if parameters.get("min_overlap", 0) > len(spec):
raise ValueError(
f"min_overlap={parameters['min_overlap']}"
f" exceeds length of adapter {spec}"
)
parameters["min_overlap"] = len(spec)

if rightmost and (adapter_type != "front" or restriction is not None):
raise ValueError("'rightmost' only allowed with regular 5' adapters")
Expand Down
7 changes: 4 additions & 3 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,10 @@ def test_make_adapter_back():
make_adapter("ACGT$;min_overlap=3", "back", parameters)
assert "not possible" in e.value.args[0]

with pytest.raises(ValueError) as e:
make_adapter("ACGT;min_overlap=5", "back", parameters)
assert "exceeds" in e.value.args[0]

def test_make_adapter_very_long_overlap():
a = make_adapter("ACGT;min_overlap=99", "back", {"min_overlap": 1})
assert a.min_overlap == 4


def test_parse_file_notation_with_parameters(tmp_path):
Expand Down

0 comments on commit d6e2cbd

Please sign in to comment.