Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow GNPS2 mirror to be parameterized and passed as command line argument #952

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion metatlas/untargeted/run_untargeted_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main():

##### Step 5/7: Submitting new FBMN jobs to GNPS2
mzm.submit_fbmn_jobs(output_dir=args.output_dir, overwrite_fbmn=args.overwrite_fbmn, direct_input=args.direct_input, skip_fbmn_submit=step_bools[4], \
raw_data_dir=args.raw_data_dir,raw_data_subdir=args.raw_data_subdir)
mirror_raw_data=args.mirror_raw_data, mirror_mzmine_results=args.mirror_mzmine_results, raw_data_dir=args.raw_data_dir,raw_data_subdir=args.raw_data_subdir)

##### Step 6/7: Checking for completed FBMN jobs and downloading results
mzm.download_fbmn_results(output_dir=args.output_dir, overwrite_fbmn=args.overwrite_fbmn,direct_input=args.direct_input, \
Expand Down Expand Up @@ -82,6 +82,9 @@ def add_arguments(parser):
parser.add_argument('--nonpolar_solvent_front', type=float, default=0.5, help='Retention time to use as C18/LIPID solvent front (mins) for filtering features')
## Step 3 only
parser.add_argument('--overwrite_mzmine', type=bool, default=False, help='Overwrite existing mzmine results files that are already in the output directory')
## Step 5 only
parser.add_argument('--mirror_raw_data', type=bool, default=True, help='Mirror raw data files to GNPS2')
parser.add_argument('--mirror_mzmine_results', type=bool, default=True, help='Mirror mzmine results files to GNPS2')
## Step 7 only
parser.add_argument('--download_dir', type=str, default='/global/cfs/cdirs/metatlas/projects/untargeted_outputs', help='Path to the download folder')
parser.add_argument('--overwrite_zip',type=bool, default=False, help='Overwrite existing zip files in download folder')
Expand Down
11 changes: 7 additions & 4 deletions metatlas/untargeted/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,8 @@ def submit_fbmn_jobs(
overwrite_fbmn: bool,
output_dir: str,
skip_fbmn_submit: bool,
mirror_raw_data: bool,
mirror_mzmine_results: bool,
direct_input: Optional[str] = None,
raw_data_dir: Optional[str] = None,
raw_data_subdir: Optional[str] = None
Expand Down Expand Up @@ -1228,8 +1230,10 @@ def submit_fbmn_jobs(

# Get mzmine results files and raw data to GNPS2 before starting FBMN job
logging.info(tab_print("Ensuring MZmine results are at GNPS2 before submitting FBMN job...", 2))
mirror_mzmine_results_to_gnps2(project=project_name,polarity=polarity,output_dir=output_dir,username="bpbowen")
mirror_raw_data_to_gnps2(project=project_name,polarity=polarity,username="bpbowen",raw_data_dir=raw_data_dir,raw_data_subdir=raw_data_subdir)
if mirror_mzmine_results is True:
mirror_mzmine_results_to_gnps2(project=project_name,polarity=polarity,output_dir=output_dir,username="bpbowen")
if mirror_raw_data is True:
mirror_raw_data_to_gnps2(project=project_name,polarity=polarity,username="bpbowen",raw_data_dir=raw_data_dir,raw_data_subdir=raw_data_subdir)

description = '%s_%s'%(project_name,polarity)
spectra_file = f'USERUPLOAD/bpbowen/untargeted_tasks/{project_name}_{polarity}/{project_name}_{polarity}.mgf'
Expand Down Expand Up @@ -1874,8 +1878,7 @@ def update_new_untargeted_tasks(
output_dir: str,
direct_input: Optional[str] = None,
raw_data_dir: Optional[str] = None,
raw_data_subdir: Optional[str] = None,

raw_data_subdir: Optional[str] = None
) -> None:
"""
This script is called by run_mzmine.py before the untargeted pipeline kicks off
Expand Down
Loading