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
50d678ff
Commit
50d678ff
authored
8 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added regex option
parent
2727f142
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
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
+12
-4
12 additions, 4 deletions
...in/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
with
12 additions
and
4 deletions
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/FindOverlapMatch.scala
+
12
−
4
View file @
50d678ff
...
@@ -6,6 +6,7 @@ import nl.lumc.sasc.biopet.utils.ToolCommand
...
@@ -6,6 +6,7 @@ import nl.lumc.sasc.biopet.utils.ToolCommand
import
scala.collection.mutable.ListBuffer
import
scala.collection.mutable.ListBuffer
import
scala.io.Source
import
scala.io.Source
import
scala.util.matching.Regex
/**
/**
* This tool will find all pairs above a cutoff in a data table
* This tool will find all pairs above a cutoff in a data table
...
@@ -17,7 +18,9 @@ object FindOverlapMatch extends ToolCommand {
...
@@ -17,7 +18,9 @@ object FindOverlapMatch extends ToolCommand {
case
class
Args
(
inputMetrics
:
File
=
null
,
case
class
Args
(
inputMetrics
:
File
=
null
,
outputFile
:
Option
[
File
]
=
None
,
outputFile
:
Option
[
File
]
=
None
,
cutoff
:
Double
=
0.0
,
cutoff
:
Double
=
0.0
,
filterSameNames
:
Boolean
=
true
)
extends
AbstractArgs
filterSameNames
:
Boolean
=
true
,
rowSampleRegex
:
Option
[
Regex
]
=
None
,
columnSampleRegex
:
Option
[
Regex
]
=
None
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'i'
,
"input"
)
required
()
unbounded
()
valueName
"<file>"
action
{
(
x
,
c
)
=>
opt
[
File
](
'i'
,
"input"
)
required
()
unbounded
()
valueName
"<file>"
action
{
(
x
,
c
)
=>
...
@@ -32,7 +35,12 @@ object FindOverlapMatch extends ToolCommand {
...
@@ -32,7 +35,12 @@ object FindOverlapMatch extends ToolCommand {
opt
[
Unit
](
"use_same_names"
)
unbounded
()
valueName
"<value>"
action
{
(
x
,
c
)
=>
opt
[
Unit
](
"use_same_names"
)
unbounded
()
valueName
"<value>"
action
{
(
x
,
c
)
=>
c
.
copy
(
filterSameNames
=
false
)
c
.
copy
(
filterSameNames
=
false
)
}
text
"Do not compare samples with the same name"
}
text
"Do not compare samples with the same name"
opt
[
String
](
"rowSampleRegex"
)
unbounded
()
valueName
"<regex>"
action
{
(
x
,
c
)
=>
c
.
copy
(
rowSampleRegex
=
Some
(
x
.
r
))
}
opt
[
String
](
"columnSampleRegex"
)
unbounded
()
valueName
"<regex>"
action
{
(
x
,
c
)
=>
c
.
copy
(
columnSampleRegex
=
Some
(
x
.
r
))
}
}
}
/**
/**
...
@@ -58,9 +66,9 @@ object FindOverlapMatch extends ToolCommand {
...
@@ -58,9 +66,9 @@ object FindOverlapMatch extends ToolCommand {
case
_
=>
sys
.
process
.
stdout
case
_
=>
sys
.
process
.
stdout
}
}
for
(
i1
<-
samplesColumnHeader
)
{
for
(
i1
<-
samplesColumnHeader
if
cmdArgs
.
columnSampleRegex
.
map
(
_
.
findFirstIn
(
i1
.
_1
).
isDefined
).
getOrElse
(
true
)
)
{
val
buffer
=
ListBuffer
[(
String
,
Double
)]()
val
buffer
=
ListBuffer
[(
String
,
Double
)]()
for
(
i2
<-
samplesRowHeader
)
{
for
(
i2
<-
samplesRowHeader
if
cmdArgs
.
rowSampleRegex
.
map
(
_
.
findFirstIn
(
i2
.
_1
).
isDefined
).
getOrElse
(
true
)
)
{
val
value
=
data
(
i1
.
_2
)(
i2
.
_2
).
toDouble
val
value
=
data
(
i1
.
_2
)(
i2
.
_2
).
toDouble
if
(
value
>=
cmdArgs
.
cutoff
&&
(!
cmdArgs
.
filterSameNames
||
i1
.
_2
!=
i2
.
_2
))
{
if
(
value
>=
cmdArgs
.
cutoff
&&
(!
cmdArgs
.
filterSameNames
||
i1
.
_2
!=
i2
.
_2
))
{
buffer
.+=((
i2
.
_1
,
value
))
buffer
.+=((
i2
.
_1
,
value
))
...
...
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