Skip to content

Instantly share code, notes, and snippets.

View fomightez's full-sized avatar

Wayne's Bioinformatics Code Portal fomightez

View GitHub Profile
@fomightez
fomightez / SO Plot with trend line simple.ipynb
Created March 15, 2024 21:11
Adding a trend line after the fact in a different cell of a notebook.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / SO Plot with trend line.ipynb
Last active March 15, 2024 21:04
Example adding trend line later in a different cell
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / guess_number_script_with reset_v1.py
Created March 11, 2024 00:28
Guessing game using ipywidgets to enter guesses and not legacy-from-consoles `input()`, related to https://discourse.jupyter.org/t/input-function-not-working/2290/13?u=fomightez
import ipywidgets as widgets
import random
max_secret = 10
secret = random.randint(1, max_secret)
guesses_allowed = 3
guesses_made = 0
game_still_going = True
# to leave out the quotes around strings sent to `ouptut.update()`, based on https://stackoverflow.com/a/70130979/8508004
@fomightez
fomightez / demo_Fasta2Stucture.md
Last active February 23, 2024 22:14
Using mybinder dekstop to demo use of Fasta2Stucture that uses tkinter

Walkthrough for installation and trial use of Fasta2Structure in your browser in temporary remote sessions served via MyBinder

Benefits:

  • Runs remotely so nothing modified on your machine yet you can test Fasta2Structure use hands-on.
  • Almost everything is already prepared, only need to install one package (Biopython) and get the Fasta2Structure material to be demonstrated.
  • No login required.
@fomightez
fomightez / Answer_text.md
Last active February 22, 2024 18:15
How to use nbformat to see a cell has been run - answer to SO https://stackoverflow.com/q/78038479/8508004

The code below scans an .ipynb file where the first two and fifth cells were run (named example_nb_saved_first_two_cells_run_plus_last.ipynb) and then makes a new notebook out of the executed cells:

import nbformat as nbf
ntbk = nbf.read("example_nb_saved_first_two_cells_run_plus_last.ipynb", nbf.NO_CONVERT)
cells_executed_previously = []
for cell in ntbk.cells:
    if cell.execution_count != None:
        cells_executed_previously.append(cell)
new_ntbk = ntbk
@fomightez
fomightez / RECENT_RUNtest_millefy.ipynb
Created February 11, 2024 22:26
two other notebooks to test for SO https://stackoverflow.com/q/77969756/8508004 saying not rendering R kernel well
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / text_for_style_tips_in_Python_plots.md
Last active February 6, 2024 15:48
Style tips for plotting with Python for SO question https://stackoverflow.com/q/77944909/8508004

Style tips for plotting with Python for SO question https://stackoverflow.com/q/77944909/8508004

In general, I opt for Seaborn when plotting with Python. It is built on top of Matplotlib and handles a lot of the style stuff better than default Matplotlib.

A good initial starting point to getting it close to Excel is to use Seaborn's 'whitegrid' that you set with Seaborn's set_style() method.
So to kick things off, it is common to do:

import seaborn as sns
import matplotlib.pyplot as plt
@fomightez
fomightez / reload_imports_example.ipynb
Last active December 26, 2023 18:34
`.ipynb` file illustrating Use of reload to by pass default import handling for SO https://stackoverflow.com/a/77718555/8508004
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fomightez
fomightez / README.md
Last active November 17, 2023 21:39
millefy-binder pre-converted BigWig from BAM files

millefy-binder pre-converted BigWig files from package-supplied BAM files.
Millefy came with BAM files in /srv/conda/envs/notebook/lib/R/library/millefy/extdata/bam. Here they have been converted to BigWig format using deepTools' bamCoverage.

binSize here is 15. Running this on MyBinder would take a long time. So this is to allow it not to take as long as it should.