Skip to content

Commit

Permalink
view in sra
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-eyes committed Oct 29, 2024
1 parent 0b2015b commit 1488cd4
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,18 @@ <h2>Selected Data Points</h2>
const bioSample = event.target.getAttribute('data-biosample');
purgeBioSample(bioSample);
}

if (event.target && event.target.classList.contains('view-sra')) {
const uniqueId = event.target.getAttribute('data-unique-id');
const selectedData = data.find(row => row._uniqueId === uniqueId);
if (selectedData && selectedData['Experiment ID']) {
const sraUrl = `https://ncbi.nlm.nih.gov/sra/${selectedData['Experiment ID']}`;
window.open(sraUrl, '_blank', 'noopener,noreferrer');
} else {
alert('Experiment ID not found for the selected Experiment.');
}
}

});

});
Expand Down Expand Up @@ -2227,13 +2239,10 @@ <h5 id="plot-title-display-${plotId}" class="mb-0 text-center">Plot ${plotCounte
function updateTable() {
const columns = data && data.length > 0 ? Object.keys(data[0]).filter(col => !col.startsWith('_')) : [];

// Find the index of 'Experiment ID'
const experimentIdIndex = columns.indexOf('Experiment ID');

// Start building the table with the Actions column first
let tableHTML = '<table class="table table-striped table-bordered"><thead><tr>';
tableHTML += `<th>Actions</th>`; // Actions column as the first column
columns.forEach((col, index) => {
columns.forEach(col => {
tableHTML += `<th>${col}</th>`;
});
tableHTML += '</tr></thead><tbody>';
Expand All @@ -2252,6 +2261,7 @@ <h5 id="plot-title-display-${plotId}" class="mb-0 text-center">Plot ${plotCounte
Actions
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton-${point._uniqueId}">
<a class="dropdown-item view-sra" href="#" data-unique-id="${point._uniqueId}">View in SRA</a>
<a class="dropdown-item show-depth" href="#" data-unique-id="${point._uniqueId}">Show depth per chromosome</a>
<a class="dropdown-item purge-experiment" href="#" data-unique-id="${point._uniqueId}">Purge Experiment</a>
<a class="dropdown-item purge-bioproject" href="#" data-bioproject="${point['BioProject']}">Purge BioProject</a>
Expand All @@ -2262,7 +2272,7 @@ <h5 id="plot-title-display-${plotId}" class="mb-0 text-center">Plot ${plotCounte
`;

// Add the rest of the columns
columns.forEach((col, index) => {
columns.forEach(col => {
tableHTML += `<td>${point[col]}</td>`;
});
tableHTML += '</tr>';
Expand All @@ -2276,6 +2286,7 @@ <h5 id="plot-title-display-${plotId}" class="mb-0 text-center">Plot ${plotCounte




function clearSelections() {
selectedPoints = [];
updateTable();
Expand Down

0 comments on commit 1488cd4

Please sign in to comment.