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
9c9edf13
Commit
9c9edf13
authored
Sep 10, 2015
by
Peter van 't Hof
Browse files
Adding -o option to hide output from stdout
parent
5f0b7d9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBio.scala
View file @
9c9edf13
...
...
@@ -15,7 +15,7 @@
*/
package
nl.lumc.sasc.biopet.tools
import
java.io.File
import
java.io.
{
PrintWriter
,
File
}
import
htsjdk.samtools.
{
QueryInterval
,
SAMRecord
,
SamReaderFactory
,
ValidationStringency
}
import
nl.lumc.sasc.biopet.core.ToolCommand
...
...
@@ -24,12 +24,17 @@ import scala.collection.JavaConversions._
import
scala.io.Source
object
FindRepeatsPacBio
extends
ToolCommand
{
case
class
Args
(
inputBam
:
File
=
null
,
inputBed
:
File
=
null
)
extends
AbstractArgs
case
class
Args
(
inputBam
:
File
=
null
,
outputFile
:
Option
[
File
]
=
None
,
inputBed
:
File
=
null
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'I'
,
"inputBam"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
inputBam
=
x
)
}
text
"Path to input file"
opt
[
File
](
'o'
,
"outputFile"
)
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
outputFile
=
Some
(
x
))
}
text
"Path to input file"
opt
[
File
](
'b'
,
"inputBed"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
inputBed
=
x
)
}
text
"Path to bed file"
...
...
@@ -50,7 +55,6 @@ object FindRepeatsPacBio extends ToolCommand {
val
header
=
List
(
"chr"
,
"startPos"
,
"stopPos"
,
"Repeat_seq"
,
"repeatLength"
,
"original_Repeat_readLength"
,
"Calculated_repeat_readLength"
,
"minLength"
,
"maxLength"
,
"inserts"
,
"deletions"
,
"notSpan"
)
println
(
header
.
mkString
(
"\t"
))
for
(
bedLine
<-
Source
.
fromFile
(
commandArgs
.
inputBed
).
getLines
();
...
...
@@ -84,9 +88,21 @@ object FindRepeatsPacBio extends ToolCommand {
if
(
length
<
minLength
||
minLength
==
-
1
)
minLength
=
length
}
}
println
(
List
(
chr
,
startPos
,
stopPos
,
typeRepeat
,
repeatLength
,
oriRepeatLength
,
calcRepeatLength
.
mkString
(
","
),
minLength
,
maxLength
,
inserts
.
mkString
(
"/"
),
deletions
.
mkString
(
"/"
),
notSpan
).
mkString
(
"\t"
))
bamIter
.
close
()
commandArgs
.
outputFile
match
{
case
Some
(
file
)
=>
{
val
writer
=
new
PrintWriter
(
file
)
writer
.
println
(
header
.
mkString
(
"\t"
))
writer
.
println
(
List
(
chr
,
startPos
,
stopPos
,
typeRepeat
,
repeatLength
,
oriRepeatLength
,
calcRepeatLength
.
mkString
(
","
),
minLength
,
maxLength
,
inserts
.
mkString
(
"/"
),
deletions
.
mkString
(
"/"
),
notSpan
).
mkString
(
"\t"
))
writer
.
close
()
}
case
_
=>
{
println
(
header
.
mkString
(
"\t"
))
println
(
List
(
chr
,
startPos
,
stopPos
,
typeRepeat
,
repeatLength
,
oriRepeatLength
,
calcRepeatLength
.
mkString
(
","
),
minLength
,
maxLength
,
inserts
.
mkString
(
"/"
),
deletions
.
mkString
(
"/"
),
notSpan
).
mkString
(
"\t"
))
}
}
}
}
...
...
public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/FindRepeatsPacBioTest.scala
View file @
9c9edf13
...
...
@@ -28,7 +28,8 @@ class FindRepeatsPacBioTest extends TestNGSuite with MockitoSugar with Matchers
@Test
def
testMain
()
=
{
val
args
=
Array
(
"-I"
,
bam
,
"-b"
,
bed
)
val
outputFile
=
File
.
createTempFile
(
"repeats"
,
".tsv"
)
val
args
=
Array
(
"-I"
,
bam
,
"-b"
,
bed
,
"-o"
,
outputFile
.
toString
)
main
(
args
)
}
...
...
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