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
cbd73126
Commit
cbd73126
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added exeption on duplicate sample/libs
parent
6645955e
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/SamplesTsvToJson.scala
+6
-0
6 additions, 0 deletions
...in/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJson.scala
with
6 additions
and
0 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/SamplesTsvToJson.scala
+
6
−
0
View file @
cbd73126
...
...
@@ -19,6 +19,7 @@ import java.io.File
import
nl.lumc.sasc.biopet.core.ToolCommand
import
nl.lumc.sasc.biopet.utils.ConfigUtils._
import
scala.collection.mutable
import
scala.io.Source
...
...
@@ -47,10 +48,15 @@ object SamplesTsvToJson extends ToolCommand {
val
libraryColumn
=
header
.
indexOf
(
"library"
)
if
(
sampleColumn
==
-
1
)
throw
new
IllegalStateException
(
"sample column does not exist in: "
+
inputFile
)
val
sampleLibCache
:
mutable.Set
[(
String
,
Option
[
String
])]
=
mutable
.
Set
()
val
librariesValues
:
List
[
Map
[
String
,
Any
]]
=
for
(
tsvLine
<-
lines
.
tail
)
yield
{
val
values
=
tsvLine
.
split
(
"\t"
)
val
sample
=
values
(
sampleColumn
)
val
library
=
if
(
libraryColumn
!=
-
1
)
Some
(
values
(
libraryColumn
))
else
None
if
(
sampleLibCache
.
contains
((
sample
,
library
)))
throw
new
IllegalStateException
(
s
"Combination of $sample and $library is found multiple times"
)
else
sampleLibCache
.
add
((
sample
,
library
))
val
valuesMap
=
(
for
(
t
<-
0
until
values
.
size
if
!
values
(
t
).
isEmpty
&&
t
!=
sampleColumn
&&
t
!=
libraryColumn
)
yield
header
(
t
)
->
values
(
t
)).
toMap
...
...
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