Skip to content

Commit 3e0efad

Browse files
committed
temp decompress flag added
1 parent 7ca1c07 commit 3e0efad

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pangolin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
_program = "pangolin"
2-
__version__ = "2.1.7"
2+
__version__ = "2.1.8"

pangolin/command.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def main(sysargs = sys.argv[1:]):
3636
parser.add_argument('-n', '--dry-run', action='store_true',help="Go through the motions but don't actually run")
3737
parser.add_argument('--tempdir',action="store",help="Specify where you want the temp stuff to go. Default: $TMPDIR")
3838
parser.add_argument("--no-temp",action="store_true",help="Output all intermediate files, for dev purposes.")
39+
parser.add_argument('--temp-decompress',action="store_true",dest="temp_decompress",help="Don't try to permanently decompress the model file.")
3940
parser.add_argument('--max-ambig', action="store", default=0.5, type=float,help="Maximum proportion of Ns allowed for pangolin to attempt assignment. Default: 0.5",dest="maxambig")
4041
parser.add_argument('--min-length', action="store", default=10000, type=int,help="Minimum query length allowed for pangolin to attempt assignment. Default: 10000",dest="minlen")
4142
parser.add_argument('--panGUIlin', action='store_true',help="Run web-app version of pangolin",dest="panGUIlin")
@@ -47,6 +48,7 @@ def main(sysargs = sys.argv[1:]):
4748
parser.add_argument("-v","--version", action='version', version=f"pangolin {__version__}")
4849
parser.add_argument("-lv","--lineages-version", action='version', version=f"lineages {lineages.__version__}",help="show lineages's version number and exit")
4950
parser.add_argument("-pv","--pangoLEARN-version", action='version', version=f"pangoLEARN {pangoLEARN.__version__}",help="show pangoLEARN's version number and exit")
51+
5052

5153
if len(sysargs)<1:
5254
parser.print_help()
@@ -245,13 +247,14 @@ def main(sysargs = sys.argv[1:]):
245247
print("""Check your environment, didn't find appropriate files from the pangoLEARN repo.\n Trained model must be installed, please see https://cov-lineages.org/pangolin.html for installation instructions.""")
246248
exit(1)
247249
else:
248-
if("compressed_model_size" in config):
249-
if os.path.getsize(trained_model) <= config["compressed_model_size"] + 10:
250-
print("Decompressing model and header files")
251-
model = joblib.load(trained_model)
252-
joblib.dump(model, trained_model, compress=0)
253-
headers = joblib.load(header_file)
254-
joblib.dump(headers, header_file, compress=0)
250+
if not args.temp_decompress:
251+
if "compressed_model_size" in config:
252+
if os.path.getsize(trained_model) <= config["compressed_model_size"] + 10:
253+
print("Decompressing model and header files")
254+
model = joblib.load(trained_model)
255+
joblib.dump(model, trained_model, compress=0)
256+
headers = joblib.load(header_file)
257+
joblib.dump(headers, header_file, compress=0)
255258

256259
print("\nData files found")
257260
print(f"Trained model:\t{trained_model}")

0 commit comments

Comments
 (0)