Skip to content

Commit 63dae6b

Browse files
committed
update submit_genbank
1 parent f862cb3 commit 63dae6b

File tree

2 files changed

+45
-15
lines changed

2 files changed

+45
-15
lines changed

pipes/WDL/tasks/tasks_utils.wdl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,3 +1260,29 @@ task filter_sequences_by_length {
12601260
Int sequences_out = read_int("OUT_COUNT")
12611261
}
12621262
}
1263+
1264+
task pair_files_by_basename {
1265+
input {
1266+
Array[File] files
1267+
String left_ext
1268+
String right_ext
1269+
}
1270+
command {
1271+
set -e
1272+
cp ~{sep=' ' files} .
1273+
}
1274+
output {
1275+
Array[File] left_files = glob("*.~{left_ext}")
1276+
Array[File] right_files = glob("*.~{right_ext}")
1277+
Array[Pair[File,File]] file_pairs = zip(left_files, right_files)
1278+
}
1279+
runtime {
1280+
memory: "1 GB"
1281+
cpu: 2
1282+
docker: "ubuntu"
1283+
disks: "local-disk 100 HDD"
1284+
disk: "100 GB" # TES
1285+
dx_instance_type: "mem1_ssd1_v2_x2"
1286+
maxRetries: 2
1287+
}
1288+
}
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version 1.0
22

3+
import "../tasks/tasks_utils.wdl" as utils
34
import "../tasks/tasks_ncbi_tools.wdl" as ncbi_tools
4-
import "../tasks/tasks_terra.wdl" as terra
55

6-
workflow submit_sra {
6+
workflow submit_genbank {
77
meta {
88
description: "Submit FTP-eligible genomes to NCBI Genbank (currently only flu A/B/C and SARS-CoV-2)"
99
author: "Broad Viral Genomics"
@@ -12,30 +12,34 @@ workflow submit_sra {
1212
}
1313

1414
input {
15-
#Array[File] submission_files
15+
Array[File] submission_files # paired xml and zip files with same basenames
1616
String batch_id
1717

18-
File genbank_xml
19-
File genbank_zip
20-
2118
File ncbi_ftp_config_js
2219
String prod_test = "Production" # Production or Test
2320
}
2421

2522
String prefix = "/~{prod_test}/~{batch_id}"
2623

27-
# TO DO: work in progress, not ready yet
28-
29-
call ncbi_tools.ncbi_sftp_upload as genbank_upload {
24+
call utils.pair_files_by_basename {
3025
input:
31-
config_js = ncbi_ftp_config_js,
32-
submission_xml = genbank_xml,
33-
additional_files = [genbank_zip],
34-
target_path = "~{prefix}/genbank",
35-
wait_for = "1"
26+
left_ext = ".xml",
27+
right_ext = ".zip",
28+
files = submission_files
29+
}
30+
31+
scatter(file_pair in pair_files_by_basename.file_pairs) {
32+
call ncbi_tools.ncbi_sftp_upload as genbank_upload {
33+
input:
34+
config_js = ncbi_ftp_config_js,
35+
submission_xml = file_pair.left,
36+
additional_files = [file_pair.right],
37+
target_path = "~{prefix}/genbank/~{basename(file_pair.right)}",
38+
wait_for = "1"
39+
}
3640
}
3741
3842
output {
39-
Array[File] genbank_response = genbank_upload.reports_xmls
43+
Array[File] genbank_response = flatten(genbank_upload.reports_xmls)
4044
}
4145
}

0 commit comments

Comments
 (0)