Skip to content

Commit

Permalink
FTP folder bug fix submit.py (#34)
Browse files Browse the repository at this point in the history
Some FTP accounts have the folder structure /submit/Production/ instead of /Production/. This fix automatically corrects for this difference in folder structure.
  • Loading branch information
dthoward96 authored Feb 23, 2024
1 parent f7cb198 commit 0304732
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,20 @@ def submit_ncbi(database, submission_name, submission_dir, config_dict, submissi
print("If this is not a '" + submission_type + "' submission, interrupts submission immediately.", file=sys.stdout)
print("\n"+"Connecting to NCBI FTP Server", file=sys.stdout)
print("Submission name: " + submission_name, file=sys.stdout)
# CD to to test/production folder
# Check FTP folder structure either /submit/Production/ or /Production/
if submission_type not in ftp.nlst():
# Check if submit folder exists
if "submit" in ftp.nlst():
ftp.cwd("submit")
# If submit folder exists check if Production/Test folder exists
if submission_type not in ftp.nlst():
print("Error: Cannot find submission folder on NCBI FTP site.", file=sys.stderr)
sys.exit(1)
else:
print("Error: Cannot find submission folder on NCBI FTP site.", file=sys.stderr)
sys.exit(1)
ftp.cwd(submission_type)
# Create submission directory if it does not exist
# Create submission name directory if it does not exist
if ncbi_submission_name not in ftp.nlst():
ftp.mkd(ncbi_submission_name)
# CD to submission folder
Expand Down

0 comments on commit 0304732

Please sign in to comment.