Skip to content

Commit

Permalink
Merge branch 'develop' into cris
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbrooks committed Jul 8, 2019
2 parents f605fd3 + 194c724 commit cbfad3f
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 43 deletions.
2 changes: 1 addition & 1 deletion models/spreadsheets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ def get_upside(user=None):

dfs, combined_index = Spreadsheet.join_spreadsheets(spreadsheets)

datasets = [df[spreadsheet.get_data_columns()].values for df, spreadsheet in zip(dfs, spreadsheets)]
datasets = [df[spreadsheet.get_data_columns(by_day=False)].values for df, spreadsheet in zip(dfs, spreadsheets)]

# Run the actual upside calculation
upside_p = nitecap.upside.main(spreadsheets[primary].num_replicates_by_time, datasets[primary],
Expand Down
4 changes: 4 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ body {
color: #FFF;
}

.stats-box td {
cursor: pointer;
}

#spreadsheetTable.dataTable tr.selected td.select-checkbox::after, #spreadsheetTable.dataTable tr.selected th.select-checkbox::after {
font-family: "Font Awesome 5 Free";
content: "\f14a";
Expand Down
57 changes: 56 additions & 1 deletion static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function rowStatsByTimepoint(row, times) {
});

var stds = variances.map(Math.sqrt);
var sems = stds.map(function (std, time) { return std / reps_per_timepoint[time]; });
var sems = stds.map(function (std, time) { return std / Math.sqrt(reps_per_timepoint[time]); });

return {means: means, variances: variances, stds: stds, sems:sems};
}
Expand Down Expand Up @@ -230,6 +230,61 @@ function means(table) {
return table.map(mean);
}

// Util that takes a two-dim array-of-arrays and computes the sum of each row
// NaNs are skipped (if all are NaN, then NaN is returned)
// If axis=1, then sums on each row in the table, ie does sum(table[i][j]) summing over j
// If axis=0, then sums on the first axis, i.e. does sum(table[i][j]) summing over i
function sums(table, axis) {
axis = axis !== undefined ? axis : 1;

function sum(row) {
let sum = 0;
let count = 0;
row.forEach( function(x) {
if (isNaN(x) || x === null) {
return;
}
sum += x;
count += 1;
} );

if (count === 0) {
return NaN;
}
return sum;
};

if (axis === 1) {
// Take the sum of data[i][*]
return table.map(sum);
} else if (axis === 0) {
// Select out data[*][j] and take the sum
return table[0].map( function (_,j) {
return sum(table.map( function(row) {
return row[j];
}));
});
} else {
return "axis must be 1 (default) or 0";
}
}

// Util that takes a two-dim array-of-arrays and computes the number of non-NaN elements
// in each row
function numValids(table) {
function count(row) {
let count = 0;
row.forEach( function(x) {
if( isNaN(x) || x === null ){
return;
}
count += 1;
});
return count;
}
return table.map(count);
}

// Util to pad a string with copies of a character
function padEnd(string, length, character) {
if (string.length > length) {
Expand Down
4 changes: 2 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" />
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.3.0/css/select.dataTables.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.css" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}?v=2" />
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}?v=3" />
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='images/favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='images/favicon-16x16.png') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='images/favicon.ico') }}">
Expand All @@ -35,7 +35,7 @@
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.0.1/mustache.min.js"></script>
<script src="{{ url_for('static', filename='js/moment.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}?v=3"></script>
<script src="{{ url_for('static', filename='js/main.js') }}?v=6"></script>
</head>
<body>
<div class="container">
Expand Down
20 changes: 16 additions & 4 deletions templates/faqs.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h5 class="mb-0">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseTwo"
aria-expanded="true" aria-controls="collapseTwo">
Why are my ANOVA p-values blank?
Why are my ANOVA p-values N/A?
</button>
</h5>
</div>
Expand Down Expand Up @@ -70,7 +70,10 @@ <h5 class="mb-0">
Nitecap accepts most spreadsheets as is and supports Excel xls, xlsx spreadsheets (with your data in the first sheet in the file, if multiple sheets) as well as tab-separated and comma-separated files.
The data should be formatted with one column per sample and one row per one feature (e.g. gene, protein or other value measured).
Which column corresponds to which timepoint is set by the user after uploading the spreadsheet and no specific column headers are required.
For convenience, if sample columns are labelled as ZT## or CT## (e.g. CT0, CT4, CT8, CT12, ...) then the number values will be used to infer timepoints when possible.
For convenience, if sample columns headers include ZT## or CT## (e.g. CT0, CT4, CT8, CT12, ...) then the number values will be used to infer timepoints when possible and for labels of timepoints.
Similarly, if the columns contains ##:## (e.g. 12:04) time values, then those will be used.
</p>
<p>
Additional columns are no problem and can be used to label the values by selecting ID and multiple columns may be used as ID columns.
</p>
</div>
Expand Down Expand Up @@ -159,10 +162,15 @@ <h5 class="mb-0">
<div class="card-body">
<p>
Nitecap is currently under development and has not yet been published, so no citation is yet possible.
If you publish a work using Nitecap, please let <a href="mailto:[email protected]">let us know</a>.
</p>
<p>
If you use the JTK analysis results in your paper, the <a href="https://openwetware.org/wiki/HughesLab:JTK_Cycle">developers of JTK_cycle</a> ask users to cite <a href="http://www.ncbi.nlm.nih.gov/pubmed/20876817">their paper</a>.
</p>
<p>
If you use phase and amplitude difference statistics, you can cite Bingham, Arbogast, Cornelissen Guillaume, Lee, Halberg "Inferential Statistical Methods for Estimating and Comparing Cosinor Parameters," 1982.

</p>
</div>
</div>
</div>
Expand All @@ -179,13 +187,17 @@ <h5 class="mb-0">
<div id="collapseEight" class="collapse" aria-labelledby="headingEight" data-parent="#faq_list">
<div class="card-body">
<p>
There is a share button on every dataset which gives a URL that can be given to your colleagues to access the dataset.
If you have logged into your account, there is a share button on every dataset which gives a URL that can be given to your colleagues to access the dataset.
Note that anyone with the URL can access it, so consider who you share it with.
</p>
<p>
When someone opens the link, they receive a copy of the dataset and none of the changes they make will be reflected in your copy.
If you modify your dataset, then that modification will go to anyone who clicks the link after your modification, but not for anyone who clicked before.
</p>
<p>
Unfortunately we do not yet support sharing comparisons between multiple spreadsheets.
Instead, you should share all the individual spreadsheets and if your colleague opens each spreadsheet link, they can perform a comparison by visiting their <a href="/spreadsheets/display_spreadsheets">spreadsheet list</a> page.
</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -214,7 +226,7 @@ <h5 class="mb-0">
In particular, note that if any one of the datasets has non-significant rhythmicity, the p-value for the phase test will be non-significant.
This is desirable since the phase of a non-rhythmic feature is undefined.
Hence this p-value is significant only when all are significantly rhythmic and the difference in their phases are significant.
The amplitude of a non-sigificant rhythmicity should be low and hence an amplitude difference is still meaningful and the test is more powerful.
The amplitude of a non-significant rhythmicity should be low and hence an amplitude difference is still meaningful and the test is more powerful.
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit cbfad3f

Please sign in to comment.