Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biopet.biopet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Mirrors
biopet.biopet
Commits
7eb9af74
Commit
7eb9af74
authored
May 17, 2016
by
bow
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-bed_check' into 'develop'
Init bed check fixes #298 See merge request !401
parents
09fa0b3f
d08b6c72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
...nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
+5
-2
bammetrics/src/test/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
...umc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
+10
-2
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedCheck.scala
.../scala/nl/lumc/sasc/biopet/utils/intervals/BedCheck.scala
+27
-0
No files found.
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
View file @
7eb9af74
...
...
@@ -17,15 +17,16 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics
import
java.io.File
import
nl.lumc.sasc.biopet.core.annotations.
{
RibosomalRefFlat
,
Annotation
RefFlat
}
import
nl.lumc.sasc.biopet.core.annotations.
{
AnnotationRefFlat
,
Ribosomal
RefFlat
}
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
nl.lumc.sasc.biopet.core.summary.SummaryQScript
import
nl.lumc.sasc.biopet.core.
{
Reference
,
BiopetFifoPipe
,
PipelineCommand
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.core.
{
BiopetFifoPipe
,
PipelineCommand
,
Reference
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
}
import
nl.lumc.sasc.biopet.extensions.picard._
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import
nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
import
nl.lumc.sasc.biopet.extensions.tools.BiopetFlagstat
import
nl.lumc.sasc.biopet.utils.intervals.BedCheck
import
org.broadinstitute.gatk.queue.QScript
class
BamMetrics
(
val
root
:
Configurable
)
extends
QScript
...
...
@@ -72,6 +73,8 @@ class BamMetrics(val root: Configurable) extends QScript
/** executed before script */
def
init
()
:
Unit
=
{
inputFiles
:+=
new
InputFile
(
inputBam
)
ampliconBedFile
.
foreach
(
BedCheck
.
checkBedFileToReference
(
_
,
referenceFasta
(),
biopetError
=
true
))
roiBedFiles
.
foreach
(
BedCheck
.
checkBedFileToReference
(
_
,
referenceFasta
(),
biopetError
=
true
))
}
/** Script to add jobs */
...
...
bammetrics/src/test/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetricsTest.scala
View file @
7eb9af74
...
...
@@ -61,9 +61,9 @@ class BamMetricsTest extends TestNGSuite with Matchers {
def
testBamMetrics
(
rois
:
Int
,
amplicon
:
Boolean
,
rna
:
Boolean
,
wgs
:
Boolean
)
=
{
val
map
=
ConfigUtils
.
mergeMaps
(
Map
(
"output_dir"
->
BamMetricsTest
.
outputDir
,
"rna_metrics"
->
rna
,
"wgs_metrics"
->
wgs
),
Map
(
BamMetricsTest
.
executables
.
toSeq
:
_
*
))
++
(
if
(
amplicon
)
Map
(
"amplicon_bed"
->
"amplicon.bed"
)
else
Map
())
++
(
if
(
amplicon
)
Map
(
"amplicon_bed"
->
BamMetricsTest
.
ampliconBed
.
getAbsolutePath
)
else
Map
())
++
(
if
(
rna
)
Map
(
"annotation_refflat"
->
"transcripts.refFlat"
)
else
Map
())
++
Map
(
"regions_of_interest"
->
(
1
to
rois
).
map
(
"roi_"
+
_
+
".bed"
).
toList
)
Map
(
"regions_of_interest"
->
(
1
to
rois
).
map
(
BamMetricsTest
.
roi
(
_
).
getAbsolutePath
).
toList
)
val
bammetrics
:
BamMetrics
=
initPipeline
(
map
)
bammetrics
.
inputBam
=
BamMetricsTest
.
bam
...
...
@@ -94,6 +94,14 @@ object BamMetricsTest {
val
bam
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
"bla.bam"
)
Files
.
touch
(
bam
)
val
ampliconBed
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
"amplicon_bed.bed"
)
Files
.
touch
(
ampliconBed
)
def
roi
(
i
:
Int
)
:
File
=
{
val
roi
=
new
File
(
outputDir
,
"input"
+
File
.
separator
+
s
"roi${i}.bed"
)
Files
.
touch
(
roi
)
roi
}
private
def
copyFile
(
name
:
String
)
:
Unit
=
{
val
is
=
getClass
.
getResourceAsStream
(
"/"
+
name
)
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/intervals/BedCheck.scala
0 → 100644
View file @
7eb9af74
package
nl.lumc.sasc.biopet.utils.intervals
import
java.io.File
import
scala.collection.mutable.Set
import
nl.lumc.sasc.biopet.utils.Logging
/**
* Created by pjvanthof on 14/05/16.
*/
object
BedCheck
{
private
val
cache
:
Set
[(
File
,
File
)]
=
Set
()
def
checkBedFileToReference
(
bedFile
:
File
,
reference
:
File
,
biopetError
:
Boolean
=
false
,
ignoreCache
:
Boolean
=
false
)
:
Unit
=
{
if
(
ignoreCache
||
!
cache
.
contains
((
bedFile
,
reference
)))
{
cache
.
add
((
bedFile
,
reference
))
val
bedrecords
=
BedRecordList
.
fromFile
(
bedFile
)
if
(
biopetError
)
{
try
{
bedrecords
.
validateContigs
(
reference
)
}
catch
{
case
e
:
IllegalArgumentException
=>
Logging
.
addError
(
e
.
getMessage
+
s
", Bedfile: $bedFile"
)
}
}
else
bedrecords
.
validateContigs
(
reference
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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