Skip to content

Instantly share code, notes, and snippets.

View afrendeiro's full-sized avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / series_matrix2csv.py
Created December 10, 2020 16:49
Get a GEO series matrix file describing an experiment and parse it into project level and sample level data.
#!/usr/bin/env python
"""
Get a GEO series matrix file describing an experiment and
parse it into project level and sample level data.
"""
import os
from typing import Tuple, Union
import tempfile
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 / 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
@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 / get_gene_set_libraries.py
Last active March 4, 2024 13:43
Download gene set libraries from Enrichr in GMT format for ssGSEA - done in parallel with async
from pathlib import Path
import parmap
import requests
def update(gsll):
return [g for g in gsll if not (output_dir / (g + ".gmt")).exists()]
@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