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
cd041e3f
Commit
cd041e3f
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Adding basic testing
parent
41a9e407
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/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordTest.scala
+63
-0
63 additions, 0 deletions
...a/nl/lumc/sasc/biopet/utils/intervals/BedRecordTest.scala
with
63 additions
and
0 deletions
public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/utils/intervals/BedRecordTest.scala
0 → 100644
+
63
−
0
View file @
cd041e3f
package
nl.lumc.sasc.biopet.utils.intervals
import
org.scalatest.Matchers
import
org.scalatest.testng.TestNGSuite
import
org.testng.annotations.Test
/**
* Created by pjvanthof on 24/08/15.
*/
class
BedRecordTest
extends
TestNGSuite
with
Matchers
{
@Test
def
testLineParse
:
Unit
=
{
BedRecord
(
"chrQ"
,
0
,
4
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
4
)
BedRecord
.
fromLine
(
"chrQ\t0\t4"
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
4
)
BedRecord
.
fromLine
(
"chrQ\t0\t4\tname\t3\t+"
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
4
,
Some
(
"name"
),
Some
(
3.0
),
Some
(
true
))
BedRecord
.
fromLine
(
"chrQ\t0\t4\tname\t3\t+\t1\t3"
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
4
,
Some
(
"name"
),
Some
(
3.0
),
Some
(
true
),
Some
(
1
),
Some
(
3
))
BedRecord
.
fromLine
(
"chrQ\t0\t4\tname\t3\t+\t1\t3\t255,0,0"
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
4
,
Some
(
"name"
),
Some
(
3.0
),
Some
(
true
),
Some
(
1
),
Some
(
3
),
Some
((
255
,
0
,
0
)))
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\t+\t1\t3\t255,0,0\t2\t10,20\t20,50"
)
shouldBe
BedRecord
(
"chrQ"
,
0
,
100
,
Some
(
"name"
),
Some
(
3.0
),
Some
(
true
),
Some
(
1
),
Some
(
3
),
Some
((
255
,
0
,
0
)),
Some
(
2
),
IndexedSeq
(
10
,
20
),
IndexedSeq
(
20
,
50
))
}
@Test
def
testLineOutput
:
Unit
=
{
BedRecord
(
"chrQ"
,
0
,
4
).
toString
shouldBe
"chrQ\t0\t4"
BedRecord
.
fromLine
(
"chrQ\t0\t4"
).
toString
shouldBe
"chrQ\t0\t4"
}
@Test
def
testOverlap
:
Unit
=
{
BedRecord
(
"chrQ"
,
0
,
4
).
overlapWith
(
BedRecord
(
"chrQ"
,
0
,
4
))
shouldBe
true
BedRecord
(
"chrQ"
,
0
,
4
).
overlapWith
(
BedRecord
(
"chrX"
,
0
,
4
))
shouldBe
false
BedRecord
(
"chrQ"
,
0
,
4
).
overlapWith
(
BedRecord
(
"chrQ"
,
4
,
8
))
shouldBe
false
BedRecord
(
"chrQ"
,
0
,
4
).
overlapWith
(
BedRecord
(
"chrQ"
,
3
,
8
))
shouldBe
true
BedRecord
(
"chrQ"
,
4
,
8
).
overlapWith
(
BedRecord
(
"chrQ"
,
0
,
4
))
shouldBe
false
BedRecord
(
"chrQ"
,
3
,
4
).
overlapWith
(
BedRecord
(
"chrQ"
,
0
,
4
))
shouldBe
true
BedRecord
(
"chrQ"
,
3
,
4
).
overlapWith
(
BedRecord
(
"chrQ"
,
4
,
5
))
shouldBe
false
}
@Test
def
testLength
:
Unit
=
{
BedRecord
(
"chrQ"
,
0
,
4
).
length
shouldBe
4
BedRecord
(
"chrQ"
,
0
,
1
).
length
shouldBe
1
BedRecord
(
"chrQ"
,
3
,
4
).
length
shouldBe
1
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\t+\t1\t3\t255,0,0\t2\t10,20\t20,50"
).
exons
.
get
.
foldLeft
(
0
)(
_
+
_
.
length
)
shouldBe
30
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\t+\t1\t3\t255,0,0\t2\t10,20\t20,50"
).
introns
.
get
.
foldLeft
(
0
)(
_
+
_
.
length
)
shouldBe
20
}
@Test
def
testErrors
:
Unit
=
{
BedRecord
(
"chrQ"
,
0
,
3
).
validate
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\t+\t1\t3\t255,0,0\t2\t10,20\t20,50"
).
validate
intercept
[
IllegalArgumentException
]
{
BedRecord
(
"chrQ"
,
0
,
0
).
validate
}
intercept
[
IllegalArgumentException
]
{
BedRecord
(
"chrQ"
,
4
,
3
).
validate
}
intercept
[
IllegalArgumentException
]
{
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\t+\t1\t3\t255,0,0\t2\t10\t50"
).
validate
}
intercept
[
IllegalStateException
]
{
BedRecord
.
fromLine
(
"chrQ\t0\t100\tname\t3\tx\t1\t3\t255,0,0\t2\t10,20\t20,50"
).
validate
}
}
}
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