Skip to content

Commit e8bfe92

Browse files
committed
feat: add support for multiple pairs in SANGER_READ_RUN value (#473)
1 parent e8935f6 commit e8bfe92

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

app/utils/galaxy-api/entities.ts

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,25 @@ export interface WorkflowUrlParameter {
2424
interface WorkflowPairedCollectionParameter {
2525
class: "Collection";
2626
collection_type: "list:paired";
27-
elements: [
28-
{
29-
class: "Collection";
30-
elements: [
31-
{
32-
class: "File";
33-
filetype: string;
34-
identifier: "forward";
35-
location: string;
36-
},
37-
{
38-
class: "File";
39-
filetype: string;
40-
identifier: "reverse";
41-
location: string;
42-
},
43-
];
44-
identifier: string;
45-
type: "paired";
46-
},
47-
];
27+
elements: Array<{
28+
class: "Collection";
29+
elements: [
30+
{
31+
class: "File";
32+
filetype: string;
33+
identifier: "forward";
34+
location: string;
35+
},
36+
{
37+
class: "File";
38+
filetype: string;
39+
identifier: "reverse";
40+
location: string;
41+
},
42+
];
43+
identifier: string;
44+
type: "paired";
45+
}>;
4846
}
4947

5048
export interface WorkflowLanding {

app/utils/galaxy-api/galaxy-api.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function buildFastaUrl(identifier: string): string {
6262
function paramVariableToRequestValue(
6363
variable: WORKFLOW_PARAMETER_VARIABLE,
6464
geneModelUrl: string | null,
65-
readRuns: string | null,
65+
readRuns: string[] | null,
6666
referenceGenome: string
6767
): WorkflowParameterValue | null {
6868
// Because this `switch` has no default case, and the function doesn't allow `undefined` as a return type,
@@ -85,15 +85,15 @@ function paramVariableToRequestValue(
8585
}
8686
: null;
8787
case WORKFLOW_PARAMETER_VARIABLE.SANGER_READ_RUN: {
88-
if (!readRuns) return null;
89-
// TODO get this info earlier? In particular, it might be better to explicitly get the run accession from ENA rather than getting it from the filenames.
90-
const { forwardUrl, reverseUrl, runAccession } =
91-
getPairedRunUrlsInfo(readRuns);
88+
if (!readRuns?.length) return null;
9289
return {
9390
class: "Collection",
9491
collection_type: "list:paired",
95-
elements: [
96-
{
92+
elements: readRuns.map((readRunsPair) => {
93+
// TODO get this info earlier? In particular, it might be better to explicitly get the run accession from ENA rather than getting it from the filenames.
94+
const { forwardUrl, reverseUrl, runAccession } =
95+
getPairedRunUrlsInfo(readRunsPair);
96+
return {
9797
class: "Collection",
9898
elements: [
9999
{
@@ -111,8 +111,8 @@ function paramVariableToRequestValue(
111111
],
112112
identifier: runAccession,
113113
type: "paired",
114-
},
115-
],
114+
};
115+
}),
116116
};
117117
}
118118
}

0 commit comments

Comments
 (0)