Skip to content

Commit

Permalink
add buckets for arcade, physicell, and readdy outputs, exclude direct…
Browse files Browse the repository at this point in the history
…ories, and better error feedback
  • Loading branch information
blairlyons committed Sep 24, 2021
1 parent 11a8e11 commit 6a4aad3
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 11 deletions.
18 changes: 18 additions & 0 deletions arcade.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Overpass:wght@200;400;600&display=swap">
<link rel="stylesheet" href="main.css">
</head>
<body>
<a href="index.html">&larr; Back</a>
<h1>ARCADE Simularium Library</h1>
<div id="listing"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var BUCKET_URL = 'https://arcade-working-bucket.s3.us-west-2.amazonaws.com';
</script>
<script src="list.js"></script>
</body>
</html>

14 changes: 13 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,21 @@
<body>
<h1 class="title">Simularium Trajectory Libraries</h1>
<a href="main.html"><div class="bucket">
<h2>Main Simularium Library</h2>
<h2>Main Library</h2>
<span>https://aics-simularium-data.s3.us-east-2.amazonaws.com</span>
</div></a>
<a href="readdy.html"><div class="bucket">
<h2>AICS ReaDDy Library</h2>
<span>https://readdy-working-bucket.s3.us-west-2.amazonaws.com</span>
</div></a>
<a href="physicell.html"><div class="bucket">
<h2>AICS PhysiCell Library</h2>
<span>https://physicell-working-bucket.s3.us-west-2.amazonaws.com</span>
</div></a>
<a href="arcade.html"><div class="bucket">
<h2>ARCADE Library</h2>
<span>https://arcade-working-bucket.s3.us-west-2.amazonaws.com</span>
</div></a>
</body>
</html>

47 changes: 37 additions & 10 deletions list.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ jQuery(function($) {
} else {
var url = location.protocol + '//' + location.hostname;
}
if (typeof EXCLUDE_DIRS != 'undefined') {
var exclude_dirs = EXCLUDE_DIRS;
} else {
var exclude_dirs = [];
}
$.get(url)
.done(function(data) {
var xml = $(data);
Expand All @@ -15,10 +20,10 @@ jQuery(function($) {
Size: item.find('Size').text(),
}
});
renderTable(files, url);
renderTable(files, url, exclude_dirs);
})
.fail(function(error) {
alert('There was an error');
alert(url + ' is not accessible, check that everyone has permission to list files and that the CORS policy allows GET from all origins');
console.log(error);
});
});
Expand All @@ -45,22 +50,44 @@ var formatSize = function (str) {
return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
}

function renderTable(files, bucket_url) {
function renderTable(files, bucket_url, exclude_dirs) {
var n_files = files.length;
var n_files_listed = 0;
var content = '<h3>' + bucket_url + '</h3>';
content += '<div class="instructions">Choose a file to load in the Simularium Viewer.</div>';
content += '<div class="instructions">Found ' + n_files + ' file(s) ';
if (n_files === 1000)
{
content += '<span style="color: red;">(This is the maximum listable)</span>';
}
content += '<br/><br/>Choose a file to load in the Simularium Viewer.</div>';
$.each(files, function(idx, item) {
var key = item.Key;
var ext = getExtension(key);
if (ext === "simularium")
{
var filename = camalize(getFilename(key));
var link = "https://simularium.allencell.org/viewer?trajUrl=" + bucket_url + "/" + key;
content += '<a target="_blank" href="' + link + '"><div class="trajectory"><h2>' + filename + '</h2>';
content += key + '<br/>';
content += '<span class="label">Modified:</span> ' + formatDate(item.LastModified) + ' ',
content += '<span class="label">Size:</span> ' + formatSize(item.Size) + '</div></a>';
var exclude = false;
$.each(exclude_dirs, function(dir) {
if (key.includes(exclude_dirs[dir]))
{
exclude = true;
}
});
if (!exclude)
{
var filename = camalize(getFilename(key));
var link = "https://simularium.allencell.org/viewer?trajUrl=" + bucket_url + "/" + key;
content += '<a target="_blank" href="' + link + '"><div class="trajectory"><h2>' + filename + '</h2>';
content += key + '<br/>';
content += '<span class="label">Modified:</span> ' + formatDate(item.LastModified) + ' ',
content += '<span class="label">Size:</span> ' + formatSize(item.Size) + '</div></a>';
n_files_listed++;
}
}
});
if (n_files > 0 && n_files_listed === 0)
{
content += '<div class="error">No .simularium files found in the first 1000 files (alphabetically) that were not in excluded directories.</div>';
}
document.getElementById('listing').innerHTML = '<pre>' + content + '</pre>';
}

8 changes: 8 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ h3 {
margin-bottom: 40;
}

.error {
font-family: Overpass;
font-size: 16px;
margin-left: 15;
margin-bottom: 40;
color: red;
}

h2 {
font-family: Overpass;
margin-bottom: 0;
Expand Down
1 change: 1 addition & 0 deletions main.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Overpass:wght@200;400;600&display=swap">
<link rel="stylesheet" href="main.css">
</head>
Expand Down
18 changes: 18 additions & 0 deletions physicell.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Overpass:wght@200;400;600&display=swap">
<link rel="stylesheet" href="main.css">
</head>
<body>
<a href="index.html">&larr; Back</a>
<h1>AICS PhysiCell Simularium Library</h1>
<div id="listing"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var BUCKET_URL = 'https://physicell-working-bucket.s3.us-west-2.amazonaws.com';
</script>
<script src="list.js"></script>
</body>
</html>

19 changes: 19 additions & 0 deletions readdy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Overpass:wght@200;400;600&display=swap">
<link rel="stylesheet" href="main.css">
</head>
<body>
<a href="index.html">&larr; Back</a>
<h1>AICS ReaDDy Simularium Library</h1>
<div id="listing"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
var BUCKET_URL = 'https://readdy-working-bucket.s3.us-west-2.amazonaws.com';
var EXCLUDE_DIRS = ['z_archive'];
</script>
<script src="list.js"></script>
</body>
</html>

0 comments on commit 6a4aad3

Please sign in to comment.