-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse barcodes from read IDs in demultiplexed mode (#26)
- Loading branch information
Showing
10 changed files
with
135 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/scala/org/broadinstitute/gpp/poolq3/barcode/Dmuxed.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2022 The Broad Institute, Inc. All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
package org.broadinstitute.gpp.poolq3.barcode | ||
|
||
object Dmuxed { | ||
|
||
private[barcode] def barcodeFromId(length: Int): String => Option[FoundBarcode] = { | ||
val regex = s"@.*[^ACGTN]([ACGTN]{$length})$$".r | ||
_ match { | ||
case regex(barcode) => Some(FoundBarcode(barcode.toCharArray, 0)) | ||
case _ => None | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/scala/org/broadinstitute/gpp/poolq3/barcode/DmuxedTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2022 The Broad Institute, Inc. All rights reserved. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
package org.broadinstitute.gpp.poolq3.barcode | ||
|
||
import munit.FunSuite | ||
|
||
class DmuxedTest extends FunSuite { | ||
|
||
test("extracting a barcode with Ns from an illumina read") { | ||
assertEquals( | ||
Dmuxed.barcodeFromId(8)("@A01379:680:HC37HDRX3:1:2101:1163:1000 1:N:0:GGNGNANT"), | ||
Some(FoundBarcode("GGNGNANT".toCharArray, 0)) | ||
) | ||
} | ||
|
||
test("extracting a barcode with no Ns from an illumina read") { | ||
assertEquals( | ||
Dmuxed.barcodeFromId(8)("@A01379:680:HC37HDRX3:1:2101:3224:1000 1:N:0:AAATGCGA"), | ||
Some(FoundBarcode("AAATGCGA".toCharArray, 0)) | ||
) | ||
} | ||
|
||
test("ignore a barcode-like sequence that's too long") { | ||
assertEquals(Dmuxed.barcodeFromId(8)("@A01379:680:HC37HDRX3:1:2101:3224:1000 1:N:0:AAATGCGAGG"), None) | ||
} | ||
|
||
test("ignore a barcode-like sequence that's too short") { | ||
assertEquals(Dmuxed.barcodeFromId(8)("@A01379:680:HC37HDRX3:1:2101:3224:1000 1:N:0:TGCGAGG"), None) | ||
} | ||
|
||
} |