Skip to content

Commit

Permalink
Change build_index to only occur for old index
Browse files Browse the repository at this point in the history
In current implementation a new index file will be created if the index file modification time is older than, or equal, to the fasta file. In some cases, e.g. if the files are downloaded as part of an external bundle, the modification times could be equal for all files. In such cases you often want to preserve the original index.

Fix this by only building index if the index is older than the fasta file. If they have equal mtime, it will be used instead.
  • Loading branch information
Svein Tore Koksrud Seljebotn committed May 12, 2015
1 parent b48001a commit 0311c2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyfaidx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def __init__(self, filename, default_seq=None, key_function=None,

self.mutable = mutable

if os.path.exists(self.indexname) and getmtime(self.indexname) > getmtime(self.filename):
if os.path.exists(self.indexname) and getmtime(self.indexname) >= getmtime(self.filename):
self.read_fai(split_char)
else:
try:
Expand Down

0 comments on commit 0311c2f

Please sign in to comment.