Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
8d604404
Commit
8d604404
authored
Jun 05, 2015
by
Peter van 't Hof
Browse files
fai and dict check are not optional
parent
87248d7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/Reference.scala
View file @
8d604404
...
...
@@ -37,10 +37,14 @@ trait Reference extends Configurable {
List
(
"references"
,
referenceSpecies
,
referenceName
)
}
protected
def
faiRequired
=
false
protected
def
dictRequired
=
false
/** Returns the fasta file */
def
referenceFasta
()
:
File
=
{
val
file
:
File
=
config
(
"reference_fasta"
)
Reference
.
checkFasta
(
file
)
checkFasta
(
file
)
val
dict
=
new
File
(
file
.
getAbsolutePath
.
stripSuffix
(
".fa"
).
stripSuffix
(
".fasta"
)
+
".dict"
)
val
fai
=
new
File
(
file
.
getAbsolutePath
+
".fai"
)
...
...
@@ -65,29 +69,32 @@ trait Reference extends Configurable {
"name"
->
referenceName
)
}
}
object
Reference
{
/** Used as cache to avoid double checking */
private
var
checked
:
Set
[
File
]
=
Set
()
//TODO: this become obsolete when index get autogenerated
/** Check fasta file if file exist and index file are there */
def
checkFasta
(
file
:
File
)
:
Unit
=
{
if
(!
checked
.
contains
(
file
))
{
if
(!
Reference
.
checked
.
contains
(
file
))
{
require
(
file
.
exists
(),
"Reference not found: "
+
file
)
val
dict
=
new
File
(
file
.
getAbsolutePath
.
stripSuffix
(
".fa"
).
stripSuffix
(
".fasta"
)
+
".dict"
)
require
(
dict
.
exists
(),
"Reference is missing a dict file"
)
val
fai
=
new
File
(
file
.
getAbsolutePath
+
".fai"
)
require
(
fai
.
exists
(),
"Reference is missing a fai file"
)
if
(
dictRequired
)
{
val
dict
=
new
File
(
file
.
getAbsolutePath
.
stripSuffix
(
".fa"
).
stripSuffix
(
".fasta"
)
+
".dict"
)
require
(
dict
.
exists
(),
"Reference is missing a dict file"
)
}
require
(
IndexedFastaSequenceFile
.
canCreateIndexedFastaReader
(
file
),
"Index of reference cannot be loaded, reference: "
+
file
)
if
(
faiRequired
)
{
val
fai
=
new
File
(
file
.
getAbsolutePath
+
".fai"
)
require
(
fai
.
exists
(),
"Reference is missing a fai file"
)
require
(
IndexedFastaSequenceFile
.
canCreateIndexedFastaReader
(
file
),
"Index of reference cannot be loaded, reference: "
+
file
)
}
checked
+=
file
Reference
.
checked
+=
file
}
}
}
object
Reference
{
/** Used as cache to avoid double checking */
private
var
checked
:
Set
[
File
]
=
Set
()
}
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/gatk/Gatk.scala
View file @
8d604404
...
...
@@ -48,6 +48,8 @@ abstract class Gatk extends BiopetJavaCommandLineFunction with Reference {
@Input
(
required
=
false
)
var
pedigree
:
List
[
File
]
=
config
(
"pedigree"
,
default
=
Nil
)
override
def
dictRequired
=
true
override
def
beforeGraph
:
Unit
=
{
super
.
beforeGraph
if
(
reference
==
null
)
reference
=
referenceFasta
()
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment