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
| import os | |
| def storage_walk(storage, top='/'): | |
| """ | |
| List all files in django storage | |
| """ | |
| dirs, nondirs = storage.listdir(top) | |
| for name in nondirs: | |
| yield os.path.join(top, name) |
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
| # Plot differential gene expression venn diagram using python | |
| # Example dataframe | |
| # sample1 sample2 sample3 | |
| # gene1 1 0 1 | |
| # gene2 0 1 0 | |
| # gene3 -1 0 0 | |
| # gene4 0 0 -1 | |
| # gene5 0 1 0 | |
| from collections import defaultdict |
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
| class CachingDict: | |
| def __init__(self, path): | |
| self.path = path | |
| if os.path.exists(self.path): | |
| with open(self.path) as json_file: | |
| self.data = json.load(json_file) | |
| else: | |
| self.data = dict() | |
| self.dump() |
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
| import numpy as np | |
| import pandas as pd | |
| import seaborn as sns | |
| from matplotlib import pyplot as plt | |
| def plot_volcano(data: pd.DataFrame, log2_fc_col: str, p_value_col: str, plot_title: str = "Volcano plot"): | |
| """ | |
| Plot volcano with seaborn | |
| :param data: pandas DataFrame with your data |
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
| def plot_scatter_psr2(df: pd.DataFrame, x: str, y: str, | |
| label_x: Optional[str] = None, label_y: Optional[str] = None, | |
| title: str = None, | |
| filename: str = None, | |
| labels: List[str] = None | |
| ) -> None: | |
| fig, ax = plt.subplots(figsize=(9, 6), dpi=200) | |
| ax.scatter(df[x], df[y], marker="v", color="cornflowerblue") | |
| a, b, r, p, err = scipy.stats.stats.linregress(df[x].values, df[y].values) |
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
| ## API class for https://toncenter.com/ | |
| ## requirements: | |
| # tonsdk https://github.com/tonfactory/tonsdk/ | |
| # requests | |
| # Donate (TON): EQCZG0qnpnNK2dCYoLCiLMCuP-QviaFvWiVDQja1vgMXn7uD | |
| from typing import Optional, Literal, List, Coroutine | |
| import aiohttp | |
| import requests |