Skip to content

Commit

Permalink
feat!: use latest object schemas and dependency releases (#293)
Browse files Browse the repository at this point in the history
* build!: updating to vrs 2.0 models

* update pydantic-to-ts2 and update models

* wip: updating models, making variable casing consistent, converting descriptors

* fix: utilities requests

* fix: response model casing

* wip: updating models

* bug fixes

* updating models and fixing validation

* pass around formatted fusion to reduce repeated code

* fixing demo data

* specifying fusion type since null param gets dropped and fusor can't infer the type

* fixing tests and updating data with new models, bug fixes

* bug fixes for input elements

* pin latest fusor

* update dependencies

* fix clientification of demos

* fix formatting in docstrings

* fix type handling of failed lookup

* fix up gene lookup api

* fix tx utils bug

* fix bug where region and strand were incorrect in templated sequence, fix regulatory element missing field, pin pydantic version

* removing console logs

* fix: bug where error messages no longer displayed on summary page

* fixing tests and adjusting variable casing

* add reusable function for checking valid sequence locations

* add reusable function for checking valid sequence locations

* fixing nomenclature bugs

* fixing nomenclature bugs

* DOn't bother w/ semver checks (out of control of this app) and use proper fixture mode

* add assertion notes

* stash changes

* stash

* fix a few fixtures

* sequence util fixes

* minor rearrange

* fix int/str problem

* commit this

* catch static files error

* validation tests

* fix reg element URL

* remove todos

* review comments

---------

Co-authored-by: James Stevenson <[email protected]>
  • Loading branch information
katiestahl and jsstevenson authored Aug 12, 2024
1 parent 91e04e7 commit 43d32d3
Show file tree
Hide file tree
Showing 47 changed files with 1,284 additions and 1,277 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ source venv/bin/activate
python3 -m pip install -e ".[dev,tests]" # make sure to include the extra dependencies!
```

Acquire two sets of static assets and place all of them within the `server/curation/data` directory:
Acquire two sets of static assets and place all of them within the `server/src/curfu/data` directory:

1. Gene autocomplete files, providing legal gene search terms to the client autocomplete component. One file each is used for entity types `aliases`, `assoc_with`, `xrefs`, `prev_symbols`, `labels`, and `symbols`. Each should be named according to the pattern `gene_<type>_<YYYYMMDD>.tsv`. These can be regenerated with the shell command `curfu_devtools genes`.

Expand All @@ -39,7 +39,7 @@ Acquire two sets of static assets and place all of them within the `server/curat
Your data/directory should look something like this:

```
server/curfu/data
server/src/curfu/data
├── domain_lookup_2022-01-20.tsv
├── gene_aliases_suggest_20211025.tsv
├── gene_assoc_with_suggest_20211025.tsv
Expand Down
36 changes: 18 additions & 18 deletions client/src/components/Pages/Assay/Assay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,52 +61,52 @@ export const Assay: React.FC<Props> = () => {

// initialize field values
const [fusionDetection, setFusionDetection] = useState(
fusion?.assay?.fusion_detection !== undefined
? fusion?.assay?.fusion_detection
fusion?.assay?.fusionDetection !== undefined
? fusion?.assay?.fusionDetection
: null
);

const [assayName, setAssayName] = useState(
fusion?.assay?.assay_name !== undefined ? fusion?.assay?.assay_name : ""
fusion?.assay?.assayName !== undefined ? fusion?.assay?.assayName : ""
);

const [assayId, setAssayId] = useState(
fusion?.assay?.assay_id !== undefined ? fusion?.assay?.assay_id : ""
fusion?.assay?.assayId !== undefined ? fusion?.assay?.assayId : ""
);

const [methodUri, setMethodUri] = useState(
fusion?.assay?.method_uri !== undefined ? fusion?.assay?.method_uri : ""
fusion?.assay?.methodUri !== undefined ? fusion?.assay?.methodUri : ""
);

const handleEvidenceChange = (event: FormEvent<HTMLInputElement>) => {
const evidence_value = event.currentTarget.value;
if (fusion?.assay?.fusion_detection !== evidence_value) {
if (fusion?.assay?.fusionDetection !== evidence_value) {
setFusionDetection(evidence_value);
const assay = JSON.parse(JSON.stringify(fusion.assay));
assay["fusion_detection"] = evidence_value;
assay["fusionDetection"] = evidence_value;
setFusion({ ...fusion, assay: assay });
}
};

const propertySetterMap = {
assayName: [setAssayName, "assay_name"],
assayId: [setAssayId, "assay_id"],
methodUri: [setMethodUri, "method_uri"],
assayName: [setAssayName, "assayName"],
assayId: [setAssayId, "assayId"],
methodUri: [setMethodUri, "methodUri"],
};

// live update fields
useEffect(() => {
if (fusion?.assay?.fusion_detection !== fusionDetection) {
setFusionDetection(fusion?.assay?.fusion_detection);
if (fusion?.assay?.fusionDetection !== fusionDetection) {
setFusionDetection(fusion?.assay?.fusionDetection);
}
if (fusion?.assay?.assay_name !== assayName) {
setAssayName(fusion?.assay?.assay_name);
if (fusion?.assay?.assayName !== assayName) {
setAssayName(fusion?.assay?.assayName);
}
if (fusion?.assay?.assay_id !== assayId) {
setAssayId(fusion?.assay?.assay_id);
if (fusion?.assay?.assayId !== assayId) {
setAssayId(fusion?.assay?.assayId);
}
if (fusion?.assay?.method_uri !== methodUri) {
setMethodUri(fusion?.assay?.method_uri);
if (fusion?.assay?.methodUri !== methodUri) {
setMethodUri(fusion?.assay?.methodUri);
}
}, [fusion]);

Expand Down
18 changes: 9 additions & 9 deletions client/src/components/Pages/CausativeEvent/CausativeEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export const CausativeEvent: React.FC<Props> = () => {
const { fusion, setFusion } = useContext(FusionContext);

const [eventType, setEventType] = useState<string>(
fusion.causative_event?.event_type || ""
fusion.causativeEvent?.eventType || ""
);
const [eventDescription, setEventDescription] = useState<string>(
fusion.causative_event?.event_type || ""
fusion.causativeEvent?.eventType || ""
);

/**
* Ensure that causative event object exists for getter/setter purposes
*/
const ensureEventInitialized = () => {
if (!fusion.causative_event) {
setFusion({ ...fusion, causative_event: {} });
if (!fusion.causativeEvent) {
setFusion({ ...fusion, causativeEvent: {} });
}
};

Expand All @@ -56,8 +56,8 @@ export const CausativeEvent: React.FC<Props> = () => {
if (eventType !== value) {
setEventType(value);
}
const newCausativeEvent = { event_type: value, ...fusion.causative_event };
setFusion({ causative_event: newCausativeEvent, ...fusion });
const newCausativeEvent = { eventType: value, ...fusion.causativeEvent };
setFusion({ causativeEvent: newCausativeEvent, ...fusion });
};

/**
Expand All @@ -72,10 +72,10 @@ export const CausativeEvent: React.FC<Props> = () => {
setEventDescription(value);
}
const newCausativeEvent = {
event_description: value,
...fusion.causative_event,
eventDescription: value,
...fusion.causativeEvent,
};
setFusion({ causative_event: newCausativeEvent, ...fusion });
setFusion({ causativeEvent: newCausativeEvent, ...fusion });
};

return (
Expand Down
18 changes: 9 additions & 9 deletions client/src/components/Pages/Domains/DomainForm/DomainForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const useStyles = makeStyles((theme) => ({
const DomainForm: React.FC = () => {
// // TODO: shouldn't be necessary
useEffect(() => {
if (fusion.critical_functional_domains === undefined) {
setFusion({ ...fusion, ...{ critical_functional_domains: [] } });
if (fusion.criticalFunctionalDomains === undefined) {
setFusion({ ...fusion, ...{ criticalFunctionalDomains: [] } });
}
}, []);

Expand Down Expand Up @@ -65,7 +65,7 @@ const DomainForm: React.FC = () => {

const handleAdd = () => {
const domainParams = domainOptions[gene].find(
(domainOption: DomainParams) => domainOption.interpro_id == domain
(domainOption: DomainParams) => domainOption.interproId == domain
);
getFunctionalDomain(domainParams, status as DomainStatus, gene).then(
(response) => {
Expand All @@ -74,11 +74,11 @@ const DomainForm: React.FC = () => {
domain_id: uuid(),
...response.domain,
};
const cloneArray = Array.from(fusion["critical_functional_domains"]);
const cloneArray = Array.from(fusion["criticalFunctionalDomains"]);
cloneArray.push(newDomain);
setFusion({
...fusion,
...{ critical_functional_domains: cloneArray },
...{ criticalFunctionalDomains: cloneArray },
});

setStatus("default");
Expand Down Expand Up @@ -107,11 +107,11 @@ const DomainForm: React.FC = () => {
if (domainOptions[gene]) {
const uniqueInterproIds: Set<string> = new Set();
domainOptions[gene].forEach((domain: DomainParams, index: number) => {
if (!uniqueInterproIds.has(domain.interpro_id)) {
uniqueInterproIds.add(domain.interpro_id);
if (!uniqueInterproIds.has(domain.interproId)) {
uniqueInterproIds.add(domain.interproId);
domainOptionMenuItems.push(
<MenuItem key={index} value={domain.interpro_id}>
{domain.domain_name}
<MenuItem key={index} value={domain.interproId}>
{domain.domainName}
</MenuItem>
);
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/Pages/Domains/Main/Domains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const Domain: React.FC<Props> = () => {
const { fusion, setFusion } = useContext(FusionContext);

const { globalGenes } = useContext(GeneContext);
const domains = fusion.critical_functional_domains || [];
const domains = fusion.criticalFunctionalDomains || [];

const { colorTheme } = useColorTheme();
const useStyles = makeStyles(() => ({
Expand Down Expand Up @@ -73,14 +73,14 @@ export const Domain: React.FC<Props> = () => {

const handleRemove = (domain: ClientFunctionalDomain) => {
let cloneArray: ClientFunctionalDomain[] = Array.from(
fusion.critical_functional_domains
fusion.criticalFunctionalDomains
);
cloneArray = cloneArray.filter((obj) => {
return obj["domain_id"] !== domain["domain_id"];
});
setFusion({
...fusion,
...{ critical_functional_domains: cloneArray || [] },
...{ criticalFunctionalDomains: cloneArray || [] },
});
};

Expand Down Expand Up @@ -108,7 +108,7 @@ export const Domain: React.FC<Props> = () => {
avatar={<Avatar>{domain.status === "preserved" ? "P" : "L"}</Avatar>}
label={
<React.Fragment>
{domainLabelString} <b>{`(${domain.associated_gene.label})`}</b>
{domainLabelString} <b>{`(${domain.associatedGene.label})`}</b>
</React.Fragment>
}
onDelete={() => handleRemove(domain)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const StructureDiagram: React.FC = () => {
});

const regEls = [];
suggestion.regulatory_elements.forEach((el) => {
regEls.push(el.gene_descriptor.label);
suggestion.regulatoryElements.forEach((el) => {
regEls.push(el.gene.label);
});

return (
Expand Down
18 changes: 9 additions & 9 deletions client/src/components/Pages/ReadingFrame/ReadingFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ export const ReadingFrame: React.FC<Props> = ({ index }) => {
};

const [rFramePreserved, setRFramePreserved] = useState(
assignRadioValue(fusion.r_frame_preserved)
assignRadioValue(fusion.readingFramePreserved)
);

useEffect(() => {
if (
fusion.r_frame_preserved &&
fusion.r_frame_preserved !== rFramePreserved
fusion.readingFramePreserved &&
fusion.readingFramePreserved !== rFramePreserved
) {
setRFramePreserved(assignRadioValue(fusion.r_frame_preserved));
setRFramePreserved(assignRadioValue(fusion.readingFramePreserved));
}

if (fusion.r_frame_preserved === undefined) {
setFusion({ ...fusion, r_frame_preserved: null });
if (fusion.readingFramePreserved === undefined) {
setFusion({ ...fusion, readingFramePreserved: null });
}
}, [fusion]);

Expand All @@ -71,13 +71,13 @@ export const ReadingFrame: React.FC<Props> = ({ index }) => {
if (value !== rFramePreserved) {
if (value === "yes") {
setRFramePreserved("yes");
setFusion({ ...fusion, r_frame_preserved: true });
setFusion({ ...fusion, readingFramePreserved: true });
} else if (value === "no") {
setRFramePreserved("no");
setFusion({ ...fusion, r_frame_preserved: false });
setFusion({ ...fusion, readingFramePreserved: false });
} else {
setRFramePreserved("unspecified");
setFusion({ ...fusion, r_frame_preserved: null });
setFusion({ ...fusion, readingFramePreserved: null });
}
}
};
Expand Down
Loading

0 comments on commit 43d32d3

Please sign in to comment.