Skip to content

Commit

Permalink
Merge branch 'release_24.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Jan 3, 2025
2 parents 65ca232 + 1d44a55 commit 25d7ab4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
45 changes: 39 additions & 6 deletions client/src/components/Workflow/Editor/modules/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import reportDefault from "@/components/Workflow/Editor/reportDefault";
import { useWorkflowCommentStore, type WorkflowComment } from "@/stores/workflowEditorCommentStore";
import { useWorkflowStateStore } from "@/stores/workflowEditorStateStore";
import { useWorkflowEditorToolbarStore } from "@/stores/workflowEditorToolbarStore";
import { type ConnectionOutputLink, type Steps, useWorkflowStepStore } from "@/stores/workflowStepStore";
import {
type ConnectionOutputLink,
type StepInputConnection,
type Steps,
useWorkflowStepStore,
} from "@/stores/workflowStepStore";

export interface Workflow {
name: string;
Expand Down Expand Up @@ -49,18 +54,32 @@ export async function fromSimple(
// Galaxy assign new ones.
if (options?.reassignIds ?? appendData) {
const stepIdOffset = stepStore.getStepIndex + 1;
const stepArray = Object.values(data.steps);

Object.values(data.steps).forEach((step) => {
// Since we are resigning IDs based on index, ensure correct ordering
stepArray.sort((a, b) => a.id - b.id);

const stepIdMapOldToNew = new Map<number, number>();

stepArray.forEach((step, index) => {
const oldId = step.id;
step.id = index + stepIdOffset;
stepIdMapOldToNew.set(oldId, step.id);
});

stepArray.forEach((step) => {
delete step.uuid;
if (!step.position) {
// Should only happen for manually authored editor content,
// good enough for a first pass IMO.
step.position = { top: step.id * 100, left: step.id * 100 };
}
step.id += stepIdOffset;
step.position.left += defaultPosition.left;
step.position.top += defaultPosition.top;
Object.values(step.input_connections).forEach((link) => {

const newInputConnections: StepInputConnection = {};

Object.entries(step.input_connections).forEach(([key, link]) => {
if (link === undefined) {
console.error("input connections invalid", step.input_connections);
} else {
Expand All @@ -70,11 +89,25 @@ export async function fromSimple(
} else {
linkArray = link;
}
linkArray.forEach((link) => {
link.id += stepIdOffset;

const remappedLinkArray = linkArray.map((link) => {
const newId = stepIdMapOldToNew.get(link.id);

return {
...link,
id: newId,
};
});

// id may be undefined, if the partial Workflow does not contain the step
// in that case, remove the link
const newLinkArray = remappedLinkArray.filter((link) => link.id) as ConnectionOutputLink[];

newInputConnections[key] = newLinkArray;
}
});

step.input_connections = newInputConnections;
});

data.comments.forEach((comment, index) => {
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/config/sample/datatypes_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@
<datatype extension="fits" type="galaxy.datatypes.binary:FITS" mimetype="application/octet-stream" display_in_upload="true" description="Flexible Image Transport System (FITS) used in Astronomy"/>
<datatype extension="chain" type="galaxy.datatypes.chain:Chain" display_in_upload="true" description_url="https://genome.ucsc.edu/goldenPath/help/chain.html"/>
<datatype extension="ucsc.net" type="galaxy.datatypes.chain:Net" display_in_upload="true" description_url="https://genome.ucsc.edu/goldenPath/help/net.html"/>
<datatype extension="bcsp" type="galaxy.datatypes.binary:Binary" mimetype="application/octet-stream" display_in_upload="true" subclass="true" description="Binary format of k-mer hash table which is only compatible with Fairy"/>
</registration>
<sniffers>
<!--
Expand Down

0 comments on commit 25d7ab4

Please sign in to comment.