Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENCD-6126--add-element-ref-to-file-details #4084

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/encoded/static/components/filegallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,18 @@ export class FileTable extends React.Component {
return analysisObjectsAccession || nonAnalysisObjectPrefix;
});

const elementsReferences = context.elements_references;

if (elementsReferences) {
const elementsReferenceFiles = elementsReferences.map((elementsReference) => elementsReference.files).reduce((acc, val) => acc.concat(val), []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you’re doing, though I think it’d be easier to understand in one step:

const elementsReferenceFiles = elementsReferences.reduce((accFiles, reference) => accFiles.concat(reference.files));


if (!files.ref) {
files.ref = [];
}

files.ref.push(...elementsReferenceFiles);
}

// Get unique analyses for series object
const analysesSeries = files.series ? [...new Set(files.series.map((a) => (a.analyses && a.analyses.length > 0 ? a.analyses[0] : '')).filter((a) => a !== ''))] : [];

Expand Down Expand Up @@ -2975,7 +2987,9 @@ class FileGalleryRendererComponent extends React.Component {
this.experimentType = props.context['@type'][0];

const seriesFiles = getSeriesFiles(props.context) || [];
const datasetFiles = [...props.data, ...seriesFiles];
const elementsReferenceFiles = props.context.elements_references?.map((elementsReference) => elementsReference.files).reduce((acc, val) => acc.concat(val), []) || [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this into a utility function shared here and in your first change above? They do the same thing, and a well-named utility function would help documentation.


const datasetFiles = [...props.data, ...seriesFiles, ...elementsReferenceFiles];

// Initialize React state variables.
this.state = {
Expand Down
1 change: 1 addition & 0 deletions src/encoded/types/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ class FunctionalCharacterizationSeries(Series):
'related_datasets.elements_references.examined_loci',
'elements_references',
'elements_references.examined_loci',
'elements_references.files',
]

@calculated_property(condition='related_datasets', schema={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class FunctionalCharacterizationExperiment(
'biosample_ontology',
'examined_loci',
'examined_loci.gene',
'elements_references.files',
'elements_references.examined_loci',
'elements_references.examined_regions',
'files.platform',
Expand Down