Skip to content

Commit

Permalink
Merge pull request #1386 from alliance-genome/test
Browse files Browse the repository at this point in the history
7.5.0 release
  • Loading branch information
christabone authored Dec 20, 2024
2 parents 305a83d + 6bc1817 commit 5ba28af
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 67 deletions.
4 changes: 2 additions & 2 deletions cdk/cdk-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ new AmplifyALBStack(app, 'stage-alb-stack', {
new AmplifyALBStack(app, 'test-alb-stack', {
stackName: 'test-alb-stack',
dnsName: 'test',
targetInstanceId: 'i-08138c1f889f670ca',
targetInstanceId: 'i-0af918724cfc524c8',
env: {
region: process.env.CDK_DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT,
Expand All @@ -30,7 +30,7 @@ new AmplifyALBStack(app, 'test-alb-stack', {
new AmplifyALBStack(app, 'prod-alb-stack', {
stackName: 'prod-alb-stack',
dnsName: 'prod',
targetInstanceId: 'i-08138c1f889f670ca',
targetInstanceId: 'i-0af918724cfc524c8',
env: {
region: process.env.CDK_DEFAULT_REGION,
account: process.env.CDK_DEFAULT_ACCOUNT,
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.5.0",
"abortcontroller-polyfill": "^1.7.8",
"agr_genomefeaturecomponent": "^0.3.24",
"aws-cdk": "^2.118.0",
"aws-cdk-lib": "^2.118.0",
Expand All @@ -28,7 +29,7 @@
"custom-event-polyfill": "^1.0.6",
"d3-selection": "2.0.0",
"document-register-element": "1.13.1",
"generic-sequence-panel": "^1.4.1",
"generic-sequence-panel": "^1.6.0",
"html-react-parser": "^0.10.0",
"immutable": "^3.8.1",
"lodash.clone": "^4.5.0",
Expand Down Expand Up @@ -96,4 +97,4 @@
"devDependencies": {
"ajv": "^8.16.0"
}
}
}
2 changes: 1 addition & 1 deletion src/components/ConstructLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DataSourceLink from './dataSourceLink';

const ConstructLink = ({construct}) => {
return (
<DataSourceLink reference={construct.crossReferenceMap.primary}>
<DataSourceLink reference={construct.crossReferenceMap?.primary}>
<span dangerouslySetInnerHTML={{__html: construct.name}} />
</DataSourceLink>
);
Expand Down
15 changes: 6 additions & 9 deletions src/components/OrthologPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,13 @@ const OrthologPicker =({
}
let selectedOrthologs = [];
if (checkboxValue) {
selectedOrthologs = orthology.data.results
.sort(compareBySpeciesThenAlphabetical)
selectedOrthologs = orthology.data.results?.sort(compareBySpeciesThenAlphabetical)
.filter(o => geneHasData(getOrthologId(o)));
if (stringency) {
selectedOrthologs = selectedOrthologs.filter(byStringency(stringency.value));
selectedOrthologs = selectedOrthologs?.filter(byStringency(stringency.value));
}
if (selectedSpecies.length) {
selectedOrthologs = selectedOrthologs.filter(bySpecies(selectedSpecies));
selectedOrthologs = selectedOrthologs?.filter(bySpecies(selectedSpecies));
}
}
onChange(selectedOrthologs);
Expand Down Expand Up @@ -194,15 +193,13 @@ const OrthologPicker =({
if (!geneHasDataTest) {
return true;
}
return orthology.data.results
.filter(bySpecies([species]))
return orthology.data.results?.filter(bySpecies([species]))
.map(getOrthologId)
.some(geneHasData);
};

const speciesHasOrthologsMeetingStringency = (species) => {
return orthology.data.results
.filter(bySpecies([species]))
return orthology.data.results?.filter(bySpecies([species]))
.filter(o => stringency ? orthologyMeetsStringency(o, stringency.value) : true)
.some(o => geneHasData(getOrthologId(o)));
};
Expand Down Expand Up @@ -299,7 +296,7 @@ const OrthologPicker =({
.filter(species => focusTaxonId ? species.taxonId !== focusTaxonId : true)
.map(species => {
const checkId = id + makeId(species.taxonId);
const hasOrthologs = orthology.data.results.findIndex(o => getOrthologSpeciesId(o) === species.taxonId) >= 0;
const hasOrthologs = orthology.data.results?.findIndex(o => getOrthologSpeciesId(o) === species.taxonId) >= 0;
const hasOrthologsWithData = speciesHasOrthologsWithData(species);
const hasOrthologsMeetingStringency = speciesHasOrthologsMeetingStringency(species);
const disabled = !hasOrthologs || !hasOrthologsWithData || !hasOrthologsMeetingStringency;
Expand Down
22 changes: 16 additions & 6 deletions src/components/dataTable/AnnotatedEntitiesPopupCuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import StrainBackground from './StrainBackground';
function renderLink(entity) {
const identifier = getIdentifier(entity.diseaseAnnotationSubject);
const url = getResourceUrl({
identifier,
type: entity.diseaseAnnotationSubject.type,
identifier,
type: entity.diseaseAnnotationSubject.type,
subtype: entity.diseaseAnnotationSubject.subtype
})

Expand Down Expand Up @@ -90,15 +90,25 @@ function AnnotatedEntitiesPopupCuration({ children, entities, mainRowCurie, pubM
{
entities.map(entity => {
const provider = buildProviderWithUrl(entity);
var diseaseGeneticModifiers = entity.diseaseGeneticModifierAlleles;
if(entity.diseaseGeneticModifierGenes != null){
diseaseGeneticModifiers = entity.diseaseGeneticModifierGenes;
}
if(entity.diseaseGeneticModifierAgms != null){
diseaseGeneticModifiers = entity.diseaseGeneticModifierAgms;
}
var expCondition = entity.conditionRelations;
if(entity.conditionModifiers != null){
expCondition = entity.conditionModifiers;
}
return (
<tr key={entity.id}>
{columnNameSet.has("Name") && <td>{renderLink(entity)}</td>}
{columnNameSet.has("Type") && <td><TypeCellCuration subject={entity.diseaseAnnotationSubject}/></td>}
{columnNameSet.has("Association") && <td><AssociationCellCuration association={entity.relation?.name}/></td>}
{columnNameSet.has("Association") && <td><AssociationCellCuration association={entity.fullRelationString}/></td>}
{columnNameSet.has("Additional Implicated Genes") && <td><AssertedGenes assertedGenes={entity.assertedGenes} mainRowCurie={mainRowCurie}/></td>}
{(columnNameSet.has("Experimental Condition") && entity.conditionRelations) && <td><ExperimentalConditionCellCuration conditions={entity.conditionRelations}/></td>}
{(columnNameSet.has("Experimental Condition") && entity.conditionModifiers) && <td><ExperimentalConditionCellCuration conditions={entity.conditionModifiers}/></td>}
{columnNameSet.has("Genetic Modifiers") && <td><GeneticModifiersCellCuration relation={entity.diseaseGeneticModifierRelation} modifiers={entity.diseaseGeneticModifiers}/></td>}
{columnNameSet.has("Experimental Condition") && <td><ExperimentalConditionCellCuration conditions={expCondition}/></td>}
{columnNameSet.has("Genetic Modifiers") && <td><GeneticModifiersCellCuration relation={entity.diseaseGeneticModifierRelation} modifiers={diseaseGeneticModifiers}/></td>}
{columnNameSet.has("Strain Background") && <td><StrainBackground strainBackground={entity.sgdStrainBackground}/></td>}
{columnNameSet.has("Genetic Sex") && <td><GeneticSex geneticSex={entity.geneticSex}/></td>}
{columnNameSet.has("Notes") && <td><RelatedNotes className={style.relatedNotes} relatedNotes={entity.relatedNotes}/></td>}
Expand Down
4 changes: 2 additions & 2 deletions src/components/disease/diseaseAnnotationTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const DiseaseAnnotationTable = ({
}
];

const data = results.map(annotation => ({
const data = results?.map(annotation => ({
species: annotation.subject.taxon,
providers: buildProvidersWithUrl(annotation.primaryAnnotations),
basedOn: buildWith(annotation),
Expand All @@ -168,7 +168,7 @@ const DiseaseAnnotationTable = ({
<DataTable
{...tableProps}
columns={columns}
data={data}
data={data || []}
downloadUrl={downloadUrl}
keyField='id'
/>
Expand Down
4 changes: 2 additions & 2 deletions src/components/expression/expressionAnnotationTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ExpressionAnnotationTable = ({
];


const data = results.map(result => ({
const data = results?.map(result => ({
key: hash(result),
species: result.gene.species.name,
gene: result.gene,
Expand Down Expand Up @@ -134,7 +134,7 @@ const ExpressionAnnotationTable = ({
<DataTable
{...tableProps}
columns={columns}
data={data}
data={data || []}
downloadUrl={downloadUrl}
keyField='key'
sortOptions={sortOptions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const GeneGeneticInteractionDetailTable = ({
headerStyle: {
width: '250px',
},
formatter: (crossReferences = [], {sourceDatabase = {}, aggregationDatabase = {}} = {}) => (
formatter: (crossReferences = [], {sourceDatabase = {}, aggregationDatabase} = {}) => (
<div>
{
crossReferences && crossReferences.map(({primaryKey, displayName, prefix, crossRefCompleteUrl} = {}) => (
Expand All @@ -142,7 +142,7 @@ const GeneGeneticInteractionDetailTable = ({
))
}
{
(!aggregationDatabase || sourceDatabase.label === aggregationDatabase.label) ?
(!aggregationDatabase || sourceDatabase?.label === aggregationDatabase?.label) ?
null :
<span>
<ExternalLink href={sourceDatabase.url}>{sourceDatabase.label}</ExternalLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const GenePhysicalInteractionDetailTable = ({focusGeneDisplayName, focusGeneId})
return `${DEFAULT_TABLE_KEY}-${fieldKey}-${rowIndex}`;
};

const data = results.map((interaction = {}) => ({
const data = results?.map((interaction = {}) => ({
id: interaction.primaryKey,
moleculeType: interaction.interactorAType,
interactorGeneSymbol: interaction.geneB,
Expand Down Expand Up @@ -193,7 +193,7 @@ const GenePhysicalInteractionDetailTable = ({focusGeneDisplayName, focusGeneId})
<DataTable
{...tableProps}
columns={columns}
data={data}
data={data || []}
downloadUrl={`/api/gene/${focusGeneId}/interactions/download?filter.joinType=molecular_interaction`}
keyField='id'
sortOptions={sortOptions}
Expand Down
5 changes: 2 additions & 3 deletions src/components/orthology/orthologyTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ class OrthologyTable extends Component {
compareByFixedOrder(TAXON_ORDER, o => getOrthologSpeciesId(o)),
(orthDataA, orthDataB) => orthDataB.predictionMethodsMatched.length - orthDataA.predictionMethodsMatched.length
]).map((orthData, idx, orthList) => {
const scoreNumerator = orthData.predictionMethodsMatched.length;
const scoreDemominator = scoreNumerator +
orthData.predictionMethodsNotMatched.length;
const scoreNumerator = orthData.predictionMethodsMatched?.length;
const scoreDemominator = scoreNumerator + (orthData.predictionMethodsNotMatched?.length || 0);
const orthId = getOrthologId(orthData);

if (idx > 0 && getOrthologSpeciesName(orthList[idx - 1]) !== getOrthologSpeciesName(orthData)) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/paralogy/paralogyTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const ParalogyTable = ({geneId}) => {
if (isLoading) {
return <LoadingSpinner />;
}
if (data?.results.length === 0) {
if (data?.results?.length === 0) {
return <NoData>No paralogs for the gene.</NoData>
}

const results = data.results.sort( (a,b) => {
const results = data.results?.sort( (a,b) => {
if (Number(a.rank) < Number(b.rank)) {
return -1;
}
Expand Down Expand Up @@ -47,7 +47,7 @@ const ParalogyTable = ({geneId}) => {
</thead>
<tbody>
{
results.map( result => {
results?.map( result => {
const rowKey = 'paralogyrowkey-' + result.homologGene.id.replace(/\s/g, '-');
return (<tr key={rowKey}>
<td>
Expand Down Expand Up @@ -79,4 +79,4 @@ ParalogyTable.propTypes = {
geneId: PropTypes.string.isRequired,
};

export default ParalogyTable;
export default ParalogyTable;
4 changes: 2 additions & 2 deletions src/components/synonymList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { CollapsibleList } from './collapsibleList';
import { compareAlphabeticalCaseInsensitive } from '../lib/utils';

const SynonymList = ({synonyms}) => {
return synonyms &&
return (synonyms &&
<CollapsibleList>
{synonyms
.sort(compareAlphabeticalCaseInsensitive())
.map(synonym => <span dangerouslySetInnerHTML={{__html: synonym}} key={synonym} />)
}
</CollapsibleList>;
</CollapsibleList>) || <></>;
};

SynonymList.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleMolecularConsequences.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const AlleleMolecularConsequences = ({
const { genomeLocations: geneLocations } = gene;
const [geneLocation] = geneLocations || [];

return data.map((variant) => ({
return data?.map((variant) => ({
...variant,
geneLocation,
species: allele.species
Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleSequenceView.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const AlleleSequenceView = ({ allele }) => {

const genomeLocations = allele.gene.genomeLocations;
const genomeLocation = genomeLocations && genomeLocations.length > 0 ? genomeLocations[0] : null;
if (!genomeLocation || variants.isLoading || variants.isError || variants.data.length === 0 ||visibleTranscripts.data.length === 0) {
if (!genomeLocation || variants.isLoading || variants.isError || !variants.data || variants.data.length === 0 || visibleTranscripts.data.length === 0) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const AlleleSummary = ({allele}) => {
{allele.constructs && allele.constructs.length && (
<CommaSeparatedList>
{allele.constructs.map(construct => (
<DataSourceLink key={construct.id} reference={construct.crossReferenceMap.primary}>
<DataSourceLink key={construct.id} reference={construct.crossReferenceMap?.primary}>
<span dangerouslySetInnerHTML={{__html: construct.name}} />
</DataSourceLink>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleToDiseaseTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const AlleleToDiseaseTable = ({alleleId}) => {
...tableProps
} = useDataTableQuery(`/api/allele/${alleleId}/diseases`);

const tableData = results.map(annotation => ({
const tableData = results?.map(annotation => ({
providers: buildProvidersWithUrl(annotation.primaryAnnotations),
...annotation,
}));
Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleToPhenotypeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const AlleleToPhenotypeTable = ({alleleId}) => {
},
];

const data = results.map(record => ({
const data = results?.map(record => ({
...record,
id: hash(record),
}));
Expand Down
6 changes: 3 additions & 3 deletions src/containers/allelePage/AlleleTransgenicConstructs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ const AlleleTransgenicConstructs = ({constructs}) => {

<AttributeLabel>Expressed Components</AttributeLabel>
<AttributeValue placeholder='None'>
{construct.expressedGenes.length && (
{construct.expressedGenes?.length && (
<CommaSeparatedGeneList genes={construct.expressedGenes} />
)}
</AttributeValue>

<AttributeLabel>Knock-down Targets</AttributeLabel>
<AttributeValue placeholder='None'>
{construct.targetGenes.length && (
{construct.targetGenes?.length && (
<CommaSeparatedGeneList genes={construct.targetGenes} />
)}
</AttributeValue>

<AttributeLabel>Regulatory Regions</AttributeLabel>
<AttributeValue placeholder='None'>
{construct.regulatedByGenes.length && (
{construct.regulatedByGenes?.length && (
<CommaSeparatedGeneList genes={construct.regulatedByGenes} />
)}
</AttributeValue>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/allelePage/AlleleVariantsSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const AlleleVariantsSummary = ({allele, alleleId}) => {
return (
<>
{
data.map(variant => {
data && data.map(variant => {
const {
displayName,
} = variant || {};
Expand Down
2 changes: 1 addition & 1 deletion src/containers/genePage/TransgenicAlleleTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const TransgenicAlleleTable = ({geneId}) => {
...tableProps
} = useDataTableQuery(`/api/gene/${geneId}/transgenic-alleles`);

const data = results.map(result => ({
const data = results?.map(result => ({
...result,
constructExpressedGene: result.constructs.map(construct => ({
id: construct.id,
Expand Down
10 changes: 5 additions & 5 deletions src/containers/genePage/alleleTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ const AlleleTable = ({ isLoadingGene, gene, geneId}) => {
} = tableProps;

const data = useMemo(() => {
return resolvedData ? resolvedData.results.map(allele => ({
return resolvedData ? resolvedData.results?.map(allele => ({
...allele,
symbol: allele.symbol,
synonym: allele.synonyms,
source: {
dataProvider: gene.dataProvider,
url: allele.crossReferenceMap.primary.url,
},
disease: allele.diseases.sort(compareAlphabeticalCaseInsensitive(disease => disease.name))
disease: allele.diseases?.sort(compareAlphabeticalCaseInsensitive(disease => disease.name))
})) : [];
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [resolvedData]);
Expand All @@ -50,12 +50,12 @@ const AlleleTable = ({ isLoadingGene, gene, geneId}) => {
const allelesFiltered = useAllVariants(geneId, tableProps.tableState);

const variantsSequenceViewerProps = useMemo(() => {
const variantsFiltered = allelesFiltered.data ? allelesFiltered.data.results.flatMap(
const variantsFiltered = (allelesFiltered.data && allelesFiltered.data.results) ? allelesFiltered.data.results.flatMap(
allele => (allele && allele.variants) || []
) : [];
const variantLocations = variantsFiltered.map(variant => variant && variant.location);
const { fmin, fmax } = findFminFmax([geneLocation, ...variantLocations]);
const alleleIdsFiltered = allelesFiltered.data ? allelesFiltered.data.results.map(allele => (allele.id)) : [];
const alleleIdsFiltered = (allelesFiltered.data && allelesFiltered.data.results) ? allelesFiltered.data.results.map(allele => (allele.id)) : [];

/*
Warning!
Expand Down Expand Up @@ -151,7 +151,7 @@ const AlleleTable = ({ isLoadingGene, gene, geneId}) => {
formatter: (variants) => (
<div>
{
variants.map(({id, variantType: type = {}, location = {}, transcriptLevelConsequence}) => (
variants?.map(({id, variantType: type = {}, location = {}, transcriptLevelConsequence}) => (
<div key={id} style={{display: 'flex'}}>
<div
style={{
Expand Down
Loading

0 comments on commit 5ba28af

Please sign in to comment.