Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| int[][] result; | |
| float t, c; | |
| float ease(float p) { | |
| return 3*p*p - 2*p*p*p; | |
| } | |
| float ease(float p, float g) { | |
| if (p < 0.5) | |
| return 0.5 * pow(2*p, g); |
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 | |
| from functools import lru_cache | |
| from collections import defaultdict | |
| # Read in the taxonomy | |
| class NCBITaxonomy(): | |
| def __init__(self, folder): | |
| self.tax = defaultdict(dict) | |
| # Read in the file of taxid information | |
| names_fp = os.path.join(folder, 'names.dmp') |
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
| Updated 2025-01-17 thanks to Yemster's comment. | |
| This should work on any architecture of Amazon Linux 2. | |
| (_Although not tested , should also work for Amazon Linux 2023_). | |
| **Prereq** | |
| - visit https://johnvansickle.com/ffmpeg/ to grab the link to the relevant tarball for your specific server architecture. | |
| - Use `uname -a` to find out your arch if unknown | |
| ### TL;DR |
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
| # List unique values in a DataFrame column | |
| df['Column Name'].unique() # Note, `NaN` is included as a unique value. If you just want the number, use `nunique()` which stands | |
| # for 'number of unique values'; By default, it excludes `NaN`. `.nunique(dropna=False)` will include `NaN` in the count of unique values. | |
| # To extract a specific column (subset the dataframe), you can use [ ] (brackets) or attribute notation. | |
| df.height | |
| df['height'] | |
| # are same thing!!! (from http://www.stephaniehicks.com/learnPython/pages/pandas.html | |
| # -or- | |
| # http://www.datacarpentry.org/python-ecology-lesson/02-index-slice-subset/) |
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 matplotlib.pyplot as plt | |
| import seaborn as sns | |
| from matplotlib.lines import Line2D | |
| my_palette = sns.color_palette("cubehelix", 3) | |
| sns.set_palette(my_palette) | |
| def legend_circles(labels, palette, loc=1, markersize=10, marker='o', padding=0): | |
| "Make a legend where the color is indicated by a circle." |
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
| # Get a list of all organisms | |
| curl -s "http://rest.kegg.jp/list/organism" > organisms-all.txt | |
| # Get just a few of interest | |
| cat organisms-all.txt | awk '$2~/^(hsa|mmu|rno|cfa|bta|gga|xla|xtr|dre|dme|cel|ath|ehi|tgo|eco|sau|mtu|mav|cje|ccol)$/' > organisms-of-interest.txt | |
| # Get the accession codes for each | |
| cut -f1 organisms-of-interest.txt > organisms-of-interest-codes.txt | |
| # Make a directory to put all the kgml files downloaded |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # These are meant to work in both Python 2 and 3, except where noted. | |
| # See my useful_pandas_snippets.py for those related to dataframes (such as pickling/`df.to_pickle(save_as)`) | |
| # https://gist.github.com/fomightez/ef57387b5d23106fabd4e02dab6819b4 | |
| # also see https://gist.github.com/fomightez/324b7446dc08e56c83fa2d7af2b89a33 for examples of my | |
| # frequently used Python functions and slight variations for more expanded, modular structures. | |
| #argparse | |
| # good snippet collection at https://mkaz.tech/code/python-argparse-cookbook/ |
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
| library(magick) | |
| library(reshape2) | |
| library(dplyr) | |
| library(tidygraph) | |
| library(particles) | |
| library(animation) | |
| plot_fun <- function(sim) { | |
| df <- as_tibble(sim) | |
| plot(df$x, df$y, col = df$color, pch = '.', axes = FALSE, xlim = c(-100, 317), ylim = c(-268, 100), xlab = NA, ylab = NA) |