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
23f8d8aa
Commit
23f8d8aa
authored
9 years ago
by
Sander Bollen
Browse files
Options
Downloads
Patches
Plain Diff
slight refactor for readability purposes
parent
54673e3d
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/BastyGenerateFasta.scala
+27
-8
27 additions, 8 deletions
.../scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
with
27 additions
and
8 deletions
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/BastyGenerateFasta.scala
+
27
−
8
View file @
23f8d8aa
...
...
@@ -17,7 +17,7 @@ package nl.lumc.sasc.biopet.tools
import
java.io.
{
File
,
PrintWriter
}
import
htsjdk.samtools.SamReaderFactory
import
htsjdk.samtools.
{
SAMSequenceRecord
,
SamReaderFactory
}
import
htsjdk.samtools.reference.IndexedFastaSequenceFile
import
htsjdk.variant.variantcontext.VariantContext
import
htsjdk.variant.vcf.VCFFileReader
...
...
@@ -28,6 +28,7 @@ import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import
scala.collection.JavaConversions._
import
scala.collection.mutable.ListBuffer
import
scala.collection.parallel.ParMap
class
BastyGenerateFasta
(
val
root
:
Configurable
)
extends
ToolCommandFuntion
with
Reference
{
javaMainClass
=
getClass
.
getName
...
...
@@ -165,8 +166,12 @@ object BastyGenerateFasta extends ToolCommand {
val
argsParser
=
new
OptParser
cmdArgs
=
argsParser
.
parse
(
args
,
Args
())
getOrElse
sys
.
exit
(
1
)
if
(
cmdArgs
.
outputVariants
!=
null
)
writeVariantsOnly
()
if
(
cmdArgs
.
outputConsensus
!=
null
||
cmdArgs
.
outputConsensusVariants
!=
null
)
writeConsensus
()
if
(
cmdArgs
.
outputVariants
!=
null
)
{
writeVariantsOnly
()
}
if
(
cmdArgs
.
outputConsensus
!=
null
||
cmdArgs
.
outputConsensusVariants
!=
null
)
{
writeConsensus
()
}
}
protected
def
writeConsensus
()
{
...
...
@@ -271,14 +276,28 @@ object BastyGenerateFasta extends ToolCommand {
protected
[
tools
]
def
getMaxAllele
(
vcfRecord
:
VariantContext
)(
implicit
cmdArgs
:
Args
)
:
String
=
{
val
maxSize
=
getLongestAllele
(
vcfRecord
).
getBases
.
length
if
(
cmdArgs
.
sampleName
==
null
)
return
fillAllele
(
vcfRecord
.
getReference
.
getBaseString
,
maxSize
)
if
(
cmdArgs
.
sampleName
==
null
)
{
return
fillAllele
(
vcfRecord
.
getReference
.
getBaseString
,
maxSize
)
}
val
genotype
=
vcfRecord
.
getGenotype
(
cmdArgs
.
sampleName
)
if
(
genotype
==
null
)
return
fillAllele
(
""
,
maxSize
)
if
(
genotype
==
null
)
{
return
fillAllele
(
""
,
maxSize
)
}
val
AD
=
if
(
genotype
.
hasAD
)
genotype
.
getAD
else
Array
.
fill
(
vcfRecord
.
getAlleles
.
size
())(
cmdArgs
.
minAD
)
if
(
AD
==
null
)
return
fillAllele
(
""
,
maxSize
)
if
(
AD
==
null
)
{
return
fillAllele
(
""
,
maxSize
)
}
val
maxADid
=
AD
.
zipWithIndex
.
maxBy
(
_
.
_1
).
_2
if
(
AD
(
maxADid
)
<
cmdArgs
.
minAD
)
return
fillAllele
(
""
,
maxSize
)
if
(
AD
(
maxADid
)
<
cmdArgs
.
minAD
)
{
return
fillAllele
(
""
,
maxSize
)
}
fillAllele
(
vcfRecord
.
getAlleles
()(
maxADid
).
getBaseString
,
maxSize
)
}
}
\ 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