Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
8050fea0
Commit
8050fea0
authored
14 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
SE-242 remove unused class
SVN: 15718
parent
180f4d98
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/library_tools/ImageAnalysisLMCSplitter.java
+0
-98
0 additions, 98 deletions
...nt/web/server/library_tools/ImageAnalysisLMCSplitter.java
with
0 additions
and
98 deletions
screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/library_tools/ImageAnalysisLMCSplitter.java
deleted
100644 → 0
+
0
−
98
View file @
180f4d98
/*
* Copyright 2010 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
ch.systemsx.cisd.openbis.plugin.screening.client.web.server.library_tools
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.StringUtils
;
import
com.csvreader.CsvReader
;
/**
* Splits a file with image analysis results for all plates into a set of files, one for each plate.
*
* @author Tomasz Pylak
*/
public
class
ImageAnalysisLMCSplitter
{
private
static
final
String
SEPARATOR
=
","
;
public
static
void
main
(
String
[]
args
)
throws
FileNotFoundException
,
IOException
{
if
(
args
.
length
!=
1
)
{
System
.
err
.
println
(
"There should be exactly one parameter: <image-analysis-results-file-path>"
);
return
;
}
File
file
=
new
File
(
args
[
0
]);
if
(
file
.
isFile
()
==
false
)
{
System
.
err
.
println
(
file
+
" does not exist or is not a file."
);
return
;
}
CsvReader
reader
=
ScreeningLibraryTransformer
.
readFile
(
new
FileInputStream
(
file
));
boolean
ok
=
reader
.
readRecord
();
assert
ok
;
String
[]
header
=
reader
.
getValues
();
splitPlates
(
reader
,
header
);
}
private
static
void
splitPlates
(
CsvReader
reader
,
String
[]
header
)
throws
IOException
,
FileNotFoundException
{
String
prevPlateCode
=
""
;
OutputStream
out
=
null
;
while
(
reader
.
readRecord
())
{
String
[]
row
=
reader
.
getValues
();
String
plateCode
=
row
[
0
];
if
(
plateCode
.
equals
(
prevPlateCode
)
==
false
)
{
if
(
out
!=
null
)
{
out
.
close
();
}
System
.
out
.
println
(
"Generating "
+
plateCode
);
out
=
new
FileOutputStream
(
new
File
(
plateCode
+
".csv"
));
writeLine
(
header
,
out
);
prevPlateCode
=
plateCode
;
}
writeLine
(
row
,
out
);
}
}
private
static
void
writeLine
(
String
[]
header
,
OutputStream
out
)
throws
IOException
{
IOUtils
.
write
(
join
(
header
)
+
"\n"
,
out
);
}
private
static
String
join
(
String
[]
tokens
)
{
for
(
int
i
=
0
;
i
<
tokens
.
length
;
i
++)
{
tokens
[
i
]
=
tokens
[
i
].
replace
(
';'
,
','
);
}
return
StringUtils
.
join
(
tokens
,
SEPARATOR
);
}
}
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