Skip to content

Instantly share code, notes, and snippets.

View afrendeiro's full-sized avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / spatial_classifier_demo.py
Last active September 9, 2025 18:47
A quick demo of cell type classification from graphs
#!/usr/bin/env uv --script
# /// script
# dependencies = [
# "numpy",
# "squidpy>=1.6.5",
# "scikit-network",
# ]
# python_version = ">=3.12"
# ///
@afrendeiro
afrendeiro / convert_to_pptx.sh
Created June 25, 2025 15:29
Guaranteed flawless odp to pptx convertion
#!/bin/bash
set -e
INPUT="$1"
EXT="${INPUT##*.}"
BASENAME=$(basename "$INPUT" ."$EXT")
INPUT_DIR=$(dirname "$(realpath "$INPUT")")
TMPDIR=$(mktemp -d)
@afrendeiro
afrendeiro / modeling_compositional_data.py
Last active February 19, 2025 08:23
Testing out ILR transformation and compositional data testing
# /// script
# dependencies = [
# "numpy",
# "pandas",
# "statsmodels",
# "scikit-learn",
# "scikit-bio",
# "matplotlib",
# ]
# ///
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#! python3.7
import argparse
import os
import numpy as np
import speech_recognition as sr
import whisper
import torch
from datetime import datetime, timedelta
@afrendeiro
afrendeiro / rendeiro_Nature_2021_covid19_paper.geomx_diff_expression.py
Last active March 19, 2024 10:02
Re-analyze GeoMx data from Rendeiro et al. 2021 doi:s41586-021-03475-6
"""
Re-analyze GeoMx data from Rendeiro et al. 2021 doi:s41586-021-03475-6
Requirements (Python 3.10+):
pip install \
"anndata" \
"matplotlib>=3.8.3" \
"numpy>=1.26.4" \
"pandas>=2.1.0" \
"scanpy" \
@afrendeiro
afrendeiro / gdrive_download.py
Last active February 20, 2024 09:45
Download file given Google Drive URL
"""
Download file from Google Drive URL
"""
import os
import time
import click
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options as FirefoxOptions
oil saturated polyunsaturated (omega 3 & 6) monounsaturated trans fat other fat omega 3 omega 6 yield, litres per hectare smoke point flavour cooking conditions
almond 0.08 0.17 0.7 0.0 0.05 0.0 0.17 1380 230 2 >230 °C (Deep-frying)
beef tallow 0.5 0.04 0.42 0.0 0.04 0.01 0.03 - 220 1 200-229 °C (Stir-frying)
flaxseed 0.09 0.66 0.2 0.0 0.05 0.59 0.13 506 107 2 <150 °C (Dressings)
apricot kernel 0.06 0.29 0.6 0.0 0.05 0.0 0.29 680 257 0 >230 °C (Deep-frying)
argan 0.18 0.37 0.43 0.0 0.02 0.02 0.35 0.06 218 2 200-229 °C (Stir-frying)
avocado 0.12 0.14 0.71 0.0 0.03 0.01 0.13 2638 269 1 >230 °C (Deep-frying)
brazil nut 0.25 0.36 0.39 0.0 0.0 0.0 0.36 2392 195 2 150-199 °C (Light saute)
butter 0.51 0.03 0.21 0.033 0.25 0.0 0.03 - 167 2 150-199 °C (Light saute)
butter, clarified (ghee) 0.65 0.03 0.32 0.0 0.0 0.0 0.03 - 235 2 >230 °C (Deep-frying)
@afrendeiro
afrendeiro / test_nuclei_dataloaders.py
Last active November 21, 2023 17:46
Use torch dataloaders with nuclei coordinates for training.
"""
Use dataloaders with nuclei coordinates for training.
"""
from functools import partial
import requests
import h5py
from tqdm import tqdm
import numpy as np
@afrendeiro
afrendeiro / rasterize_pdf.sh
Created October 30, 2023 08:37
Rasterize PDF files
#!/bin/bash
# Terminate on first error
set -e
# Check if input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <input_file.pdf>"
exit 1
fi