Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
biopet.biopet
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirrors
biopet.biopet
Commits
5448ee58
Commit
5448ee58
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added input files to summary of shiva
parent
ba50ff98
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTrait.scala
+18
-12
18 additions, 12 deletions
...cala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTrait.scala
with
18 additions
and
12 deletions
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTrait.scala
+
18
−
12
View file @
5448ee58
...
...
@@ -91,11 +91,13 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
class
Library
(
libId
:
String
)
extends
AbstractLibrary
(
libId
)
{
/** Library specific files to add to the summary */
def
summaryFiles
:
Map
[
String
,
File
]
=
{
(
bamFile
,
preProcessBam
)
match
{
(
(
bamFile
,
preProcessBam
)
match
{
case
(
Some
(
b
),
Some
(
pb
))
=>
Map
(
"bamFile"
->
b
,
"preProcessBam"
->
pb
)
case
(
Some
(
b
),
_
)
=>
Map
(
"bamFile"
->
b
)
case
_
=>
Map
()
}
})
++
(
inputR1
.
map
(
"input_R1"
->
_
)
::
inputR2
.
map
(
"input_R2"
->
_
)
::
inputBam
.
map
(
"input_bam"
->
_
)
::
Nil
).
flatten
.
toMap
}
/** Library specific stats to add to summary */
...
...
@@ -117,8 +119,12 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
(
Some
(
mapping
),
Some
(
mapping
.
finalBamFile
),
preProcess
(
mapping
.
finalBamFile
))
}
lazy
val
inputR1
:
Option
[
File
]
=
config
(
"R1"
)
lazy
val
inputR2
:
Option
[
File
]
=
config
(
"R2"
)
lazy
val
inputBam
:
Option
[
File
]
=
if
(
r1
.
isEmpty
)
config
(
"bam"
)
else
None
lazy
val
(
mapping
,
bamFile
,
preProcessBam
)
:
(
Option
[
Mapping
],
Option
[
File
],
Option
[
File
])
=
(
config
.
contains
(
"R1"
),
config
.
contains
(
"bam"
)
)
match
{
(
inputR1
.
isDefined
,
inputBam
.
isDefined
)
match
{
case
(
true
,
_
)
=>
makeMapping
// Default starting from fastq files
case
(
false
,
true
)
=>
// Starting from bam file
config
(
"bam_to_fastq"
,
default
=
false
).
asBoolean
match
{
...
...
@@ -137,18 +143,18 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
/** This will add jobs for this library */
def
addJobs
()
:
Unit
=
{
(
config
.
contains
(
"R1"
),
config
.
contains
(
"bam"
)
)
match
{
(
inputR1
.
isDefined
,
inputBam
.
isDefined
)
match
{
case
(
true
,
_
)
=>
mapping
.
foreach
(
mapping
=>
{
mapping
.
input_R1
=
config
(
"R1"
)
mapping
.
input_R2
=
config
(
"R2"
)
mapping
.
input_R1
=
inputR1
.
get
mapping
.
input_R2
=
inputR2
inputFiles
:+=
new
InputFile
(
mapping
.
input_R1
,
config
(
"R1_md5"
))
mapping
.
input_R2
.
foreach
(
inputFiles
:+=
new
InputFile
(
_
,
config
(
"R2_md5"
)))
})
case
(
false
,
true
)
=>
{
inputFiles
:+=
new
InputFile
(
config
(
"bam"
)
,
config
(
"bam_md5"
))
inputFiles
:+=
new
InputFile
(
inputBam
.
get
,
config
(
"bam_md5"
))
config
(
"bam_to_fastq"
,
default
=
false
).
asBoolean
match
{
case
true
=>
val
samToFastq
=
SamToFastq
(
qscript
,
config
(
"bam"
)
,
val
samToFastq
=
SamToFastq
(
qscript
,
inputBam
.
get
,
new
File
(
libDir
,
sampleId
+
"-"
+
libId
+
".R1.fq.gz"
),
new
File
(
libDir
,
sampleId
+
"-"
+
libId
+
".R2.fq.gz"
))
samToFastq
.
isIntermediate
=
true
...
...
@@ -158,7 +164,7 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
mapping
.
input_R2
=
Some
(
samToFastq
.
fastqR2
)
})
case
false
=>
val
inputSam
=
SamReaderFactory
.
makeDefault
.
open
(
config
(
"bam"
)
)
val
inputSam
=
SamReaderFactory
.
makeDefault
.
open
(
inputBam
.
get
)
val
readGroups
=
inputSam
.
getFileHeader
.
getReadGroups
val
readGroupOke
=
readGroups
.
forall
(
readGroup
=>
{
...
...
@@ -170,8 +176,8 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
if
(!
readGroupOke
)
{
if
(
config
(
"correct_readgroups"
,
default
=
false
).
asBoolean
)
{
logger
.
info
(
"Correcting readgroups, file:"
+
config
(
"bam"
)
)
val
aorrg
=
AddOrReplaceReadGroups
(
qscript
,
config
(
"bam"
)
,
bamFile
.
get
)
logger
.
info
(
"Correcting readgroups, file:"
+
inputBam
.
get
)
val
aorrg
=
AddOrReplaceReadGroups
(
qscript
,
inputBam
.
get
,
bamFile
.
get
)
aorrg
.
RGID
=
sampleId
+
"-"
+
libId
aorrg
.
RGLB
=
libId
aorrg
.
RGSM
=
sampleId
...
...
@@ -180,7 +186,7 @@ trait ShivaTrait extends MultiSampleQScript with Reference {
}
else
throw
new
IllegalStateException
(
"Sample readgroup and/or library of input bamfile is not correct, file: "
+
bamFile
+
"\nPlease note that it is possible to set 'correct_readgroups' to true in the config to automatic fix this"
)
}
else
{
val
oldBamFile
:
File
=
config
(
"bam"
)
val
oldBamFile
:
File
=
inputBam
.
get
val
oldIndex
:
File
=
new
File
(
oldBamFile
.
getAbsolutePath
.
stripSuffix
(
".bam"
)
+
".bai"
)
val
newIndex
:
File
=
new
File
(
libDir
,
oldBamFile
.
getName
.
stripSuffix
(
".bam"
)
+
".bai"
)
val
baiLn
=
Ln
(
qscript
,
oldIndex
,
newIndex
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment