Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biopet.biopet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Mirrors
biopet.biopet
Commits
ed418de6
Commit
ed418de6
authored
Sep 27, 2016
by
Peter van 't Hof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added find overlap tool
parent
6efe0956
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
...in/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
+62
-0
No files found.
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
0 → 100644
View file @
ed418de6
package
nl.lumc.sasc.biopet.tools
import
java.io.
{
File
,
PrintWriter
}
import
nl.lumc.sasc.biopet.utils.ToolCommand
import
scala.collection.mutable.ListBuffer
import
scala.io.Source
/**
* Created by pjvan_thof on 21-9-16.
*/
object
FindOverlapMatch
extends
ToolCommand
{
case
class
Args
(
inputVcf
:
File
=
null
,
cutoff
:
Double
=
0.0
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'i'
,
"input"
)
required
()
unbounded
()
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
inputVcf
=
x
)
}
opt
[
Double
](
'c'
,
"cutoff"
)
required
()
unbounded
()
valueName
"<value>"
action
{
(
x
,
c
)
=>
c
.
copy
(
cutoff
=
x
)
}
}
/**
* @param args the command line arguments
*/
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
cmdargs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
(
throw
new
IllegalArgumentException
)
val
reader
=
Source
.
fromFile
(
cmdargs
.
inputVcf
)
val
data
=
reader
.
getLines
().
map
(
_
.
split
(
"\t"
)).
toArray
val
samples
=
data
.
head
.
zipWithIndex
.
tail
var
overlap
=
0
var
multiOverlap
=
0
var
noOverlap
=
0
for
(
i1
<-
samples
)
{
val
buffer
=
ListBuffer
[(
String
,
Double
)]()
for
(
i2
<-
samples
)
{
val
value
=
data
(
i1
.
_2
)(
i2
.
_2
).
toDouble
if
(
value
>=
cmdargs
.
cutoff
&&
i1
.
_2
!=
i2
.
_2
)
{
buffer
.+=((
i2
.
_1
,
value
))
}
}
if
(
buffer
.
nonEmpty
)
overlap
+=
1
else
noOverlap
+=
1
if
(
buffer
.
size
>
1
)
multiOverlap
+=
1
println
(
s
"${i1._1}\t${buffer.mkString("
\
t
")}"
)
}
logger
.
info
(
s
"$overlap found"
)
logger
.
info
(
s
"no $noOverlap found"
)
logger
.
info
(
s
"multi $multiOverlap found"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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