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
717bf892
Commit
717bf892
authored
10 years ago
by
bow
Browse files
Options
Downloads
Patches
Plain Diff
Update write function to accept FASTQ readers and writers
parent
bce349be
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
+13
-13
13 additions, 13 deletions
...scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
with
13 additions
and
13 deletions
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/ExtractAlignedFastq.scala
+
13
−
13
View file @
717bf892
...
...
@@ -124,28 +124,28 @@ object ExtractAlignedFastq extends ToolCommand {
}
def
selectFastqReads
(
memFunc
:
FastqPair
=>
Boolean
,
inputFastq1
:
F
ile
,
outputFastq1
:
File
,
inputFastq2
:
F
ile
=
null
,
outputFastq2
:
File
=
null
)
:
Unit
=
{
inputFastq1
:
F
astqReader
,
outputFastq1
:
BasicFastqWriter
,
inputFastq2
:
F
astqReader
=
null
,
outputFastq2
:
BasicFastqWriter
=
null
)
:
Unit
=
{
val
i1
=
new
FastqReader
(
inputFastq1
).
iterator
.
asScala
val
o1
=
new
BasicFastqWriter
(
outputFastq1
)
val
i1
=
inputFastq1
.
iterator
.
asScala
val
i2
=
inputFastq2
match
{
case
null
=>
Iterator
.
continually
(
null
)
case
otherwise
=>
new
FastqReader
(
otherwise
)
.
iterator
.
asScala
case
otherwise
=>
otherwise
.
iterator
.
asScala
}
val
o1
=
outputFastq1
val
o2
=
(
inputFastq2
,
outputFastq2
)
match
{
case
(
null
,
null
)
=>
null
case
(
_
,
null
)
=>
throw
new
IllegalArgumentException
(
"Missing output FASTQ 2"
)
case
(
null
,
_
)
=>
throw
new
IllegalArgumentException
(
"Output FASTQ 2 supplied but there is no input FASTQ 2"
)
case
(
x
,
y
)
=>
new
BasicFastqWriter
(
outputFastq2
)
case
(
x
,
y
)
=>
outputFastq2
}
logger
.
info
(
"Writing output file(s) ..."
)
// zip, filter based on function, and write to output file(s)
i1
.
zip
(
i2
)
.
filter
(
(
rec
)
=>
memFunc
(
rec
.
_1
,
rec
.
_2
))
.
filter
(
rec
=>
memFunc
(
rec
.
_1
,
rec
.
_2
))
.
foreach
{
case
(
rec1
,
null
)
=>
o1
.
write
(
rec1
)
...
...
@@ -235,9 +235,9 @@ object ExtractAlignedFastq extends ToolCommand {
commonSuffixLength
=
commandArgs
.
commonSuffixLength
)
selectFastqReads
(
memFunc
,
inputFastq1
=
commandArgs
.
inputFastq1
,
inputFastq2
=
commandArgs
.
inputFastq2
,
outputFastq1
=
commandArgs
.
outputFastq1
,
outputFastq2
=
commandArgs
.
outputFastq2
)
inputFastq1
=
new
FastqReader
(
commandArgs
.
inputFastq1
)
,
inputFastq2
=
new
FastqReader
(
commandArgs
.
inputFastq2
)
,
outputFastq1
=
new
BasicFastqWriter
(
commandArgs
.
outputFastq1
)
,
outputFastq2
=
new
BasicFastqWriter
(
commandArgs
.
outputFastq2
)
)
}
}
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