Skip to content

Commit

Permalink
Merge pull request #212 from pepkit/dev
Browse files Browse the repository at this point in the history
v0.12.5
  • Loading branch information
stolarczyk authored Dec 13, 2019
2 parents 0af5ab5 + 3d2a3fa commit 0b4f93b
Show file tree
Hide file tree
Showing 14 changed files with 414 additions and 283 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.12.5] -- 2019-12-13
### Changed
- reduce verbosity of missing options; [Issue 174](https://github.com/pepkit/looper/issues/174)
- switch to [Bootstrap Table](https://bootstrap-table.com/) in the summary index page table and sample status tables

## [0.12.4] -- 2019-07-18
### Added
- Ability to declare `required_executables` in a `PipelineInterface`, to trigger a naive "runnability" check for a sample submission
Expand Down
22 changes: 4 additions & 18 deletions looper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ._version import __version__
from .parser_types import *

from ubiquerg import VersionInHelpParser
from divvy import DEFAULT_COMPUTE_RESOURCES_NAME, NEW_COMPUTE_KEY as COMPUTE_KEY
# Not used here, but make this the main import interface between peppy and
# looper, so that other modules within this package need not worry about
Expand All @@ -37,13 +38,6 @@
logging.INFO, logging.DEBUG]


class _VersionInHelpParser(argparse.ArgumentParser):
def format_help(self):
""" Add version information to help text. """
return "version: {}\n".format(__version__) + \
super(_VersionInHelpParser, self).format_help()


class _StoreBoolActionType(argparse.Action):
"""
Enables the storage of a boolean const and custom type definition needed for systematic html interface generation.
Expand All @@ -55,7 +49,7 @@ def __init__(self, option_strings, dest, type, default, required=False, help=Non
option_strings=option_strings,
dest=dest,
nargs=0,
const=not(default),
const=not default,
default=default,
type=type,
required=required,
Expand All @@ -74,18 +68,10 @@ def build_parser():

# Main looper program help text messages
banner = "%(prog)s - Loop through samples and submit pipelines."
additional_description = "For subcommand-specific options, type: " \
"'%(prog)s <subcommand> -h'"
additional_description = "For subcommand-specific options, type: '%(prog)s <subcommand> -h'"
additional_description += "\nhttps://github.com/pepkit/looper"

parser = _VersionInHelpParser(
description=banner,
epilog=additional_description)

parser.add_argument(
"-V", "--version",
action="version",
version="%(prog)s {v}".format(v=__version__))
parser = VersionInHelpParser(description=banner, epilog=additional_description, version=__version__)

# Logging control
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion looper/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.12.4"
__version__ = "0.12.5"
4 changes: 3 additions & 1 deletion looper/html_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def create_object_html(self, single_object, navbar, footer):

# Set the PATH to the image/file. Catch any errors.
# Check if the object is an HTML document
if not str(row['filename']).lower().endswith(IMAGE_EXTS):
if not str(row['anchor_image']).lower().endswith(IMAGE_EXTS):
image_path = page_path
else:
try:
Expand All @@ -231,10 +231,12 @@ def create_object_html(self, single_object, navbar, footer):
if os.path.isfile(image_path) and os.path.isfile(page_path):
image_relpath = os.path.relpath(image_path, self.reports_dir)
# If the object has a valid image, use it!
_LOGGER.debug("Checking image path: {}".format(image_path))
if str(image_path).lower().endswith(IMAGE_EXTS):
figures.append([page_relpath, str(row['sample_name']), image_relpath])
# Or if that "image" is not an image, treat it as a link
elif not str(image_path).lower().endswith(IMAGE_EXTS):
_LOGGER.debug("Got link")
links.append([str(row['sample_name']), image_relpath])
else:
warnings.append(str(row['filename']))
Expand Down
78 changes: 1 addition & 77 deletions looper/jinja_templates/footer_index.html
Original file line number Diff line number Diff line change
@@ -1,82 +1,6 @@

<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>

<!-- D3.js -->
<script src="https://d3js.org/d3.v5.min.js"></script>
<!-- Plotly -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>

<!-- DataTables JQuery extension -->
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/fixedcolumns/3.2.6/js/dataTables.fixedColumns.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>

<script type="text/javascript">

$.fn.dataTable.render.ellipsis = function ( cutoff, wordbreak, escapeHtml ) {
var esc = function ( t ) {
return t
.replace( /&/g, '&amp;' )
.replace( /</g, '&lt;' )
.replace( />/g, '&gt;' )
.replace( /"/g, '&quot;' );
};
function numberWithCommas(x) {
var parts = x.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");

}
return function ( d, type, row ) {
// Order, search and type get the original data
if ( type !== 'display' ) {
return d;
}
if ( typeof d !== 'number' && typeof d !== 'string' ) {
return d;
}
d = d.toString(); // cast numbers
if(!isNaN(d)){
return numberWithCommas(d);
}
if ( d.length < cutoff ) {
return d;
}
var shortened = d.substr(0, cutoff-1);
// Find the last white space character in the string
if ( wordbreak ) {
shortened = shortened.replace(/\s([^\s]*)$/, '');
}
// Protect against uncontrolled HTML input
if ( escapeHtml ) {
shortened = esc( shortened );
}
return shortened;
};
};

$(document).ready(function() {
$('#data-table').DataTable({
scrollX: true,
fixedColumns: {
leftColumns: 1
},
columnDefs: [
{
targets: 0,
render: $.fn.dataTable.render.ellipsis(1000, true, false)
},
{
targets: '_all',
render: $.fn.dataTable.render.ellipsis(17, true, true)
}
],
});
} );

//var table = document.getElementById("data-table");
var plotDict = {}; // variable containing column values (col_name:string -> col_values:list)
var statsTable = {{ stats_json }}; // Jinja template variable
// make a list of the first column values, which are the names of the samples
Expand Down Expand Up @@ -125,7 +49,7 @@
}
function displayPlottableColumns(){
for(var col in plotDict){
$("#plot-cols").append("<li class='list-group-item'><a href='#' title='Click to visualize this column' onclick='graphCol(\"" + col +
$("#plot-cols").append("<li class='list-group-item'><a href='#' title='Click to visualize this column' onclick='graphCol(\"" + col +
"\");return false;'>" + col+ "</a></li>");
}
}
Expand Down
30 changes: 8 additions & 22 deletions looper/jinja_templates/head.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS
/*!
* Bootswatch v4.1.1
* Homepage: https://bootswatch.com
* Copyright 2012-2018 Thomas Park
* Licensed under MIT
* Based on Bootstrap
*//*!
* Bootstrap v4.1.1 (https://getbootstrap.com/)
* Copyright 2011-2018 The Bootstrap Authors
* Copyright 2011-2018 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
-->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<!-- DataTables JQuery extension -->
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/fixedcolumns/3.2.6/js/dataTables.fixedColumns.min.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
<style type="text/css">
p#footer {
margin-left: 10px;
Expand Down Expand Up @@ -52,8 +34,13 @@
.container {
overflow: auto;
padding-bottom: 40px;
padding-left: 25px;
margin-top: 20px;
min-height: 100%;
margin-left: 0px;
margin-right: 0px;
max-width: none;
min-width: none;
/* must be same height as the footer */
}

Expand Down Expand Up @@ -147,5 +134,4 @@
div#navbar_links {
display: flex;
}

</style>
Loading

0 comments on commit 0b4f93b

Please sign in to comment.