aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/helper_functions.py
AgeCommit message (Collapse)Author
2022-09-08Replace g.db with database_connection() context managerMunyoki Kilyungi
* wqflask/base/mrna_assay_tissue_data.py: Replace "flask.g" with database_connection. (MrnaAssayTissueData.__init__): Use database_connection. (MrnaAssayTissueData.get_symbol_values_pairs): Ditto. * wqflask/base/species.py: Replace "Flask.g" imports with "database_connection". (Chromosomes.chromosomes): Use database_connection. * wqflask/base/trait.py: Import database_connection. (retrieve_trait_info): Use database_connection. * wqflask/utility/authentication_tools.py: Replace "flask.g" with database_connection. (get_group_code): Use database_connection. * wqflask/utility/helper_functions.py: Replace "flask.g" with "database_connection". (get_species_groups): Use database_connection. * wqflask/wqflask/db_info.py: Replace "Flask" and "g" with "database_connection". (InfoPage.get_info): Use database_connection. * wqflask/wqflask/do_search.py (DoSearch.execute): Use database_connection(). * wqflask/wqflask/external_tools/send_to_geneweaver.py: Replace "Flask" and "g" import with database_connection. (test_chip): Use database_connection. * wqflask/wqflask/external_tools/send_to_webgestalt.py: Replace "Flask, g" imports with database_connection. (test_chip): Use database_connection. * wqflask/wqflask/gsearch.py: Replace "Flask" and "g" import with database_connection. (GSearch.__init__): Use database_connection. * wqflask/wqflask/interval_analyst/GeneUtil.py (loadGenes): Use database_connection(). * wqflask/wqflask/show_trait/SampleList.py: Replace "flask.g import" with database_connection. (SampleList.get_attributes): Use database_connection. (SampleList.get_extra_attribute_values): Ditto. * wqflask/wqflask/show_trait/show_trait.py: Replace "Flask" and "g" import with database_connection. (ShowTrait.__init__): Use database_connection. (ShowTrait.get_external_links): Ditto. (get_nearest_marker): Ditto.
2022-08-31Remove usage of "logger" and un-necessary comments wrt the sameMunyoki Kilyungi
Logging is used to introspect variables or notify the commencement of a given operation. Logging should only be used to log errors. Also, most of the logging is either "logger.debug" or "logger.info"; and this won't show up in production/testing since we need a logging level above "WARNING" for them to show up. * wqflask/base/data_set.py (create_datasets_list): Remove logger. (Markers.add_pvalues): Ditto. (DataSet.retrieve_other_names): Ditto. * wqflask/base/mrna_assay_tissue_data.py: Ditto. * wqflask/base/webqtlCaseData.py: Ditto. * wqflask/db/call.py (fetch1): Ditto. (gn_server): Ditto. * wqflask/db/gn_server.py: Ditto. * wqflask/maintenance/set_resource_defaults.py: Ditto. * wqflask/utility/Plot.py (find_outliers): Ditto. * wqflask/utility/gen_geno_ob.py: Ditto. * wqflask/utility/helper_functions.py: Ditto. * wqflask/utility/pillow_utils.py: Ditto. * wqflask/utility/redis_tools.py: Ditto. * wqflask/wqflask/api/gen_menu.py (get_groups): Ditto. * wqflask/wqflask/api/mapping.py: Ditto. * wqflask/wqflask/api/router.py (get_dataset_info): Ditto. * wqflask/wqflask/collect.py (report_change): Ditto. * wqflask/wqflask/correlation/corr_scatter_plot.py: Ditto. * wqflask/wqflask/ctl/ctl_analysis.py (CTL): Ditto. (CTL.__init__): Ditto. (CTL.run_analysis): Ditto. (CTL.process_results): Ditto. * wqflask/wqflask/db_info.py: Ditto. * wqflask/wqflask/do_search.py (DoSearch.execute): Ditto. (DoSearch.mescape): Ditto. (DoSearch.get_search): Ditto. (MrnaAssaySearch.run_combined): Ditto. (MrnaAssaySearch.run): Ditto. (PhenotypeSearch.run_combined): Ditto. (GenotypeSearch.get_where_clause): Ditto. (LrsSearch.get_where_clause): Ditto. (MeanSearch.run): Ditto. (RangeSearch.get_where_clause): Ditto. (PvalueSearch.run): Ditto. * wqflask/wqflask/docs.py: Ditto. * wqflask/wqflask/export_traits.py: Ditto. * wqflask/wqflask/external_tools/send_to_bnw.py: Ditto. * wqflask/wqflask/external_tools/send_to_geneweaver.py: Ditto. * wqflask/wqflask/external_tools/send_to_webgestalt.py: Ditto. * wqflask/wqflask/gsearch.py (GSearch.__init__): Ditto. * wqflask/wqflask/heatmap/heatmap.py: Ditto. * wqflask/wqflask/marker_regression/display_mapping_results.py (DisplayMappingResults): Ditto. * wqflask/wqflask/marker_regression/gemma_mapping.py: Ditto. * wqflask/wqflask/marker_regression/plink_mapping.py (run_plink): Ditto. * wqflask/wqflask/marker_regression/qtlreaper_mapping.py (run_reaper): Ditto. * wqflask/wqflask/marker_regression/rqtl_mapping.py: Ditto. * wqflask/wqflask/marker_regression/run_mapping.py (RunMapping.__init__): Ditto. * wqflask/wqflask/parser.py (parse): Ditto. * wqflask/wqflask/search_results.py (SearchResultPage.__init__): Ditto. * wqflask/wqflask/update_search_results.py (GSearch.__init__): Ditto. * wqflask/wqflask/user_login.py (send_email): Ditto. (logout): Ditto. (forgot_password_submit): Ditto. (password_reset): Ditto. (password_reset_step2): Ditto. (register): Ditto. * wqflask/wqflask/user_session.py (create_signed_cookie): Ditto.
2021-06-17remove print statementsAlexander Kabui
2021-05-07Fixed issue that caused /submit_trait page to not load properlyzsloan
2021-04-30autopep8: Fix E20-E27BonfaceKilz
Run: python -m autopep8 --in-place --recrusive ./ --select\ E20,E211,E22,E224,E224,E225,E226,E227,E228,E231,E241,\ E242,E251,E252,E26,E265,E266,E27 -p 3
2021-04-29Merge branch 'testing' into Feature/Add-upload-data-formsBonfaceKilz
2021-04-23Apply PEP-8BonfaceKilz
2021-04-23Move looped sql query into one statement in "get_species_groups"BonfaceKilz
It's in-efficient to have a sql query executed in a loop. As data grows, the query becomes slower. It's better to let sql handle such queries.
2021-04-23Remove stale commentsBonfaceKilz
2021-04-19Specify only getting the first two items after splitting the trait/dataset ↵zsloan
input string
2020-08-26Remove "from __future__ import new_feature" statementsBonfaceKilz
See: <https://docs.python.org/2/library/2to3.html#2to3fixer-future>
2020-08-26Replace calls to "basestring with "str""BonfaceKilz
See: <https://docs.python.org/2/library/2to3.html#2to3fixer-basestring>
2020-08-19Fix dictionary iteration methodsBonfaceKilz
Run `2to3-3.8 -f dict -w .` See: <https://docs.python.org/2/library/2to3.html#2to3fixer-dict> and <https://stackoverflow.com/questions/17695456/why-does-python-3-need-dict-items-to-be-wrapped-with-list>
2020-06-04Really should have split this into many more commits:zsloan
- Now use proxy to pull trait data and hide traits/results that the user doesn't have view permission for - Created a factory method for creating trait ob so it can return None when user doesn't have view permissions (this is why such a large number of files are changed) - Added metadata to permutation export - Added current group management code - Added fixed password verification e-mail code
2020-03-10Fixed issue that caused some problems when verifying hmaczsloan
2020-03-03Missed one more reference in helper_functionszsloan
2019-03-18- Added PCA traits to correlation matrix. You can't change their names yet ↵zsloan
or add them to a collection from the corr matrix page, but you can click them and access them from the trait page. I'll add the option to access them from the corr matrix page as well, but adding the option to change their names might be trickier since they're currently used as their Redis keys. I need some better way of passing the Redis key around so it can be stored in collections, but this is tricky without changing the structure in ElasticSearch - Fixed the way temp traits work so you can use them with various functions, like mapping, correlations, network graph, etc - Fixed some appearance issue where the network graph options were too wide if a trait name was too long
2018-10-01- Can now remove cofactors from correlation scatterplot and select them by ↵zsloan
just clicking their row in collection - Cofactor color picker now works in Safari/Macs - Displays N for relevant samples in trait page sample table - Don't show bar chart when N>256 - Mapping loading page contents better centered - Anonymous collections timeout correctly listed as 30 days now - Minor allele frequency can actually be changed for GEMMA now (previously didn't work) - Fixed transcript position marker location for mapping results - Notifies user if their e-mail isn't associated with an account when they attempt to request forgotten password - Users can now map with submitted traits - Histogram width changes depending upon number of bins (need to improve this still) - Improved Q-q plot (previously called "probability plot")
2017-02-06Fixed appearance of several tables (search, mapping results, sample data)zsloan
Temporarily removed second sample table for CFW traits Fixed location of global search bar to work with wider screens
2016-10-05print statements should be loggerPjotr Prins
2016-08-16Users can now select specific traits from collection when using collection ↵zsloan
tools (correlation matrix, wgcna, etc) To do the above, changed the way form submission worked for those features; previously each feature had its own form, but that was dumb so instead I wrote a javascript function that just changed a single form's target url Duplicate traits can no longer by added to collections Fixed the digits for a few table columns in collection (additive effect, etc).
2016-06-18Changed file permssions to non-executablePjotr Prins
2014-08-12Fixed the scrollable data tables for the show trait pageZachary Sloan
Added the option to display the rqtl results (and soon other mapping results) as either a manhattan plot or "interval map" style curve chart Removed a couple unnecessary javascript imports Changed the function in helper_functions.py that creates the trait and dataset objects, making it to where the trait object also gets qtl info Fixed color by trait after it was broken by the "scatterplot matrix" function
2014-07-18Added outlier highlightingZachary Sloan
Changed order of tabs in statistics panel on trait page Started working on heatmap
2014-05-05Committing a bunch of changes related to integrating GEMMA andZachary Sloan
adding the correlation matrix page
2013-07-19Finished integrating code that reads sample list from geno filesZachary Sloan
withouot using reaper and caches results so it doesn't need to read the file every single time someone loads a page
2013-06-13Fixed issue where too much memory was used as a result of creating aLei Yan
dataset object for each trait in the correlation results Added new fields/columns for each trait in the correlation result table (max LRS, max LRS location, mean expression) Fixed error if trait doesn't have these fields
2013-03-12Got cashing working with pickleZachary Sloan
2013-03-07Created file temp_data to store data related to progressZachary Sloan
of the marker regression calculations Storing progress of kinship matrix calculation in variable as portion of 45 (the rough percent of total marker regression calculation time
2013-02-19Made lines for manhattan plot proportional to chromosome lengthsZachary Sloan
2013-01-31Changed reference to 'dataset_name' in keywords to 'dataset' to getZachary Sloan
page to work, but will change all references to the dataset name to 'dataset_name' in future to avoid confusion between the dataset name and the actual dataset object
2013-01-22Pushed through a few errors in getting the correlation page runningZachary Sloan
2013-01-18Renamed CorrelationPage.py to show_corr_results.pyZachary Sloan
Worked with correlation code; got to the code that begins to do the actual correlations Created a function "get_dataset_and_trait" in the new file "helper_functions.py" because the code initializing the dataset and trait objects was repeated in multiple places