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
20c25a0b
Commit
20c25a0b
authored
10 years ago
by
Peter van 't Hof
Browse files
Options
Downloads
Patches
Plain Diff
Added checks
parent
0886c76f
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
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
+4
-2
4 additions, 2 deletions
.../scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
with
4 additions
and
2 deletions
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
+
4
−
2
View file @
20c25a0b
...
@@ -9,6 +9,7 @@ import nl.lumc.sasc.biopet.core.ToolCommand
...
@@ -9,6 +9,7 @@ import nl.lumc.sasc.biopet.core.ToolCommand
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.core.config.Configurable
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
,
Argument
}
import
org.broadinstitute.gatk.utils.commandline.
{
Input
,
Output
,
Argument
}
import
scala.collection.JavaConversions._
import
scala.collection.JavaConversions._
import
nl.lumc.sasc.biopet.util.VcfUtils._
class
BastyGenerateFasta
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
{
class
BastyGenerateFasta
(
val
root
:
Configurable
)
extends
BiopetJavaCommandLineFunction
{
javaMainClass
=
getClass
.
getName
javaMainClass
=
getClass
.
getName
...
@@ -92,6 +93,8 @@ object BastyGenerateFasta extends ToolCommand {
...
@@ -92,6 +93,8 @@ object BastyGenerateFasta extends ToolCommand {
}
}
def
writeVariantsOnly
()
{
def
writeVariantsOnly
()
{
if
(
commandArgs
.
inputVcf
==
null
)
throw
new
IllegalStateException
(
"To write outputVariants input vcf is required, please use --outputVariants option"
)
if
(!
commandArgs
.
inputVcf
.
exists
)
throw
new
IllegalStateException
(
"File does not exist: "
+
commandArgs
.
inputVcf
)
val
writer
=
new
PrintWriter
(
commandArgs
.
outputVariants
)
val
writer
=
new
PrintWriter
(
commandArgs
.
outputVariants
)
writer
.
println
(
">"
+
commandArgs
.
sampleName
)
writer
.
println
(
">"
+
commandArgs
.
sampleName
)
val
vcfReader
=
new
VCFFileReader
(
commandArgs
.
inputVcf
,
false
)
val
vcfReader
=
new
VCFFileReader
(
commandArgs
.
inputVcf
,
false
)
...
@@ -105,8 +108,7 @@ object BastyGenerateFasta extends ToolCommand {
...
@@ -105,8 +108,7 @@ object BastyGenerateFasta extends ToolCommand {
def
getMaxAllele
(
vcfRecord
:
VariantContext
,
sample
:
String
)
:
String
=
{
def
getMaxAllele
(
vcfRecord
:
VariantContext
,
sample
:
String
)
:
String
=
{
val
genotype
=
vcfRecord
.
getGenotype
(
sample
)
val
genotype
=
vcfRecord
.
getGenotype
(
sample
)
val
longestAlleleID
=
vcfRecord
.
getAlleles
.
map
(
_
.
getBases
.
length
).
zipWithIndex
.
maxBy
(
_
.
_1
).
_2
val
maxSize
=
getLongestAllele
(
vcfRecord
).
getBases
.
length
val
maxSize
=
vcfRecord
.
getAlleles
()(
longestAlleleID
).
getBases
.
length
def
fill
(
bases
:
String
)
=
bases
+
(
Array
.
fill
[
Char
](
maxSize
-
bases
.
size
)(
'N'
)).
mkString
def
fill
(
bases
:
String
)
=
bases
+
(
Array
.
fill
[
Char
](
maxSize
-
bases
.
size
)(
'N'
)).
mkString
if
(
commandArgs
.
reference
)
return
fill
(
vcfRecord
.
getReference
.
getBaseString
)
if
(
commandArgs
.
reference
)
return
fill
(
vcfRecord
.
getReference
.
getBaseString
)
...
...
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