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
d6f9dc8b
Commit
d6f9dc8b
authored
9 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Init version of new tool
parent
18184194
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-tools/src/main/scala/nl/lumc/sasc/biopet/tools/ImputeToVcf.scala
+65
-0
65 additions, 0 deletions
...rc/main/scala/nl/lumc/sasc/biopet/tools/ImputeToVcf.scala
with
65 additions
and
0 deletions
public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/ImputeToVcf.scala
0 → 100644
+
65
−
0
View file @
d6f9dc8b
package
nl.lumc.sasc.biopet.tools
import
java.io.File
import
java.util
import
htsjdk.tribble.index.IndexCreator
import
htsjdk.variant.variantcontext.writer.
{
Options
,
VariantContextWriterBuilder
,
AsyncVariantContextWriter
}
import
htsjdk.variant.vcf._
import
nl.lumc.sasc.biopet.utils.ToolCommand
import
scala.io.Source
/**
* Created by pjvanthof on 15/03/16.
*/
object
ImputeToVcf
extends
ToolCommand
{
case
class
Args
(
inputGenotypes
:
File
=
null
,
inputInfo
:
Option
[
File
]
=
None
,
outputVcf
:
File
=
null
,
sampleFile
:
File
=
null
,
referenceFasta
:
Option
[
File
]
=
None
)
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'g'
,
"inputGenotypes"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
inputGenotypes
=
x
)
}
text
"Input genotypes"
opt
[
File
](
'i'
,
"inputInfo"
)
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
inputInfo
=
Some
(
x
))
}
text
"Input info fields"
opt
[
File
](
'o'
,
"outputVcf"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
outputVcf
=
x
)
}
text
"Output vcf file"
opt
[
File
](
's'
,
"samplesFile"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
sampleFile
=
x
)
}
text
"Samples file"
opt
[
File
](
'R'
,
"referenceFasta"
)
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
referenceFasta
=
Some
(
x
))
}
text
"reference fasta file"
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
argsParser
=
new
OptParser
val
cmdArgs
=
argsParser
.
parse
(
args
,
Args
()).
getOrElse
(
throw
new
IllegalArgumentException
)
val
samples
=
new
util
.
HashSet
[
String
]()
Source
.
fromFile
(
cmdArgs
.
sampleFile
).
getLines
().
toArray
.
drop
(
2
).
map
(
_
.
split
(
"\t"
).
head
).
foreach
(
samples
.
add
(
_
))
val
metaLines
=
new
util
.
HashSet
[
VCFHeaderLine
]()
metaLines
.
add
(
new
VCFFormatHeaderLine
(
"PL"
,
VCFHeaderLineCount
.
UNBOUNDED
,
VCFHeaderLineType
.
Float
,
""
))
//TODO: Add reference dict
val
header
=
new
VCFHeader
(
metaLines
,
samples
)
val
writer
=
new
AsyncVariantContextWriter
(
new
VariantContextWriterBuilder
()
.
setOutputFile
(
cmdArgs
.
outputVcf
)
.
unsetOption
(
Options
.
INDEX_ON_THE_FLY
)
//.setReferenceDictionary(header.getSequenceDictionary)
.
build
)
writer
.
writeHeader
(
header
)
writer
.
close
()
}
}
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