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
8fa3931f
Commit
8fa3931f
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Add tool to replace python script
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/PrefixFastq.scala
+61
-0
61 additions, 0 deletions
...rc/main/scala/nl/lumc/sasc/biopet/tools/PrefixFastq.scala
with
61 additions
and
0 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/PrefixFastq.scala
0 → 100644
+
61
−
0
View file @
8fa3931f
package
nl.lumc.sasc.biopet.tools
import
java.io.File
import
nl.lumc.sasc.biopet.core.ToolCommand
import
htsjdk.samtools.fastq.
{
FastqRecord
,
AsyncFastqWriter
,
FastqReader
,
BasicFastqWriter
}
import
scala.collection.JavaConversions._
/**
* Created by pjvan_thof on 1/13/15.
*/
object
PrefixFastq
extends
ToolCommand
{
case
class
Args
(
input
:
File
=
null
,
output
:
File
=
null
,
seq
:
String
=
"CATG"
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'i'
,
"input"
)
required
()
maxOccurs
(
1
)
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
input
=
x
)
}
opt
[
File
](
'o'
,
"output"
)
required
()
maxOccurs
(
1
)
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
output
=
x
)
}
opt
[
String
](
's'
,
"seq"
)
maxOccurs
(
1
)
valueName
(
"<prefix seq>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
seq
=
x
)
}
}
/**
* @param args the command line arguments
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
logger
.
info
(
"Start"
)
val
argsParser
=
new
OptParser
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
val
writer
=
new
AsyncFastqWriter
(
new
BasicFastqWriter
(
cmdArgs
.
output
),
3000
)
val
reader
=
new
FastqReader
(
cmdArgs
.
input
)
var
counter
=
0
while
(
reader
.
hasNext
)
{
val
read
=
reader
.
next
()
val
maxQuality
=
read
.
getBaseQualityString
.
max
val
readHeader
=
read
.
getReadHeader
val
readSeq
=
cmdArgs
.
seq
+
read
.
getReadString
val
baseQualityHeader
=
read
.
getBaseQualityHeader
val
baseQuality
=
Array
.
fill
(
cmdArgs
.
seq
.
size
)(
maxQuality
).
mkString
+
read
.
getBaseQualityString
writer
.
write
(
new
FastqRecord
(
readHeader
,
readSeq
,
baseQualityHeader
,
baseQuality
))
counter
+=
1
if
(
counter
%
1
e6
==
0
)
logger
.
info
(
counter
+
" reads processed"
)
}
if
(
counter
%
1
e6
!=
0
)
logger
.
info
(
counter
+
" reads processed"
)
writer
.
close
()
reader
.
close
()
logger
.
info
(
"Done"
)
}
}
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