Commit b4a35669 authored by bow's avatar bow
Browse files

Renames for consistency

parent 1d4a2df0
......@@ -20,15 +20,15 @@ import com.mongodb.casbah.BulkWriteResult
import com.novus.salat._
import com.novus.salat.global._
import nl.lumc.sasc.sentinel.models.{ BaseLibDocument, BaseSampleDocument }
import nl.lumc.sasc.sentinel.models.{ BaseLibRecord, BaseSampleRecord }
/**
* Trait for storing samples and libraries from run summaries.
*
* @tparam S Subclass of [[nl.lumc.sasc.sentinel.models.BaseSampleDocument]] representing a sample run by a pipeline.
* @tparam L Subclass of [[nl.lumc.sasc.sentinel.models.BaseLibDocument]] representing a library run by a pipeline.
* @tparam S Subclass of [[nl.lumc.sasc.sentinel.models.BaseSampleRecord]] representing a sample run by a pipeline.
* @tparam L Subclass of [[nl.lumc.sasc.sentinel.models.BaseLibRecord]] representing a library run by a pipeline.
*/
trait UnitsAdapter[S <: BaseSampleDocument, L <: BaseLibDocument] extends MongodbConnector { this: RunsAdapter =>
trait UnitsAdapter[S <: BaseSampleRecord, L <: BaseLibRecord] extends MongodbConnector { this: RunsAdapter =>
/** Name of the pipeline that produces the run summary file. */
def pipelineName: String
......
......@@ -19,7 +19,7 @@ package nl.lumc.sasc.sentinel.models
import com.novus.salat.annotations.Salat
/** Base class for file entries in [[nl.lumc.sasc.sentinel.models.RunRecord]]. */
@Salat abstract class BaseFileDocument {
@Salat abstract class BaseFileRecord {
/** File system path of the file. */
def path: String
......@@ -29,4 +29,4 @@ import com.novus.salat.annotations.Salat
}
/** Minimal implementation of a file entry. */
case class FileDocument(path: String, md5: String) extends BaseFileDocument
case class FileRecord(path: String, md5: String) extends BaseFileRecord
......@@ -22,7 +22,7 @@ import com.novus.salat.annotations.{ Persist, Salat }
import org.bson.types.ObjectId
/** Representation of a sequencing accumulation level unit. */
@Salat abstract class BaseUnitDocument {
@Salat abstract class BaseUnitRecord {
/** Internal database ID for the library document. */
def id: ObjectId
......@@ -41,14 +41,14 @@ import org.bson.types.ObjectId
}
/** Representation of a sample within a run. */
@Salat abstract class BaseSampleDocument extends BaseUnitDocument {
@Salat abstract class BaseSampleRecord extends BaseUnitRecord {
/** Sample name. */
def sampleName: Option[String]
}
/** Representation of a library within a sample. */
@Salat abstract class BaseLibDocument extends BaseUnitDocument {
@Salat abstract class BaseLibRecord extends BaseUnitRecord {
/** Name of the sample which this library belongs to. */
def sampleName: Option[String]
......
......@@ -22,4 +22,4 @@ package nl.lumc.sasc.sentinel.models
* @param read1 The first read (if paired-end) or the only read (if single end).
* @param read2 The second read. Only defined for paired-end inputs.
*/
case class SeqFiles(read1: FileDocument, read2: Option[FileDocument] = None)
case class SeqFiles(read1: FileRecord, read2: Option[FileRecord] = None)
......@@ -42,7 +42,7 @@ import nl.lumc.sasc.sentinel.utils.getUtcTimeNow
* @param creationTimeUtc UTC time when this sample entry was created.
* @param id Internal database ID.
*/
case class GentrapLibDocument(
case class GentrapLibRecord(
alnStats: GentrapAlignmentStats,
seqStatsRaw: SeqStats,
seqStatsProcessed: Option[SeqStats],
......@@ -57,4 +57,4 @@ case class GentrapLibDocument(
sampleName: Option[String] = None,
runName: Option[String] = None,
creationTimeUtc: Date = getUtcTimeNow,
@Key("_id") id: ObjectId = new ObjectId) extends BaseLibDocument
@Key("_id") id: ObjectId = new ObjectId) extends BaseLibRecord
......@@ -37,7 +37,7 @@ import nl.lumc.sasc.sentinel.utils.getUtcTimeNow
* @param creationTimeUtc UTC time when this sample entry was created.
* @param id Internal database ID.
*/
case class GentrapSampleDocument(
case class GentrapSampleRecord(
uploaderId: String,
runId: ObjectId,
referenceId: ObjectId,
......@@ -46,4 +46,4 @@ case class GentrapSampleDocument(
sampleName: Option[String] = None,
runName: Option[String] = None,
creationTimeUtc: Date = getUtcTimeNow,
@Key("_id") id: ObjectId = new ObjectId) extends BaseSampleDocument
@Key("_id") id: ObjectId = new ObjectId) extends BaseSampleRecord
......@@ -38,9 +38,9 @@ import nl.lumc.sasc.sentinel.validation.ValidationAdapter
* @param mongo MongoDB database access object.
*/
class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
extends UnitsAdapter[GentrapSampleDocument, GentrapLibDocument]
with ValidationAdapter
extends UnitsAdapter[GentrapSampleRecord, GentrapLibRecord]
with RunsAdapter
with ValidationAdapter
with ReferencesAdapter
with AnnotationsAdapter {
......@@ -123,8 +123,8 @@ class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
}
/** Extracts an input sequencing file from a library entry in a Gentrap summary. */
private[processors] def extractReadFile(libJson: JValue, fileKey: String): FileDocument =
(libJson \ "flexiprep" \ "files" \ "pipeline" \ fileKey).extract[FileDocument]
private[processors] def extractReadFile(libJson: JValue, fileKey: String): FileRecord =
(libJson \ "flexiprep" \ "files" \ "pipeline" \ fileKey).extract[FileRecord]
/** Case class for containing per-base position statistics. */
private[processors] case class PerBaseStat[T](index: Int, value: T)
......@@ -171,7 +171,7 @@ class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
/** Extracts a library document from a library entry in a Gentrap summary. */
private[processors] def extractLibDocument(libJson: JValue, uploaderId: String, runId: ObjectId, refId: ObjectId,
annotIds: Seq[ObjectId], libName: String, sampleName: String,
runName: Option[String] = None): GentrapLibDocument = {
runName: Option[String] = None): GentrapLibRecord = {
val seqStatsRaw = SeqStats(
read1 = extractReadStats(libJson, "seqstat_R1", "fastqc_R1"),
......@@ -194,7 +194,7 @@ class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
SeqFiles(read1 = r1f, read2 = Try(extractReadFile(libJson, "output_R2")).toOption)
}
GentrapLibDocument(
GentrapLibRecord(
alnStats = extractAlnStats(libJson),
seqStatsRaw = seqStatsRaw,
seqStatsProcessed = seqStatsProcessed,
......@@ -219,7 +219,7 @@ class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
.map {
case (sampleName, sampleJson) =>
val libJsons = (sampleJson \ "libraries").extract[Map[String, JValue]]
val gSample = GentrapSampleDocument(
val gSample = GentrapSampleRecord(
uploaderId = uploaderId,
sampleName = Option(sampleName),
runId = runId,
......@@ -243,7 +243,7 @@ class GentrapV04InputProcessor(protected val mongo: MongodbAccessObject)
/** Helper function for creating run records. */
private[processors] def createRun(fileId: ObjectId, refId: ObjectId, annotIds: Seq[ObjectId],
samples: Seq[GentrapSampleDocument], libs: Seq[GentrapLibDocument],
samples: Seq[GentrapSampleRecord], libs: Seq[GentrapLibRecord],
user: User, pipeline: Pipeline.Value, runName: Option[String] = None) =
RunRecord(
runId = fileId, // NOTE: runId kept intentionally the same as fileId
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment