Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SASC
sentinel-legacy
Commits
b4a35669
Commit
b4a35669
authored
Jul 06, 2015
by
bow
Browse files
Renames for consistency
parent
1d4a2df0
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/main/scala/nl/lumc/sasc/sentinel/db/UnitsAdapter.scala
View file @
b4a35669
...
...
@@ -20,15 +20,15 @@ import com.mongodb.casbah.BulkWriteResult
import
com.novus.salat._
import
com.novus.salat.global._
import
nl.lumc.sasc.sentinel.models.
{
BaseLib
Document
,
BaseSample
Document
}
import
nl.lumc.sasc.sentinel.models.
{
BaseLib
Record
,
BaseSample
Record
}
/**
* Trait for storing samples and libraries from run summaries.
*
* @tparam S Subclass of [[nl.lumc.sasc.sentinel.models.BaseSample
Document
]] representing a sample run by a pipeline.
* @tparam L Subclass of [[nl.lumc.sasc.sentinel.models.BaseLib
Document
]] representing a library run by a pipeline.
* @tparam S Subclass of [[nl.lumc.sasc.sentinel.models.BaseSample
Record
]] representing a sample run by a pipeline.
* @tparam L Subclass of [[nl.lumc.sasc.sentinel.models.BaseLib
Record
]] representing a library run by a pipeline.
*/
trait
UnitsAdapter
[
S
<:
BaseSample
Document
,
L
<:
BaseLib
Document
]
extends
MongodbConnector
{
this:
RunsAdapter
=>
trait
UnitsAdapter
[
S
<:
BaseSample
Record
,
L
<:
BaseLib
Record
]
extends
MongodbConnector
{
this:
RunsAdapter
=>
/** Name of the pipeline that produces the run summary file. */
def
pipelineName
:
String
...
...
src/main/scala/nl/lumc/sasc/sentinel/models/BaseFile
Document
.scala
→
src/main/scala/nl/lumc/sasc/sentinel/models/BaseFile
Record
.scala
View file @
b4a35669
...
...
@@ -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
BaseFile
Document
{
@Salat
abstract
class
BaseFile
Record
{
/** 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
File
Document
(
path
:
String
,
md5
:
String
)
extends
BaseFile
Document
case
class
File
Record
(
path
:
String
,
md5
:
String
)
extends
BaseFile
Record
src/main/scala/nl/lumc/sasc/sentinel/models/BaseUnit
Document
.scala
→
src/main/scala/nl/lumc/sasc/sentinel/models/BaseUnit
Record
.scala
View file @
b4a35669
...
...
@@ -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
BaseUnit
Document
{
@Salat
abstract
class
BaseUnit
Record
{
/** 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
BaseSample
Document
extends
BaseUnit
Document
{
@Salat
abstract
class
BaseSample
Record
extends
BaseUnit
Record
{
/** Sample name. */
def
sampleName
:
Option
[
String
]
}
/** Representation of a library within a sample. */
@Salat
abstract
class
BaseLib
Document
extends
BaseUnit
Document
{
@Salat
abstract
class
BaseLib
Record
extends
BaseUnit
Record
{
/** Name of the sample which this library belongs to. */
def
sampleName
:
Option
[
String
]
...
...
src/main/scala/nl/lumc/sasc/sentinel/models/SeqFiles.scala
View file @
b4a35669
...
...
@@ -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
:
File
Document
,
read2
:
Option
[
File
Document
]
=
None
)
case
class
SeqFiles
(
read1
:
File
Record
,
read2
:
Option
[
File
Record
]
=
None
)
src/main/scala/nl/lumc/sasc/sentinel/processors/gentrap/GentrapLib
Document
.scala
→
src/main/scala/nl/lumc/sasc/sentinel/processors/gentrap/GentrapLib
Record
.scala
View file @
b4a35669
...
...
@@ -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
GentrapLib
Document
(
case
class
GentrapLib
Record
(
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
BaseLib
Document
@Key
(
"_id"
)
id
:
ObjectId
=
new
ObjectId
)
extends
BaseLib
Record
src/main/scala/nl/lumc/sasc/sentinel/processors/gentrap/GentrapSample
Document
.scala
→
src/main/scala/nl/lumc/sasc/sentinel/processors/gentrap/GentrapSample
Record
.scala
View file @
b4a35669
...
...
@@ -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
GentrapSample
Document
(
case
class
GentrapSample
Record
(
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
BaseSample
Document
@Key
(
"_id"
)
id
:
ObjectId
=
new
ObjectId
)
extends
BaseSample
Record
src/main/scala/nl/lumc/sasc/sentinel/processors/gentrap/GentrapV04InputProcessor.scala
View file @
b4a35669
...
...
@@ -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
)
:
File
Document
=
(
libJson
\
"flexiprep"
\
"files"
\
"pipeline"
\
fileKey
).
extract
[
File
Document
]
private
[
processors
]
def
extractReadFile
(
libJson
:
JValue
,
fileKey
:
String
)
:
File
Record
=
(
libJson
\
"flexiprep"
\
"files"
\
"pipeline"
\
fileKey
).
extract
[
File
Record
]
/** 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
)
:
GentrapLib
Document
=
{
runName
:
Option
[
String
]
=
None
)
:
GentrapLib
Record
=
{
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
)
}
GentrapLib
Document
(
GentrapLib
Record
(
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
=
GentrapSample
Document
(
val
gSample
=
GentrapSample
Record
(
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
[
GentrapSample
Document
],
libs
:
Seq
[
GentrapLib
Document
],
samples
:
Seq
[
GentrapSample
Record
],
libs
:
Seq
[
GentrapLib
Record
],
user
:
User
,
pipeline
:
Pipeline.Value
,
runName
:
Option
[
String
]
=
None
)
=
RunRecord
(
runId
=
fileId
,
// NOTE: runId kept intentionally the same as fileId
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment