Skip to content

Commit

Permalink
fixing tests and updating data with new models, bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
katiestahl committed Jul 31, 2024
1 parent 6da6b78 commit 88503d5
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 196 deletions.
38 changes: 19 additions & 19 deletions client/src/components/Pages/Structure/Builder/Builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ELEMENT_TEMPLATE = [
{
type: ElementType.geneElement,
nomenclature: "",
element_id: uuid(),
elementId: uuid(),
gene: {
id: "",
type: "",
Expand All @@ -63,11 +63,11 @@ const ELEMENT_TEMPLATE = [
{
type: ElementType.transcriptSegmentElement,
nomenclature: "",
element_id: uuid(),
exon_start: null,
exon_start_offset: null,
exon_end: null,
exon_end_offset: null,
elementId: uuid(),
exonStart: null,
exonStartOffset: null,
exonEnd: null,
exonEndOffset: null,
gene: {
id: "",
type: "",
Expand All @@ -77,12 +77,12 @@ const ELEMENT_TEMPLATE = [
{
nomenclature: "",
type: ElementType.linkerSequenceElement,
element_id: uuid(),
elementId: uuid(),
},
{
nomenclature: "",
type: ElementType.templatedSequenceElement,
element_id: uuid(),
elementId: uuid(),
id: "",
location: {
sequence_id: "",
Expand All @@ -102,18 +102,18 @@ const ELEMENT_TEMPLATE = [
},
{
type: ElementType.unknownGeneElement,
element_id: uuid(),
elementId: uuid(),
nomenclature: "?",
},
{
type: ElementType.multiplePossibleGenesElement,
element_id: uuid(),
elementId: uuid(),
nomenclature: "v",
},
{
type: ElementType.regulatoryElement,
nomenclature: "",
element_id: uuid(),
elementId: uuid(),
},
];

Expand Down Expand Up @@ -148,7 +148,7 @@ const Builder: React.FC = () => {
const sourceClone = Array.from(ELEMENT_TEMPLATE);
const item = sourceClone[source.index];
const newItem = Object.assign({}, item);
newItem.element_id = uuid();
newItem.elementId = uuid();

if (draggableId.includes("RegulatoryElement")) {
setFusion({ ...fusion, ...{ regulatoryElement: newItem } });
Expand Down Expand Up @@ -190,7 +190,7 @@ const Builder: React.FC = () => {

const handleDelete = (uuid: string) => {
let items: Array<ClientElementUnion> = Array.from(fusion.structure);
items = items.filter((item) => item?.element_id !== uuid);
items = items.filter((item) => item?.elementId !== uuid);
setFusion({ ...fusion, ...{ structure: items } });
};

Expand Down Expand Up @@ -414,7 +414,7 @@ const Builder: React.FC = () => {
style={{ display: "flex" }}
>
<Box className="options-container">
{ELEMENT_TEMPLATE.map(({ element_id, type }, index) => {
{ELEMENT_TEMPLATE.map(({ elementId, type }, index) => {
if (
(fusion.type === "AssayedFusion" &&
type !== ElementType.multiplePossibleGenesElement) ||
Expand All @@ -423,8 +423,8 @@ const Builder: React.FC = () => {
) {
return (
<Draggable
key={element_id}
draggableId={type + element_id}
key={elementId}
draggableId={type + elementId}
index={index}
isDragDisabled={
type === ElementType.regulatoryElement &&
Expand Down Expand Up @@ -466,7 +466,7 @@ const Builder: React.FC = () => {
{snapshot.isDragging && (
<Box
style={{ transform: "none !important" }}
key={element_id}
key={elementId}
className={`option-item clone ${type}`}
>
{elementNameMap[type].icon}{" "}
Expand Down Expand Up @@ -526,8 +526,8 @@ const Builder: React.FC = () => {
return (
element && (
<Draggable
key={element.element_id}
draggableId={element.element_id}
key={element.elementId}
draggableId={element.elementId}
index={index}
>
{(provided) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
getGeneNomenclature,
} from "../../../../../services/main";
import StructuralElementInputAccordion from "../StructuralElementInputAccordion";
import React from "react";

interface GeneElementInputProps extends StructuralElementInputProps {
element: ClientGeneElement;
Expand Down Expand Up @@ -70,7 +71,6 @@ const GeneElementInput: React.FC<GeneElementInputProps> = ({
setGene={setGene}
geneText={geneText}
setGeneText={setGeneText}
style={{ width: 125 }}
tooltipDirection="left"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const StructuralElementInputAccordion: React.FC<
inputElements,
validated,
icon,
pendingResponse
pendingResponse,
}) => {
const classes = useStyles();

Expand All @@ -81,20 +81,24 @@ const StructuralElementInputAccordion: React.FC<
<CardHeader
avatar={icon}
action={
pendingResponse ?
<CircularProgress style={{width: "1.25em", height: "1.25em", padding: "8px"}} /> :
<Tooltip title="Delete element">
<IconButton
style={{ cursor: "pointer" }}
onClick={(event) => {
event.stopPropagation();
handleDelete(element.element_id);
}}
onFocus={(event) => event.stopPropagation()}
>
<DeleteIcon />
</IconButton>
</Tooltip>
pendingResponse ? (
<CircularProgress
style={{ width: "1.25em", height: "1.25em", padding: "8px" }}
/>
) : (
<Tooltip title="Delete element">
<IconButton
style={{ cursor: "pointer" }}
onClick={(event) => {
event.stopPropagation();
handleDelete(element.elementId);
}}
onFocus={(event) => event.stopPropagation()}
>
<DeleteIcon />
</IconButton>
</Tooltip>
)
}
title={element.nomenclature ? element.nomenclature : null}
classes={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ const TemplatedSequenceElementInput: React.FC<
const [chromosome, setChromosome] = useState<string>(
element.inputChromosome || ""
);
const [strand, setStrand] = useState<string>(element.strand || "+");
const [strand, setStrand] = useState<string>(
element.strand === 1 ? "+" : "-"
);
const [startPosition, setStartPosition] = useState<string>(
element.inputStart || ""
element.inputStart !== null ? `${element.inputStart}` : ""
);
const [endPosition, setEndPosition] = useState<string>(
element.inputEnd || ""
element.inputEnd !== null ? `${element.inputEnd}` : ""
);
const [inputError, setInputError] = useState<string>("");

Expand Down Expand Up @@ -74,13 +76,14 @@ const TemplatedSequenceElementInput: React.FC<
templatedSequenceResponse.element
).then((nomenclatureResponse) => {
if (nomenclatureResponse.nomenclature) {
console.log(templatedSequenceResponse.element);
const templatedSequenceElement: ClientTemplatedSequenceElement = {
...templatedSequenceResponse.element,
element_id: element.element_id,
elementId: element.elementId,
nomenclature: nomenclatureResponse.nomenclature,
inputChromosome: chromosome,
input_start: startPosition,
input_end: endPosition,
inputStart: Number(startPosition),
inputEnd: Number(endPosition),
};
handleSave(index, templatedSequenceElement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const TxSegmentCompInput: React.FC<TxSegmentElementInputProps> = ({
const [txGene, setTxGene] = useState(element.inputGene || "");
const [txGeneText, setTxGeneText] = useState("");

const [txStrand, setTxStrand] = useState<string>(element.inputStrand || "+");
const [txStrand, setTxStrand] = useState<string>(
element.inputStrand === 1 ? "+" : "-"
);

const [txChrom, setTxChrom] = useState(element.inputChr || "");
const [txChromText, setTxChromText] = useState("");
Expand Down
16 changes: 8 additions & 8 deletions client/src/services/ResponseModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,12 @@ export interface ClientTranscriptSegmentElement {
inputStrand?: Strand | null;
inputGene?: string | null;
inputChr?: string | null;
inputGenomicStart?: number | null;
inputGenomicEnd?: number | null;
inputExonStart?: number | null;
inputExonStartOffset?: number | null;
inputExonEnd?: number | null;
inputExonEndOffset?: number | null;
inputGenomicStart?: string | null;
inputGenomicEnd?: string | null;
inputExonStart?: string | null;
inputExonStartOffset?: string | null;
inputExonEnd?: string | null;
inputExonEndOffset?: string | null;
}
/**
* Gene element used client-side.
Expand All @@ -560,8 +560,8 @@ export interface ClientTemplatedSequenceElement {
region: SequenceLocation;
strand: Strand;
inputChromosome: string | null;
inputStart: number | null;
inputEnd: number | null;
inputStart: string | null;
inputEnd: string | null;
}
/**
* Linker element class used client-side.
Expand Down
18 changes: 8 additions & 10 deletions server/src/curfu/routers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,14 @@ async def get_genome_coords(
if exon_end is not None and exon_end_offset is None:
exon_end_offset = 0

response = (
await request.app.state.fusor.cool_seq_tool.transcript_to_genomic_coordinates(
gene=gene,
transcript=transcript,
exon_start=exon_start,
exon_end=exon_end,
exon_start_offset=exon_start_offset,
exon_end_offset=exon_end_offset,
residue_mode="inter-residue",
)
response = await request.app.state.fusor.cool_seq_tool.ex_g_coords_mapper.transcript_to_genomic_coordinates(
gene=gene,
transcript=transcript,
exon_start=exon_start,
exon_end=exon_end,
exon_start_offset=exon_start_offset,
exon_end_offset=exon_end_offset,
residue_mode="inter-residue",
)
warnings = response.warnings
if warnings:
Expand Down
16 changes: 8 additions & 8 deletions server/src/curfu/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class ClientTranscriptSegmentElement(TranscriptSegmentElement, ClientStructuralE
inputStrand: Strand | None = None
inputGene: str | None = None
inputChr: str | None = None
inputGenomicStart: int | None = None
inputGenomicEnd: int | None = None
inputExonStart: int | None = None
inputExonStartOffset: int | None = None
inputExonEnd: int | None = None
inputExonEndOffset: int | None = None
inputGenomicStart: str | None = None
inputGenomicEnd: str | None = None
inputExonStart: str | None = None
inputExonStartOffset: str | None = None
inputExonEnd: str | None = None
inputExonEndOffset: str | None = None


class ClientLinkerElement(LinkerElement, ClientStructuralElement):
Expand All @@ -69,8 +69,8 @@ class ClientTemplatedSequenceElement(TemplatedSequenceElement, ClientStructuralE
"""Templated sequence element used client-side."""

inputChromosome: str | None
inputStart: int | None
inputEnd: int | None
inputStart: str | None
inputEnd: str | None


class ClientGeneElement(GeneElement, ClientStructuralElement):
Expand Down
Loading

0 comments on commit 88503d5

Please sign in to comment.