Skip to content

[genomic_browser] Solve the issues #9773

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions modules/genomic_browser/help/genomic_browser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Genomic Browser

This module allows you to visualize the results of already analyzed genetic tests cross-linked with behavioral and imaging candidate data.

It is designed for researchers and study personnel who are browsing and reviewing summary data. This module presents summary genomic data of several types, enabling you to review and explore data available for study participants in a cross-modal context. Supported data types include SNP, CNV, and methylation (epigenomic) data.

### Usage
You can switch between the different tabs to view different types of genomic data. The tabs are:
- Profile, GWAS, SNP, CNV, Methylation and Files
- **Profiles**: This tab allows you to get a brief summary of the data available for each participant, including whether SNPs, CNVs and CPGs were found or not.
- **GWAS**: This tab allows you to visualize the results of a genome-wide association study (GWAS) for each participant.
- **SNP**: This tab allows you to visualize the results of a single nucleotide polymorphism (SNP) analysis for each participant.
- **CNV**: This tab allows you to visualize the results of a copy number variation (CNV) analysis for each participant.
- **Methylation**: This tab allows you to visualize the results of a methylation analysis for each participant.
- **Files**: This tab allows you to upload and download files related to the genomic data.

### Uploading Data
To upload data, you can use the "Upload" button in the "Files" tab. This will allow you to select a file from your computer and upload it to the server. The file should be in a format that is compatible with the module, such as CSV.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SelectElement,
ButtonElement,
} from 'jsx/Form';
import swal from 'sweetalert2';

/**
* Genomic Upload Form
Expand Down Expand Up @@ -200,7 +201,8 @@ class GenomicUploadForm extends Component {
}, // reset form data after successful file upload
uploadProgress: -1,
});
swal('Upload Successful!', '', 'success');
swal.fire('Upload Successful!', '', 'success');
this.props.closeFileUploadModal();
}
).catch((error) => {
console.error(error);
Expand All @@ -211,14 +213,15 @@ class GenomicUploadForm extends Component {
errorMessage: msg,
uploadProgress: -1,
});
swal(msg, '', 'error');
swal.fire(msg, '', 'error');
});
}
}
GenomicUploadForm.propTypes = {
action: PropTypes.string,
permissions: PropTypes.object,
baseURL: PropTypes.string.isRequired,
closeFileUploadModal: PropTypes.func.isRequired,
};

export default GenomicUploadForm;
34 changes: 12 additions & 22 deletions modules/genomic_browser/jsx/tabs_content/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Files extends Component {
this.formatColumn = this.formatColumn.bind(this);
this.openFileUploadModal = this.openFileUploadModal.bind(this);
this.closeFileUploadModal = this.closeFileUploadModal.bind(this);
this.renderFileUploadForm = this.renderFileUploadForm.bind(this);
this.setFileUploadFormData = this.setFileUploadFormData.bind(this);
}

Expand Down Expand Up @@ -116,26 +115,7 @@ class Files extends Component {
},
showFileUploadModal: false,
});
}

/**
* Render File Upload Form
*
* @return {JSX} react upload form modal
*/
renderFileUploadForm() {
return (
<Modal
title='Upload File'
onClose={this.closeFileUploadModal}
show={this.state.showFileUploadModal}
>
<GenomicUploadForm
permissions={this.state.data.permissions}
baseURL={this.props.baseURL}
/>
</Modal>
);
this.fetchData();
}

/**
Expand Down Expand Up @@ -252,7 +232,17 @@ class Files extends Component {

return (
<React.Fragment>
{this.renderFileUploadForm()}
<Modal
title='Upload File'
onClose={this.closeFileUploadModal}
show={this.state.showFileUploadModal}
>
<GenomicUploadForm
permissions={this.state.data.permissions}
baseURL={this.props.baseURL}
closeFileUploadModal={this.closeFileUploadModal}
/>
</Modal>
<FilterableDataTable
name={'filterableDataTableFiles'}
data={this.state.data.Data}
Expand Down
3 changes: 1 addition & 2 deletions modules/genomic_browser/jsx/tabs_content/gwas.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ class GWAS extends Component {
const hiddenHeaders = [
'PSC',
'DCCID',
'externalID',
'DoB',
'externalID'
];
let reactElement;
if (-1 === hiddenHeaders.indexOf(column)) {
Expand Down
4 changes: 0 additions & 4 deletions modules/genomic_browser/jsx/tabs_content/profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ class Profiles extends Component {
options: options.Cohorts,
},
},
{
label: 'Date of Birth',
show: false,
},
{
label: 'External ID',
show: false,
Expand Down
8 changes: 4 additions & 4 deletions modules/genomic_browser/jsx/tabs_content/snp.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ class SNP extends Component {
show: false,
},
{
label: 'Name',
label: 'Gene Name',
show: false,
filter: {
name: 'Name',
name: 'Gene Name',
type: 'text',
},
},
Expand All @@ -223,10 +223,10 @@ class SNP extends Component {
},
},
{
label: 'Name',
label: 'SNP Name',
show: false,
filter: {
name: 'Name',
name: 'SNP Name',
type: 'text',
},
},
Expand Down
4 changes: 2 additions & 2 deletions modules/genomic_browser/php/filemanager.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FileManager extends \NDB_Page implements ETagCalculator
// Parse GET query params.
$values = $request->getQueryParams();
// GET request for downloading file by ID.
if ($values['filename']) {
if ($values['filename'] ?? false) {
$factory = \NDB_Factory::singleton();
$config = $factory->config();
$filesDir = \Utility::appendForwardSlash(
Expand Down Expand Up @@ -129,7 +129,7 @@ class FileManager extends \NDB_Page implements ETagCalculator
// handles upload process - returns status of file upload.
$response = $genomicFile->setupUploading(
$request->getAttribute('user'), // user
$_FILES, // file data
$request->getUploadedFiles(), // file data
$values // post request values.
);

Expand Down
8 changes: 0 additions & 8 deletions modules/genomic_browser/php/models/cnvdto.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ class CnvDTO implements DataInstance, SiteHaver
*/
private $_Cohort = "";

/**
* The DoB
*
* @var string
*/
private $_DoB = "";

/**
* The ExternalID
*
Expand Down Expand Up @@ -224,7 +217,6 @@ class CnvDTO implements DataInstance, SiteHaver
'PSCID' => $this->_PSCID,
'Sex' => $this->_Sex,
'Cohort' => $this->_Cohort,
'DoB' => $this->_DoB,
'ExternalID' => $this->_ExternalID,
'Chromosome' => $this->_Chromosome,
'Strand' => $this->_Strand,
Expand Down
8 changes: 0 additions & 8 deletions modules/genomic_browser/php/models/methylationdto.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ class MethylationDTO implements DataInstance, SiteHaver
*/
private $_Cohort = "";

/**
* The DoB
*
* @var string
*/
private $_DoB = "";

/**
* The Sample
*
Expand Down Expand Up @@ -280,7 +273,6 @@ class MethylationDTO implements DataInstance, SiteHaver
'PSCID' => $this->_PSCID,
'Sex' => $this->_Sex,
'Cohort' => $this->_Cohort,
'DoB' => $this->_DoB,
'Sample' => $this->_Sample,
'cpg_name' => $this->_cpg_name,
'Beta_value' => $this->_Beta_value,
Expand Down
8 changes: 0 additions & 8 deletions modules/genomic_browser/php/models/profiledto.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ class ProfileDTO implements DataInstance, SiteHaver
*/
private $_Cohort = "";

/**
* The DoB
*
* @var string
*/
private $_DoB = "";

/**
* The externalID
*
Expand Down Expand Up @@ -138,7 +131,6 @@ class ProfileDTO implements DataInstance, SiteHaver
'PSCID' => $this->_PSCID,
'Sex' => $this->_Sex,
'Cohort' => $this->_Cohort,
'DoB' => $this->_DoB,
'externalID' => $this->_externalID,
'File' => $this->_File,
'SNP' => $this->_SNP,
Expand Down
8 changes: 0 additions & 8 deletions modules/genomic_browser/php/models/snpdto.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ class SnpDTO implements DataInstance, SiteHaver
*/
private $_Cohort = "";

/**
* The DoB
*
* @var string
*/
private $_DoB = "";

/**
* The externalID
*
Expand Down Expand Up @@ -270,7 +263,6 @@ class SnpDTO implements DataInstance, SiteHaver
'PSCID' => $this->_PSCID,
'Sex' => $this->_Sex,
'Cohort' => $this->_Cohort,
'DoB' => $this->_DoB,
'externalID' => $this->_externalID,
'Chromosome' => $this->_Chromosome,
'Strand' => $this->_Strand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class CnvProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
candidate.PSCID AS _PSCID,
candidate.Sex AS _Sex,
cohort.CohortID AS _Cohort,
DATE_FORMAT(candidate.DoB, '%Y-%m-%d') AS _DoB,
candidate.ExternalID AS _ExternalID,
candidate.RegistrationCenterID as _centerID,
candidate.RegistrationProjectID as _projectID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class MethylationProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisione
candidate.RegistrationCenterID as _centerID,
candidate.RegistrationProjectID as _projectID,
cohort.CohortID AS _Cohort,
DATE_FORMAT(candidate.DoB, '%Y-%m-%d') AS _DoB,
gscr.sample_label AS _Sample,
cpg.cpg_name AS _cpg_name,
cpg.beta_value AS _Beta_value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class ProfileProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
candidate.PSCID AS _PSCID,
candidate.Sex AS _Sex,
subproj.title AS _Cohort,
DATE_FORMAT(candidate.DoB, '%Y-%m-%d') AS _DoB,
candidate.ExternalID AS _externalID,
candidate.RegistrationCenterID as _centerID,
candidate.RegistrationProjectID as _projectID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class SnpProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
LPAD(candidate.CandID, 10, '0') AS _DCCID,
candidate.PSCID AS _PSCID,
candidate.Sex AS _Sex,
subproj.title AS _Cohort,
DATE_FORMAT(candidate.DoB, '%Y-%m-%d') AS _DoB,
cohort.title AS _Cohort,
candidate.ExternalID AS _externalID,
candidate.RegistrationCenterID as _centerID,
candidate.RegistrationProjectID as _projectID,
Expand Down Expand Up @@ -66,8 +65,8 @@ class SnpProvisioner extends \LORIS\Data\Provisioners\DBObjectProvisioner
JOIN candidate c ON c.ID=s.CandidateID
GROUP BY
c.CandID) AS cohort ON (cohort.CandID = candidate.CandID)
LEFT JOIN cohort AS subproj
ON (cohort.CohortID = subproj.CohortID)
LEFT JOIN cohort
ON (cohort.CohortID = CohortID)
LEFT JOIN psc ON (psc.CenterID = candidate.RegistrationCenterID)
JOIN SNP_candidate_rel
ON (candidate.ID = SNP_candidate_rel.CandidateID)
Expand Down
21 changes: 13 additions & 8 deletions modules/genomic_browser/php/uploading/genomicfile.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,25 @@ class Genomicfile
*/
function setupUploading($user, $files, $values) : array
{
$this->_user = $user;
$this->_bytes = $files['file']['size'];
$this->_values = $values;

if (!isset($files['file'])
|| empty($files['file']->getStream()->getMetadata('uri'))
) {
return false;
}
$this->_user = $user;
$this->_bytes = $files['file']->getSize();
$this->_values = $values;
$this->_fileToUpload
= (object) [
'file_type' => $files['file']['type'],
'file_name' => $files['file']['name'],
'tmp_name' => $files['file']['tmp_name'],
'file_type' => $files['file']->getClientMediaType(),
'file_name' => $files['file']->getClientFilename(),
'tmp_name' => $files['file']
->getStream()->getMetadata('uri'),
'size' => round($this->_bytes / 1048576, 0),
'inserted_by' => $this->_user->getData('UserID'),
'genomic_file_type' => empty($this->_values['fileType']) ?
null : str_replace('_', ' ', $this->_values['fileType']),
'description' => $this->_values['fileDescription'],
'description' => $this->_values['fileDescription'] ?? '',
];

$this->setFullPath($this->_fileToUpload);
Expand Down
Loading