Skip to content

Commit

Permalink
feat: chip-seq workflow with fasta input (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Oct 29, 2024
1 parent c825c54 commit f3a47dd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/utils/galaxy-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ export async function getWorkflowLandingUrl(
return `${WORKFLOW_LANDING_URL_PREFIX}${encodeURIComponent(id)}?public=true`;
}

function buildFastaUrl(identifier: string): string {
const baseUrl = "https://hgdownload.soe.ucsc.edu/hubs/";
const parts = identifier.split("_");
const formattedPath = `${parts[0]}/${parts[1].slice(0, 3)}/${parts[1].slice(
3,
6
)}/${parts[1].slice(6, 9)}/${identifier}/${identifier}.fa.gz`;
return `${baseUrl}${formattedPath}`;
}

/**
* Get the appropriate `request_state` object for the given workflow ID and reference genome.
* @param workflowId - Workflow ID.
Expand All @@ -69,6 +79,11 @@ function getWorkflowLandingsRequestState(
if (workflowId === WORKFLOW_ID.VARIANT_CALLING && geneModelUrl) {
return {
"Annotation GTF": { ext: "gtf.gz", src: "url", url: geneModelUrl },
"Genome fasta": {
ext: "fasta.gz",
src: "url",
url: buildFastaUrl(referenceGenome),
},
};
}
return { reference_genome: referenceGenome };
Expand Down

0 comments on commit f3a47dd

Please sign in to comment.