Skip to content

Commit

Permalink
Merge pull request #348 from qbicsoftware/feature/nanopore-basecallin…
Browse files Browse the repository at this point in the history
…g-methods

provide method to get basecalling folder and test it
  • Loading branch information
wow-such-code authored Dec 15, 2022
2 parents f6e80eb + e02f0ba commit 3c590d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ final class OxfordNanoporeMeasurement {

private boolean pooledSamplesMeasurement

private boolean hasBasecallingData

protected OxfordNanoporeMeasurement(String name, String path, List children, Map metadata) {
this.logFilesCollection = new ArrayList<>()
this.folders = new HashMap<>()
Expand All @@ -39,6 +41,7 @@ final class OxfordNanoporeMeasurement {

createContent()
assessPooledStatus()
assessBasecallingStatus()
assessState()
}

Expand All @@ -53,12 +56,16 @@ final class OxfordNanoporeMeasurement {
private void assessPooledStatus() {
this.pooledSamplesMeasurement = containsAtLeastOneBarcodedFolder(folders["fast5pass"])
// There can be still pooled samples in the failed folder, worst case is all
// samples failed, so we need to check there to
// samples failed, so we need to check there too
if (! pooledSamplesMeasurement) {
this.pooledSamplesMeasurement = containsAtLeastOneBarcodedFolder(folders["fast5fail"])
}
}

private void assessBasecallingStatus() {
this.hasBasecallingData = folders["basecalling"];
}

private static boolean containsAtLeastOneBarcodedFolder(DataFolder folder) {
if (!folder) {
return false
Expand Down Expand Up @@ -86,6 +93,9 @@ final class OxfordNanoporeMeasurement {
case DataFile:
logFilesCollection.add(element as DataFile)
break
case BasecallingFolder:
folders["basecalling"] = element as BasecallingFolder
break
}
}
}
Expand Down Expand Up @@ -273,13 +283,14 @@ final class OxfordNanoporeMeasurement {

private Map<String, Map<String, DataFolder>> prepareRawData(String sampleId) {
final def result = new HashMap()
final def folders = [
final def dataFolders = [
"fast5fail": (folders.get("fast5fail") as DataFolder),
"fast5pass": (folders.get("fast5pass") as DataFolder),
"fastqpass": (folders.get("fastqpass") as DataFolder),
"fastqfail": (folders.get("fastqfail") as DataFolder)
]
result.put(sampleId, folders)
if(hasBasecallingData) dataFolders.put("basecalling", (folders.get("basecalling") as DataFolder))
result.put(sampleId, dataFolders)
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ class OxfordNanoporeExperimentSpec extends Specification {
assert experiment.sampleCode == "QABCD001AB"
assert measurements.size() == 1
assert measurements[0].asicTemp == "32.631687"
assert measurements[0].getRawDataPerSample(experiment).get("QABCD001AB").containsKey("basecalling")
assert !measurements[0].getRawDataPerSample(experiment).get("QABCD001AB").get("basecalling").relativePath.isEmpty()
assert !measurements[0].getRawDataPerSample(experiment).get("QABCD001AB").get("basecalling").children.isEmpty()
assert measurements[0].getRawDataPerSample(experiment).get("QABCD001AB").get("basecalling").name.size() > 0
assert measurements[0].getRawDataPerSample(experiment).get("QABCD001AB").containsKey("fastqfail")
}

def "Create a simple pooled Oxford Nanopore experiment successfully"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class OxfordNanoporeMeasurementSpec extends Specification {
assert result.get("QABCD001AE").get("fast5pass") instanceof DataFolder
assert result.get("QABCD001AE").get("fastqfail") instanceof DataFolder
assert result.get("QABCD001AE").get("fastqpass") instanceof DataFolder
assert result.get("QABCD001AE").get("basecalling") == null
assert measurement.relativePath == "path/20200219_1107_1-E3-H3_PAE26974_454b8dc6"
assert libraryKit == "SQK-LSK109"
assert adapter.equals("flongle")
Expand Down

0 comments on commit 3c590d9

Please sign in to comment.