YeoLab / flotilla

Reproducible machine learning analysis of gene expression and alternative splicing data
http://yeolab.github.io/flotilla/docs
BSD 3-Clause "New" or "Revised" License
121 stars 26 forks source link

Simplify code #325

Open olgabot opened 8 years ago

olgabot commented 8 years ago

Looking into the McCabe index which measures the amount of complexity in the code, many functions in flotilla are too complex. Once we replace the guts holding the data with xray then I think many of these will fall away but yeah there's a lot of if/elses in this code :)

$ flake8 --max-complexity 10 | grep complex
./flotilla/datapackage.py:124:1: C901 'make_study_datapackage' is too complex (12)
./flotilla/data_model/gene_ontology.py:51:1: C901 'GeneOntologyData.enrichment' is too complex (11)
./flotilla/data_model/metadata.py:21:1: C901 'MetaData.__init__' is too complex (12)
./doc/sphinxext/ipython_directive.py:152:1: C901 'block_parser' is too complex (12)
./doc/sphinxext/ipython_directive.py:387:1: C901 'EmbeddedSphinxShell.process_input' is too complex (17)
./doc/sphinxext/ipython_directive.py:642:1: C901 'EmbeddedSphinxShell.process_pure_python' is too complex (17)
./flotilla/test/data_model/test_basedata.py:304:1: C901 'test_subsets_from_metadata' is too complex (11)
./flotilla/study.py:77:1: C901 'Study.__init__' is too complex (16)
./flotilla/study.py:1417:1: C901 'Study.save' is too complex (14)
./flotilla/visualize/generic.py:7:1: C901 'violinplot' is too complex (13)
./flotilla/visualize/network.py:26:1: C901 'NetworkerViz.draw_graph' is too complex (21)
./flotilla/visualize/network.py:220:1: C901 'NetworkerViz.draw_nonreduced_graph' is too complex (18)
./flotilla/visualize/decomposition.py:23:1: C901 'DecompositionViz.__init__' is too complex (11)
./flotilla/visualize/decomposition.py:358:1: C901 'DecompositionViz.plot_samples' is too complex (16)
./flotilla/visualize/decomposition.py:562:1: C901 'DecompositionViz.plot_violins' is too complex (15)
./flotilla/visualize/ipython_interact.py:83:1: C901 'Interactive.interactive_pca' is too complex (13)
./flotilla/visualize/ipython_interact.py:277:1: C901 'Interactive.interactive_classifier' is too complex (11)