Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
legacy
bedtools2
Commits
e2b4e53b
Commit
e2b4e53b
authored
May 26, 2015
by
Aaron Quinlan
Browse files
Merge pull request #242 from gtamazian/getfasta-fixes
Getfasta fixes
parents
5827f9c1
0b736751
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/utils/Fasta/Fasta.cpp
View file @
e2b4e53b
...
...
@@ -244,7 +244,14 @@ void FastaReference::open(string reffilename, bool usemmap, bool useFullHeader)
struct
stat
stFileInfo
;
string
indexFileName
=
filename
+
index
->
indexFileExtension
();
// if we can find an index file, use it
if
(
stat
(
indexFileName
.
c_str
(),
&
stFileInfo
)
==
0
)
{
if
(
stat
(
indexFileName
.
c_str
(),
&
stFileInfo
)
==
0
)
{
// check if the index file is older than the FASTA file
struct
stat
index_attrib
,
fasta_attrib
;
stat
(
indexFileName
.
c_str
(),
&
index_attrib
);
stat
(
reffilename
.
c_str
(),
&
fasta_attrib
);
if
(
fasta_attrib
.
st_mtime
>
index_attrib
.
st_mtime
)
{
cerr
<<
"Warning: the index file is older than the FASTA file."
<<
endl
;
}
index
->
readIndexFile
(
indexFileName
);
}
else
{
// otherwise, read the reference and generate the index file in the cwd
cerr
<<
"index file "
<<
indexFileName
<<
" not found, generating..."
<<
endl
;
...
...
test/getfasta/test-getfasta.sh
View file @
e2b4e53b
...
...
@@ -88,7 +88,7 @@ AGCTYRWSKMDVHBXN
agctyrwskmdvhbxn"
>
exp
$BT
getfasta
-fi
test.iupac.fa
-bed
test.iupac.bed
-fo
-
>
obs
check obs exp
rm
obs exp
rm
obs exp
test.iupac.fa.fai
# test IUPAC revcomp
...
...
@@ -100,4 +100,23 @@ NXVDBHKMSWYRAGCT
nxvdbhkmswyragct"
>
exp
$BT
getfasta
-fi
test.iupac.fa
-bed
test.iupac.bed
-s
-fo
-
>
obs
check obs exp
rm
obs exp
rm
obs exp test.iupac.fa.fai
# test the warning about an outdated FASTA index file
echo
" getfasta.t10...
\c
"
echo
\
">chr1
cggggggggg
>chr2
AAATTTTTTTTTT"
>
test.fa
# create an index file
echo
-e
"chr2
\t
2
\t
10"
|
$BT
getfasta
-fi
test.fa
-bed
-
-fo
-
>
/dev/null
# modify the FASTA file in a second
sleep
1
touch
test.fa
echo
-e
"chr2
\t
2
\t
10"
|
$BT
getfasta
-fi
test.fa
-bed
-
-fo
-
\
>
/dev/null 2> obs
echo
"Warning: the index file is older than the FASTA file."
>
exp
check obs exp
rm
obs exp test.fa test.fa.fai
test/getfasta/test.iupac.bed
0 → 100644
View file @
e2b4e53b
1 0 16 1 1000 -
2 0 16 1 1000 -
test/getfasta/test.iupac.fa
0 → 100644
View file @
e2b4e53b
>1
AGCTYRWSKMDVHBXNACGT
>2
agctyrwskmdvhbxnacgt
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