Skip to content

Commit 9564475

Browse files
authored
fix: use ascp instead of ena ftp (1017) (#1035)
1 parent 198d956 commit 9564475

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
import { UcscTrack } from "../ucsc-tracks-api/entities";
2626

2727
const DOCKSTORE_API_URL = "https://dockstore.org/api/ga4gh/trs/v2/tools";
28+
const FTP_HOST = "ftp.sra.ebi.ac.uk";
29+
const ASCP_HOST = "fasp.sra.ebi.ac.uk";
2830

2931
const galaxyInstanceUrl = process.env.NEXT_PUBLIC_GALAXY_INSTANCE_URL;
3032

@@ -444,7 +446,7 @@ function getRunUrlsInfo(
444446
if (splitUrls.length === 1) {
445447
// Single read case
446448
return {
447-
forward: { md5: splitMd5Hashes[0], url: `ftp://${splitUrls[0]}` },
449+
forward: { md5: splitMd5Hashes[0], url: ftpToAscp(splitUrls[0]) },
448450
reverse: null,
449451
};
450452
}
@@ -457,7 +459,7 @@ function getRunUrlsInfo(
457459
const [, , readIndex] = urlMatch;
458460
const fileInfo: EnaFileInfo = {
459461
md5: splitMd5Hashes[i],
460-
url: `ftp://${url}`,
462+
url: ftpToAscp(url),
461463
};
462464
if (readIndex === "1") forward = fileInfo;
463465
else reverse = fileInfo;
@@ -466,6 +468,11 @@ function getRunUrlsInfo(
466468
return { forward, reverse };
467469
}
468470

471+
function ftpToAscp(ftpUrl: string): string {
472+
// should be more reliable than FTP download
473+
return `ascp://${ftpUrl.replace(FTP_HOST, ASCP_HOST)}`;
474+
}
475+
469476
function buildUcscTracksRequestValues(
470477
tracks: UcscTrack[] | null
471478
): GalaxyUrlData[] {

0 commit comments

Comments
 (0)