This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from typing import Optional, Tuple | |
| def colored_barplot(x: np.ndarray, y: np.ndarray, colors: np.ndarray, y_ticks: Optional[np.ndarray]=None, fig_size: Tuple[float, float]=(10.0, 10.0), label_rotation: float=75): | |
| index = np.arange(0, len(x)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import pandas as pd | |
| import seaborn as sns | |
| from scipy.spatial.distance import squareform | |
| from sklearn import manifold | |
| from scipy.spatial.distance import pdist | |
| from sklearn.decomposition import PCA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import pandas as pd | |
| import itertools | |
| from typing import Iterator | |
| def marker_iterator(df: pd.DataFrame, class_column: str='class') -> Iterator[str]: | |
| """Returns an iterator of decent marker shapes. The order is such that similar markers aren't used unless they're needed.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import numpy as np | |
| from matplotlib import pyplot as plt | |
| import seaborn as sns | |
| import matplotlib | |
| import pandas as pd | |
| from typing import Callable, Tuple, Dict, Optional, Union |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import pymysql | |
| import contextlib | |
| from typing import Tuple, List, Dict, Iterator | |
| @contextlib.contextmanager | |
| def connected(connection: pymysql.connections.Connection): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Douglas Myers-Turnbull wrote this for the Kokel Lab, which has released it under the Apache Software License, Version 2.0 | |
| # See the license file here: https://gist.github.com/dmyersturnbull/bfa1c3371e7449db553aaa1e7cd3cac1 | |
| # The list of copyright owners is unknown | |
| import re | |
| import warnings | |
| import time | |
| from chemspipy import ChemSpider |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Apache License | |
| Version 2.0, January 2004 | |
| http://www.apache.org/licenses/ | |
| TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
| 1. Definitions. | |
| "License" shall mean the terms and conditions for use, reproduction, | |
| and distribution as defined by Sections 1 through 9 of this document. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Iterator, Tuple, Dict, List | |
| class MissingConfigEntry(Exception): pass | |
| class TomlData: | |
| """A better TOML data structure than a plain dict. | |
| Usage examples: | |
| data = TomlData({'x': {'y': {'z': 155}}}) | |
| print(data['x.y.z']) # prints 155 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Union | |
| from pathlib import PurePath | |
| def listen(path: Union[str, PurePath, bytes]): | |
| """ | |
| Returns an audio container that Jupyter notebook will display. | |
| Must be run from a Jupyter notebook. | |
| Will raise an ImportError if IPython cannot be imported. | |
| :param path: The local path to the audio file | |
| :return: A jupyter notebook ipd.Audio object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from IPython.display import display, Markdown, HTML | |
| display(HTML("<style>.container { width:100% !important; }</style>")) |