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
198fc86c
Commit
198fc86c
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added logging
parent
8883f723
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/RegionAfCount.scala
+18
-5
18 additions, 5 deletions
.../main/scala/nl/lumc/sasc/biopet/tools/RegionAfCount.scala
with
18 additions
and
5 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/RegionAfCount.scala
+
18
−
5
View file @
198fc86c
...
...
@@ -55,6 +55,8 @@ object RegionAfCount extends ToolCommand {
val
argsParser
=
new
OptParser
val
cmdArgs
:
Args
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
logger
.
info
(
"Start"
)
val
regions
=
(
for
(
line
<-
Source
.
fromFile
(
cmdArgs
.
bedFile
).
getLines
())
yield
{
val
values
=
line
.
split
(
"\t"
)
require
(
values
.
length
>=
3
,
"to less columns in bed file"
)
...
...
@@ -63,8 +65,10 @@ object RegionAfCount extends ToolCommand {
new
Interval
(
values
(
0
),
values
(
1
).
toInt
,
values
(
2
).
toInt
,
true
,
name
)
}).
toList
val
counts
=
(
for
(
region
<-
regions
)
yield
region
.
getName
->
{
(
for
(
vcfFile
<-
cmdArgs
.
vcfFiles
)
yield
vcfFile
->
{
var
c
=
0
val
afCounts
=
(
for
(
region
<-
regions
.
par
)
yield
region
.
getName
->
{
val
sum
=
(
for
(
vcfFile
<-
cmdArgs
.
vcfFiles
.
par
)
yield
vcfFile
->
{
val
reader
=
new
VCFFileReader
(
vcfFile
,
true
)
val
it
=
reader
.
query
(
region
.
getContig
,
region
.
getStart
,
region
.
getEnd
)
val
sum
=
(
for
(
v
<-
it
)
yield
{
...
...
@@ -77,14 +81,23 @@ object RegionAfCount extends ToolCommand {
reader
.
close
()
sum
}).
toMap
c
+=
1
if
(
c
%
100
==
0
)
logger
.
info
(
s
"$c regions done"
)
sum
}).
toMap
logger
.
info
(
s
"Done reading, $c regions"
)
val
writer
=
new
PrintWriter
(
cmdArgs
.
outputFile
)
writer
.
println
(
"\t"
+
cmdArgs
.
vcfFiles
.
map
(
_
.
getName
).
mkString
(
"\t"
))
for
(
c
<-
count
s
)
{
writer
.
print
(
c
.
_1
+
"\t"
)
writer
.
println
(
cmdArgs
.
vcfFiles
.
map
(
c
.
_2
(
_
)).
mkString
(
"\t"
))
for
(
r
<-
region
s
)
{
writer
.
print
(
r
.
getName
+
"\t"
)
writer
.
println
(
cmdArgs
.
vcfFiles
.
map
(
afCounts
(
r
.
getName
)
(
_
)).
mkString
(
"\t"
))
}
writer
.
close
()
logger
.
info
(
"Done"
)
}
}
\ No newline at end of file
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