Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mutscan
Title: Preprocessing and Analysis of Deep Mutational Scanning Data
Version: 0.3.2
Version: 0.3.3
Authors@R:
c(person(given = "Charlotte",
family = "Soneson",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# mutscan 0.3.3

* Bugfix in mergeReadPairPartial for situation where specified minMergedLength/maxMergedLength is larger than the total length of the two merged sequences

# mutscan 0.3.1

* Adapt summarizeExperiment to include errorStatistics in metadata(se)
Expand Down
6 changes: 6 additions & 0 deletions src/digestFastqs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,9 @@ bool mergeReadPairPartial(std::string &varSeqForward, std::vector<int> &varIntQu
if (maxMergedLength == 0) {
maxMergedLength = lenF + lenR;
}
if (maxMergedLength > lenF + lenR) {
maxMergedLength = lenF + lenR;
}
// if maxMergedLength is specified, adjust allowed minOverlap
if (minOverlap < (lenF + lenR - maxMergedLength)) {
minOverlap = (lenF + lenR - maxMergedLength);
Expand All @@ -851,6 +854,9 @@ bool mergeReadPairPartial(std::string &varSeqForward, std::vector<int> &varIntQu
minMergedLength = lenR;
}
}
if (minMergedLength > lenF + lenR) {
return true; // no valid overlap possible
}
// if minMergedLength is specified, adjust allowed maxOverlap
if (maxOverlap > (lenF + lenR - minMergedLength)) {
maxOverlap = (lenF + lenR - minMergedLength);
Expand Down
17 changes: 16 additions & 1 deletion tests/testthat/test_digestFastqs_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,22 @@ test_that("mergeReadPairsPartial works", {
expect_identical(res0d$mergedQual, qF2)
expect_identical(res0d$mergedLengths, 7L)
expect_true(res0d$return)


## minMergedLength > lenF + lenR -> no valid overlap
res0e <- mutscan:::test_mergeReadPairPartial(sF2, qF2, sR2, qR2, lF2, lR2, 1, 7, 15, 9, 1, FALSE)
expect_type(res0e, "list")
expect_identical(res0e$mergedSeq, sF2)
expect_identical(res0e$mergedQual, qF2)
expect_identical(res0e$mergedLengths, 7L)
expect_true(res0e$return)
## maxMergedLength > lenF + lenR -> maxMergedLength = lenF + lenR
res0f <- mutscan:::test_mergeReadPairPartial(sF0, qF0, sR0, qR0, lF0, lR0, 1, 0, 5, 19, 1, FALSE)
expect_type(res0f, "list")
expect_identical(res0f$mergedSeq, sF0)
expect_identical(res0f$mergedQual, rep(c(10L, 40L), c(2, 5)))
expect_identical(res0f$mergedLengths, 7L)
expect_false(res0f$return)

## padded reads
for (i in 1:10) {
sF <- paste(rep(c("C","A"), c(i, 6)), collapse = "")
Expand Down
Loading