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
b7743a6e
Commit
b7743a6e
authored
Oct 29, 2015
by
Wai Yi Leung
Browse files
Simplify unmapped reads extraction
parent
972ad0f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/Gears.scala
View file @
b7743a6e
...
...
@@ -20,7 +20,7 @@ import nl.lumc.sasc.biopet.core.{ PipelineCommand, SampleLibraryTag }
import
nl.lumc.sasc.biopet.extensions.kraken.
{
Kraken
,
KrakenReport
}
import
nl.lumc.sasc.biopet.extensions.picard.SamToFastq
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsView
import
nl.lumc.sasc.biopet.extensions.tools.
{
FastqSync
,
KrakenReportToJson
}
import
nl.lumc.sasc.biopet.extensions.tools.KrakenReportToJson
import
nl.lumc.sasc.biopet.utils.config.Configurable
import
org.broadinstitute.gatk.queue.QScript
...
...
@@ -73,20 +73,11 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript with Sam
def
biopetScript
()
:
Unit
=
{
val
fastqFiles
:
List
[
File
]
=
bamFile
.
map
{
bamfile
=>
// // sambamba view -f bam -F "unmapped or mate_is_unmapped" <alnFile> > <extracted.bam>
// val samFilterUnmapped = new SambambaView(this)
// samFilterUnmapped.input = bamfile
// samFilterUnmapped.filter = Some("(unmapped or mate_is_unmapped) and not (secondary_alignment) and [XH] == null")
// samFilterUnmapped.output = new File(outputDir, s"$outputName.unmapped.bam")
// samFilterUnmapped.isIntermediate = false
// add(samFilterUnmapped)
val
samtoolsViewSelectUnmapped
=
new
SamtoolsView
(
this
)
samtoolsViewSelectUnmapped
.
input
=
bamfile
samtoolsViewSelectUnmapped
.
b
=
true
samtoolsViewSelectUnmapped
.
output
=
new
File
(
outputDir
,
s
"$outputName.unmapped.bam"
)
samtoolsViewSelectUnmapped
.
f
=
List
(
"4"
)
samtoolsViewSelectUnmapped
.
F
=
List
(
"8"
)
samtoolsViewSelectUnmapped
.
f
=
List
(
"12"
)
samtoolsViewSelectUnmapped
.
isIntermediate
=
true
add
(
samtoolsViewSelectUnmapped
)
...
...
@@ -99,24 +90,7 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript with Sam
samToFastq
.
isIntermediate
=
true
add
(
samToFastq
)
// sync the fastq records
val
fastqSync
=
new
FastqSync
(
this
)
fastqSync
.
refFastq
=
samToFastq
.
fastqR1
fastqSync
.
inputFastq1
=
samToFastq
.
fastqR1
fastqSync
.
inputFastq2
=
samToFastq
.
fastqR2
fastqSync
.
outputFastq1
=
new
File
(
outputDir
,
s
"$outputName.unmapped.R1.sync.fq.gz"
)
// TODO: need some sanity check on whether R2 is really containing reads (e.g. Single End libraries)
fastqSync
.
outputFastq2
=
new
File
(
outputDir
,
s
"$outputName.unmapped.R2.sync.fq.gz"
)
fastqSync
.
outputStats
=
new
File
(
outputDir
,
s
"$outputName.sync.stats"
)
add
(
fastqSync
)
addSummarizable
(
fastqSync
,
"fastqsync"
)
outputFiles
+=
(
"fastqsync_stats"
->
fastqSync
.
outputStats
)
outputFiles
+=
(
"fastqsync_R1"
->
fastqSync
.
outputFastq1
)
outputFiles
+=
(
"fastqsync_R2"
->
fastqSync
.
outputFastq2
)
List
(
fastqSync
.
outputFastq1
,
fastqSync
.
outputFastq2
)
List
(
samToFastq
.
fastqR1
,
samToFastq
.
fastqR2
)
}.
getOrElse
(
List
(
fastqR1
,
fastqR2
).
flatten
)
// start kraken
...
...
public/gears/src/test/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsTest.scala
View file @
b7743a6e
...
...
@@ -21,7 +21,7 @@ import com.google.common.io.Files
import
nl.lumc.sasc.biopet.extensions.kraken.
{
Kraken
,
KrakenReport
}
import
nl.lumc.sasc.biopet.extensions.picard.SamToFastq
import
nl.lumc.sasc.biopet.extensions.samtools.SamtoolsView
import
nl.lumc.sasc.biopet.extensions.tools.
{
FastqSync
,
KrakenReportToJson
}
import
nl.lumc.sasc.biopet.extensions.tools.KrakenReportToJson
import
nl.lumc.sasc.biopet.utils.ConfigUtils
import
nl.lumc.sasc.biopet.utils.config.Config
import
org.apache.commons.io.FileUtils
...
...
@@ -96,10 +96,8 @@ class GearsPipelineTest(val testset: String) extends TestNGSuite with Matchers {
}
// SamToFastq should have started if it was started from bam
gears
.
functions
.
count
(
_
.
isInstanceOf
[
SamToFastq
])
shouldBe
(
if
(
fromBam
)
1
else
0
)
// gears.functions.count(_.isInstanceOf[SambambaView]) shouldBe (if (fromBam) 1 else 0)
gears
.
functions
.
count
(
_
.
isInstanceOf
[
SamtoolsView
])
shouldBe
(
if
(
fromBam
)
1
else
0
)
gears
.
functions
.
count
(
_
.
isInstanceOf
[
Fastq
Sync
])
shouldBe
(
if
(
fromBam
)
1
else
0
)
gears
.
functions
.
count
(
_
.
isInstanceOf
[
SamTo
Fastq
])
shouldBe
(
if
(
fromBam
)
1
else
0
)
gears
.
functions
.
count
(
_
.
isInstanceOf
[
Kraken
])
shouldBe
1
gears
.
functions
.
count
(
_
.
isInstanceOf
[
KrakenReport
])
shouldBe
1
...
...
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