Skip to content

Commit

Permalink
v2.0.1 various fixes and minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Feb 5, 2020
1 parent 70598bb commit 0892ace
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions dnacauldron/biotools/sequence_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def load_record(

return record

def _load_records_from_zip_file(zip_file):

def _load_records_from_zip_file(zip_file, use_file_names_as_ids=False):
"""Return all fasta/genbank/snapgene in a zip as biopython records.
Each record gets a ``source_file`` attribute from the zip's file name
Expand Down Expand Up @@ -137,6 +138,10 @@ def _load_records_from_zip_file(zip_file):
record.id = name
record.id = name
record.file_name = f._name_no_extension
if use_file_names_as_ids and single_record:
basename = os.path.basename(record.source_file)
basename_no_extension = os.path.splitext(basename)[0]
record.id = basename_no_extension
for record in new_records:
record.source_file = f._path
records += new_records
Expand Down Expand Up @@ -193,7 +198,9 @@ def load_records_from_files(
for filepath in files:
filename = os.path.basename(filepath)
if filename.lower().endswith("zip"):
records += _load_records_from_zip_file(filepath)
records += _load_records_from_zip_file(
filepath, use_file_names_as_ids=use_file_names_as_ids
)
continue
recs, fmt = load_records_from_file(filepath)
single_record = len(recs) == 1
Expand Down
2 changes: 1 addition & 1 deletion dnacauldron/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0"
__version__ = "2.0.1"

0 comments on commit 0892ace

Please sign in to comment.