Muhamed-Kheir commited on
Commit
af845d2
·
verified ·
1 Parent(s): fc7f0d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -60,12 +60,27 @@ def run_prediction(unknown_files, kmer_zip, seqtype, mode, identity, coverage, f
60
 
61
  # Copy unknown FASTAs
62
  for idx, f in enumerate(unknown_files, start=1):
63
- src = getattr(f, "path", None) or getattr(f, "name", None) or str(f)
64
- orig = getattr(f, "orig_name", None) or getattr(f, "filename", None) or os.path.basename(src)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- # Ensure a valid fasta extension for readability (parser doesn't require it, but it's cleaner)
67
- if not orig.lower().endswith(FASTA_EXTS):
68
- orig = f"unknown_{idx}.fasta"
69
 
70
  shutil.copy(src, os.path.join(unknown_dir, os.path.basename(orig)))
71
 
 
60
 
61
  # Copy unknown FASTAs
62
  for idx, f in enumerate(unknown_files, start=1):
63
+ src = getattr(f, "path", None) or getattr(f, "name", None) or str(f)
64
+ orig = (
65
+ getattr(f, "orig_name", None)
66
+ or getattr(f, "filename", None)
67
+ or os.path.basename(src)
68
+ )
69
+
70
+ lower = orig.lower()
71
+
72
+ # ZIP → extract FASTA files
73
+ if lower.endswith(".zip") or src.lower().endswith(".zip"):
74
+ _safe_extract_zip(src, unknown_dir)
75
+ continue
76
+
77
+ # FASTA file
78
+ if not lower.endswith((".fa", ".fasta", ".fas", ".fna")):
79
+ continue
80
+
81
+ dst = os.path.join(unknown_dir, os.path.basename(orig))
82
+ shutil.copy(src, dst)
83
 
 
 
 
84
 
85
  shutil.copy(src, os.path.join(unknown_dir, os.path.basename(orig)))
86