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
50b908db
Commit
50b908db
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Fix chromosome stats
parent
9f604dce
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/VcfStats.scala
+15
-6
15 additions, 6 deletions
...k/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
with
15 additions
and
6 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
+
15
−
6
View file @
50b908db
...
...
@@ -2,6 +2,7 @@ package nl.lumc.sasc.biopet.tools
import
java.io.
{
FileOutputStream
,
PrintWriter
,
File
}
import
htsjdk.samtools.reference.FastaSequenceFile
import
htsjdk.variant.variantcontext.
{
VariantContext
,
Genotype
}
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.core.summary.
{
SummaryQScript
,
Summarizable
}
...
...
@@ -41,6 +42,7 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction wit
var
genotypeTags
:
List
[
String
]
=
Nil
var
allInfoTags
=
false
var
allGenotypeTags
=
false
var
reference
:
File
=
config
(
"reference"
)
override
def
beforeGraph
:
Unit
=
{
index
=
new
File
(
input
.
getAbsolutePath
+
".tbi"
)
...
...
@@ -61,7 +63,8 @@ class VcfStats(val root: Configurable) extends BiopetJavaCommandLineFunction wit
repeat
(
"--infoTag"
,
infoTags
)
+
repeat
(
"--genotypeTag"
,
genotypeTags
)
+
conditional
(
allInfoTags
,
"--allInfoTags"
)
+
conditional
(
allGenotypeTags
,
"--allGenotypeTags"
)
conditional
(
allGenotypeTags
,
"--allGenotypeTags"
)
+
required
(
"-R"
,
reference
)
/** Returns general stats to the summary */
def
summaryStats
:
Map
[
String
,
Any
]
=
{
...
...
@@ -102,6 +105,7 @@ object VcfStats extends ToolCommand {
/** Commandline argument */
case
class
Args
(
inputFile
:
File
=
null
,
outputDir
:
File
=
null
,
referenceFile
:
File
=
null
,
intervals
:
Option
[
File
]
=
None
,
infoTags
:
List
[
String
]
=
Nil
,
genotypeTags
:
List
[
String
]
=
Nil
,
...
...
@@ -113,6 +117,9 @@ object VcfStats extends ToolCommand {
opt
[
File
](
'I'
,
"inputFile"
)
required
()
unbounded
()
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
inputFile
=
x
)
}
opt
[
File
](
'R'
,
"referenceFile"
)
required
()
unbounded
()
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
referenceFile
=
x
)
}
opt
[
File
](
'o'
,
"outputDir"
)
required
()
unbounded
()
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
c
.
copy
(
outputDir
=
x
)
}
...
...
@@ -256,9 +263,11 @@ object VcfStats extends ToolCommand {
line
.
getID
}).
toList
:::
defaultGenotypeFields
val
referenceFile
=
new
FastaSequenceFile
(
commandArgs
.
referenceFile
,
true
)
val
intervals
:
List
[
Interval
]
=
(
for
(
seq
<-
header
.
getSequenceDictionary
.
getSequences
;
seq
<-
referenceFile
.
getSequenceDictionary
.
getSequences
;
chunks
=
(
seq
.
getSequenceLength
/
10000000
)
+
(
if
(
seq
.
getSequenceLength
%
10000000
==
0
)
0
else
1
);
i
<-
1
to
chunks
)
yield
{
...
...
@@ -331,8 +340,8 @@ object VcfStats extends ToolCommand {
writeField
(
stats
,
"general"
,
commandArgs
.
outputDir
)
for
(
field
<-
(
adInfoTags
).
distinct
.
par
)
{
writeField
(
stats
,
field
,
infoOutputDir
)
for
(
line
<-
header
.
getContigLin
es
)
{
val
chr
=
line
.
getSAMSequenceRecord
.
getSequenceName
for
(
line
<-
referenceFile
.
getSequenceDictionary
.
getSequenc
es
)
{
val
chr
=
line
.
getSequenceName
writeField
(
stats
,
field
,
new
File
(
infoOutputDir
,
"chrs"
+
File
.
separator
+
chr
),
chr
=
chr
)
}
}
...
...
@@ -341,8 +350,8 @@ object VcfStats extends ToolCommand {
writeGenotypeField
(
stats
,
samples
,
"general"
,
commandArgs
.
outputDir
,
prefix
=
"genotype"
)
for
(
field
<-
(
adGenotypeTags
).
distinct
.
par
)
{
writeGenotypeField
(
stats
,
samples
,
field
,
genotypeOutputDir
)
for
(
line
<-
header
.
getContigLin
es
)
{
val
chr
=
line
.
getSAMSequenceRecord
.
getSequenceName
for
(
line
<-
referenceFile
.
getSequenceDictionary
.
getSequenc
es
)
{
val
chr
=
line
.
getSequenceName
writeGenotypeField
(
stats
,
samples
,
field
,
new
File
(
genotypeOutputDir
,
"chrs"
+
File
.
separator
+
chr
),
chr
=
chr
)
}
}
...
...
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