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
784064ce
Commit
784064ce
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Change to fastq reader from htsjdk
parent
06536548
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FastqSplitter.scala
+14
-20
14 additions, 20 deletions
.../main/scala/nl/lumc/sasc/biopet/tools/FastqSplitter.scala
with
14 additions
and
20 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FastqSplitter.scala
+
14
−
20
View file @
784064ce
...
...
@@ -15,13 +15,13 @@
*/
package
nl.lumc.sasc.biopet.tools
import
java.io.
{
BufferedInputStream
,
File
,
FileInputStream
,
PrintWriter
}
import
java.util.zip.GZIPInputStream
import
java.io.
File
import
htsjdk.samtools.fastq.
{
AsyncFastqWriter
,
FastqReader
,
BasicFastqWriter
}
import
nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
import
scala.io.Source
import
nl.lumc.sasc.biopet.core.ToolCommand
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
}
import
scala.collection.JavaConversions._
class
FastqSplitter
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
{
javaMainClass
=
getClass
.
getName
...
...
@@ -58,25 +58,19 @@ object FastqSplitter extends ToolCommand {
val
commandArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
groupsize
=
100
val
output
=
for
(
file
<-
commandArgs
.
outputFile
)
yield
new
PrintWriter
(
file
)
val
inputStream
=
{
if
(
commandArgs
.
inputFile
.
getName
.
endsWith
(
".gz"
)
||
commandArgs
.
inputFile
.
getName
.
endsWith
(
".gzip"
))
Source
.
fromInputStream
(
new
GZIPInputStream
(
new
BufferedInputStream
(
new
FileInputStream
(
commandArgs
.
inputFile
)))).
bufferedReader
else
Source
.
fromFile
(
commandArgs
.
inputFile
).
bufferedReader
}
while
(
inputStream
.
ready
)
{
for
(
writter
<-
output
)
{
for
(
t
<-
1
to
groupsize
)
{
for
(
t
<-
1
to
(
4
))
{
if
(
inputStream
.
ready
)
{
writter
.
write
(
inputStream
.
readLine
+
"\n"
)
}
}
val
output
=
for
(
file
<-
commandArgs
.
outputFile
)
yield
new
AsyncFastqWriter
(
new
BasicFastqWriter
(
file
),
groupsize
)
val
reader
=
new
FastqReader
(
commandArgs
.
inputFile
)
logger
.
info
(
"Starting to split fatsq file: "
+
commandArgs
.
inputFile
)
logger
.
info
(
"Output files: "
+
commandArgs
.
outputFile
.
mkString
(
", "
))
while
(
reader
.
hasNext
)
{
for
(
writer
<-
output
)
{
for
(
t
<-
1
to
groupsize
if
reader
.
hasNext
)
{
writer
.
write
(
reader
.
next
())
}
}
}
for
(
writ
t
er
<-
output
)
writ
t
er
.
close
for
(
writer
<-
output
)
writer
.
close
}
}
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