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
d9b8ce2c
Commit
d9b8ce2c
authored
Nov 22, 2014
by
Peter van 't Hof
Browse files
Added bammetrics as artifact
parent
eac4cd7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/bammetrics/.gitignore
0 → 100644
View file @
d9b8ce2c
/target/
\ No newline at end of file
public/bammetrics/pom.xml
0 → 100644
View file @
d9b8ce2c
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
nl.lumc.sasc
</groupId>
<artifactId>
BamMetrics
</artifactId>
<version>
0.2.0-DEV
</version>
<packaging>
jar
</packaging>
<inceptionYear>
2014
</inceptionYear>
<name>
BamMetrics
</name>
<url>
http://maven.apache.org
</url>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<sting.unpack.phase>
prepare-package
</sting.unpack.phase>
<sting.shade.phase>
package
</sting.shade.phase>
<app.main.class>
nl.lumc.sasc.biopet.core.BiopetExecutable
</app.main.class>
</properties>
<dependencies>
<dependency>
<groupId>
nl.lumc.sasc
</groupId>
<artifactId>
BiopetFramework
</artifactId>
<version>
0.2.0-DEV
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<includes>
<include>
**/*
</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.scala-tools
</groupId>
<artifactId>
maven-scala-plugin
</artifactId>
<version>
2.15.2
</version>
<executions>
<execution>
<id>
scala-compile
</id>
<goals>
<goal>
compile
</goal>
<goal>
testCompile
</goal>
</goals>
<configuration>
<args>
<arg>
-dependencyfile
</arg>
<arg>
${project.build.directory}/.scala_dependencies
</arg>
<arg>
-deprecation
</arg>
<arg>
-feature
</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-jar-plugin
</artifactId>
<version>
2.5
</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>
true
</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>
true
</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
2.3.2
</version>
<configuration>
<showDeprecation>
true
</showDeprecation>
</configuration>
</plugin>
</plugins>
</build>
</project>
public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
0 → 100644
View file @
d9b8ce2c
package
nl.lumc.sasc.biopet.pipelines.bammetrics
import
nl.lumc.sasc.biopet.scripts.CoverageStats
import
org.broadinstitute.gatk.queue.QScript
import
nl.lumc.sasc.biopet.core.
{
BiopetQScript
,
PipelineCommand
}
import
java.io.File
import
nl.lumc.sasc.biopet.tools.
{
BedToInterval
,
BiopetFlagstat
}
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.extensions.bedtools.
{
BedtoolsCoverage
,
BedtoolsIntersect
}
import
nl.lumc.sasc.biopet.extensions.picard.
{
CollectInsertSizeMetrics
,
CollectGcBiasMetrics
,
CalculateHsMetrics
,
CollectAlignmentSummaryMetrics
}
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsFlagstat
class
BamMetrics
(
val
root
:
Configurable
)
extends
QScript
with
BiopetQScript
{
def
this
()
=
this
(
null
)
@Input
(
doc
=
"Bam File"
,
shortName
=
"BAM"
,
required
=
true
)
var
inputBam
:
File
=
_
@Input
(
doc
=
"Bed tracks targets"
,
shortName
=
"target"
,
required
=
false
)
var
bedFiles
:
List
[
File
]
=
Nil
@Input
(
doc
=
"Bed tracks bait"
,
shortName
=
"bait"
,
required
=
false
)
var
baitBedFile
:
File
=
_
@Argument
(
doc
=
""
,
required
=
false
)
var
wholeGenome
=
false
def
init
()
{
if
(
outputDir
==
null
)
throw
new
IllegalStateException
(
"Missing Output directory on BamMetrics module"
)
else
if
(!
outputDir
.
endsWith
(
"/"
))
outputDir
+=
"/"
if
(
config
.
contains
(
"target_bed"
))
{
for
(
file
<-
config
(
"target_bed"
).
asList
)
{
bedFiles
+:=
new
File
(
file
.
toString
)
}
}
if
(
baitBedFile
==
null
&&
config
.
contains
(
"target_bait"
))
baitBedFile
=
config
(
"target_bait"
)
}
def
biopetScript
()
{
add
(
SamtoolsFlagstat
(
this
,
inputBam
,
outputDir
))
add
(
BiopetFlagstat
(
this
,
inputBam
,
outputDir
))
add
(
CollectGcBiasMetrics
(
this
,
inputBam
,
outputDir
))
add
(
CollectInsertSizeMetrics
(
this
,
inputBam
,
outputDir
))
add
(
CollectAlignmentSummaryMetrics
(
this
,
inputBam
,
outputDir
))
val
baitIntervalFile
=
if
(
baitBedFile
!=
null
)
new
File
(
outputDir
,
baitBedFile
.
getName
.
stripSuffix
(
".bed"
)
+
".interval"
)
else
null
if
(
baitIntervalFile
!=
null
)
add
(
BedToInterval
(
this
,
baitBedFile
,
inputBam
,
outputDir
),
true
)
for
(
bedFile
<-
bedFiles
)
{
val
targetDir
=
outputDir
+
bedFile
.
getName
.
stripSuffix
(
".bed"
)
+
"/"
val
targetInterval
=
BedToInterval
(
this
,
bedFile
,
inputBam
,
targetDir
)
add
(
targetInterval
,
true
)
add
(
CalculateHsMetrics
(
this
,
inputBam
,
if
(
baitIntervalFile
!=
null
)
baitIntervalFile
else
targetInterval
.
output
,
targetInterval
.
output
,
targetDir
))
val
strictOutputBam
=
new
File
(
targetDir
,
inputBam
.
getName
.
stripSuffix
(
".bam"
)
+
".overlap.strict.bam"
)
add
(
BedtoolsIntersect
(
this
,
inputBam
,
bedFile
,
strictOutputBam
,
minOverlap
=
config
(
"strictintersectoverlap"
,
default
=
1.0
)),
true
)
add
(
SamtoolsFlagstat
(
this
,
strictOutputBam
))
add
(
BiopetFlagstat
(
this
,
strictOutputBam
,
targetDir
))
val
looseOutputBam
=
new
File
(
targetDir
,
inputBam
.
getName
.
stripSuffix
(
".bam"
)
+
".overlap.loose.bam"
)
add
(
BedtoolsIntersect
(
this
,
inputBam
,
bedFile
,
looseOutputBam
,
minOverlap
=
config
(
"looseintersectoverlap"
,
default
=
0.01
)),
true
)
add
(
SamtoolsFlagstat
(
this
,
looseOutputBam
))
add
(
BiopetFlagstat
(
this
,
looseOutputBam
,
targetDir
))
val
coverageFile
=
new
File
(
targetDir
,
inputBam
.
getName
.
stripSuffix
(
".bam"
)
+
".coverage"
)
add
(
BedtoolsCoverage
(
this
,
inputBam
,
bedFile
,
coverageFile
,
true
),
true
)
add
(
CoverageStats
(
this
,
coverageFile
,
targetDir
))
}
}
}
object
BamMetrics
extends
PipelineCommand
{
def
apply
(
root
:
Configurable
,
bamFile
:
File
,
outputDir
:
String
)
:
BamMetrics
=
{
val
bamMetrics
=
new
BamMetrics
(
root
)
bamMetrics
.
inputBam
=
bamFile
bamMetrics
.
outputDir
=
outputDir
bamMetrics
.
init
bamMetrics
.
biopetScript
return
bamMetrics
}
}
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