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
Mirrors
biopet.biopet
Commits
c708df45
Commit
c708df45
authored
May 26, 2016
by
Sander Bollen
Browse files
sort input bed and fix test
parent
15d13bb6
Changes
3
Hide whitespace changes
Inline
Side-by-side
bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
View file @
c708df45
...
...
@@ -17,11 +17,11 @@ 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.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
}
import
nl.lumc.sasc.biopet.core.
{
BiopetFifoPipe
,
PipelineCommand
,
Reference
,
SampleLibraryTag
}
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
,
BedtoolsSort
}
import
nl.lumc.sasc.biopet.extensions.picard._
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
import
nl.lumc.sasc.biopet.pipelines.bammetrics.scripts.CoverageStats
...
...
@@ -164,7 +164,11 @@ class BamMetrics(val root: Configurable) extends QScript
addSummarizable
(
biopetFlagstatLoose
,
targetName
+
"_biopet_flagstat_loose"
)
add
(
new
BiopetFifoPipe
(
this
,
List
(
biLoose
,
biopetFlagstatLoose
)))
val
bedCov
=
BedtoolsCoverage
(
this
,
intervals
.
bed
,
inputBam
,
depth
=
true
)
val
sorter
=
new
BedtoolsSort
(
this
)
sorter
.
input
=
intervals
.
bed
sorter
.
output
=
swapExt
(
targetDir
,
intervals
.
bed
,
".bed"
,
".sorted.bed"
)
add
(
sorter
)
val
bedCov
=
BedtoolsCoverage
(
this
,
sorter
.
output
,
inputBam
,
depth
=
true
)
val
covStats
=
CoverageStats
(
this
,
targetDir
,
inputBam
.
getName
.
stripSuffix
(
".bam"
)
+
".coverage"
)
covStats
.
title
=
Some
(
"Coverage Plot"
)
covStats
.
subTitle
=
Some
(
s
"for file '$targetName.bed'"
)
...
...
biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/bedtools/BedtoolsSort.scala
0 → 100644
View file @
c708df45
package
nl.lumc.sasc.biopet.extensions.bedtools
import
java.io.File
import
nl.lumc.sasc.biopet.core.Reference
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Argument
,
Input
,
Output
}
/**
* Created by Sander Bollen on 26-5-16.
*/
class
BedtoolsSort
(
val
root
:
Configurable
)
extends
Bedtools
with
Reference
{
@Input
var
input
:
File
=
null
@Output
var
output
:
File
=
null
@Argument
(
required
=
false
)
var
faidx
:
File
=
referenceFai
def
cmdLine
=
required
(
executable
)
+
required
(
"sort"
)
+
required
(
"-i"
,
input
)
+
optional
(
"-faidx"
,
faidx
)
+
(
if
(
outputAsStsout
)
""
else
" > "
+
required
(
output
))
}
biopet-extensions/src/test/scala/nl/lumc/sasc/biopet/extensions/BedToolsTest.scala
View file @
c708df45
...
...
@@ -4,7 +4,7 @@ import java.io.File
import
java.nio.file.Paths
import
nl.lumc.sasc.biopet.extensions.bedtools.BedtoolsCoverage
import
nl.lumc.sasc.biopet.utils.config.Config
import
nl.lumc.sasc.biopet.utils.config.
{
Config
,
Configurable
}
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.Test
...
...
@@ -21,10 +21,14 @@ class BedToolsTest extends TestNGSuite with Matchers {
val
file
=
new
File
(
Paths
.
get
(
this
.
getClass
.
getResource
(
"/ref.fa.fai"
).
toURI
).
toString
)
val
tmp
=
File
.
createTempFile
(
"test"
,
".bed"
)
tmp
.
deleteOnExit
()
val
cov
=
new
BedtoolsCoverage
(
null
)
{
override
def
globalConfig
=
new
Config
(
Map
(
"output_dir"
->
tmp
.
getParent
))
class
TestCov
(
override
val
root
:
Configurable
)
extends
BedtoolsCoverage
(
root
)
{
jobTempDir
=
tmp
override
def
referenceFai
=
file
def
genome
=
BedtoolsCoverage
.
createGenomeFile
(
file
,
file
.
getParentFile
)
}
val
genome
=
cov
.
createGenomeFile
(
file
)
val
cov
=
new
TestCov
(
null
)
val
genome
=
cov
.
genome
Source
.
fromFile
(
genome
).
getLines
().
mkString
(
"\n"
)
shouldBe
"chr1\t9"
}
...
...
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