Skip to content

Commit

Permalink
Merge pull request #1382 from Princeton-LSI-ResearchComputing/study_d…
Browse files Browse the repository at this point in the history
…ir_empty_fix

Study dir empty fix
  • Loading branch information
hepcat72 authored Dec 13, 2024
2 parents e5a855f + 83d0a75 commit 3d73391
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions DataRepo/loaders/msruns_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2337,6 +2337,8 @@ def get_mzxml_files(cls, files=None, dir=None):
return files
if dir is None:
return []
if dir == "":
dir = os.getcwd()
return [
os.path.join(p, fl)
for p, _, fs in os.walk(dir)
Expand Down
8 changes: 5 additions & 3 deletions DataRepo/loaders/study_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ def __init__(self, *args, **kwargs):

# Before the superclass constructor is called, we want to use the file path to get its enclosing directory as a
# default for the (custom derived class argument:) mzxml_dir
study_file = kwargs.get("file")
study_dir = None if study_file is None else os.path.dirname(study_file)
mzxml_dir = kwargs.pop("mzxml_dir", study_dir)
mzxml_dir = kwargs.pop("mzxml_dir", None)
if mzxml_dir is None:
study_file = kwargs.get("file")
study_dir = None if study_file is None else os.path.dirname(study_file)
mzxml_dir = study_dir

self.mzxml_files = MSRunsLoader.get_mzxml_files(dir=mzxml_dir)
self.exclude_sheets = kwargs.pop("exclude_sheets", []) or []
Expand Down
4 changes: 3 additions & 1 deletion DataRepo/management/commands/export_studies.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from django.core.management import BaseCommand

from DataRepo.utils.studies_exporter import StudiesExporter
Expand All @@ -11,7 +13,7 @@ def add_arguments(self, parser):
parser.add_argument(
"--outdir",
required=True,
default=".",
default=os.getcwd(),
help="Directory to create and save exported files.",
)
parser.add_argument(
Expand Down

0 comments on commit 3d73391

Please sign in to comment.