Skip to content

Instantly share code, notes, and snippets.

View afrendeiro's full-sized avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@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",
# ]
# ///
@afrendeiro
afrendeiro / ubuntu_fresh_install.sh
Last active November 24, 2024 21:24
Software install from fresh Ubuntu 14.04 LTS image on AWS EC2
# New users
sudo adduser username
# Grant the new user sudo privileges
sudo visudo
# username ALL=(ALL:ALL) ALL
# add this line ^^
# change to that user
su - username
@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
@afrendeiro
afrendeiro / flac+cue2mp3.sh
Created September 15, 2013 10:39
Command-line conversion of flac+cue files to mp3 split tracks
#!/bin/sh
# Flacon-style convert to mp3 and split tracks from flac+cue files
# Made by André Rendeiro (afrendeiro@gmail.com)
# Rename
{
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
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 / 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()]