Skip to content

Instantly share code, notes, and snippets.

View stephenturner's full-sized avatar

Stephen Turner stephenturner

View GitHub Profile
@stephenturner
stephenturner / animate-primes.R
Created January 20, 2026 10:12
animate-primes.R
library(primes)
library(tidyverse)
primes <- generate_primes(max = 5000)
df <- tibble(
i = 1:length(primes),
primes,
radius = sqrt(primes),
x = radius * cos(primes),
Please summarize the paper. Follow these two steps.
## Step 1
Act as a curious, meticulous reader with attention to detail, objectivity, precision and sensitivity to novelty. Your job is to:
* Summarize each and every (!!!) key point/insight. Do not miss any; if there are many key points/insights, list them all regardless of length.
* Each point/insight must come with rich, precise, specific (!!!) details (e.g., numbers); details are really important.
* Each point/insight must be supported with direct quotes (!!!). Do not use quotes to simply repeat the point; instead, embed them naturally within your summary. Quotes should be used to better present the points (see the example below).
* If two points/insights are redundant, consider combining or integrating them. Be concise, but do not miss key points, insights, or details.
* If the text has sections (e.g., an academic paper), proceed section by section (e.g., focus on the first, then the second and so on), with each summary section starting with the origin
@stephenturner
stephenturner / gpt-5-how-to-create-ai-resistant-assignments.md
Created November 30, 2025 13:37
GPT 5.1's response when asking for an answer on how to actually create AI-resistant assignments.

See my blog post here: https://blog.stephenturner.us/p/ai-resistant-assignments. This is GPT-5.1's response when asking for an answer on how to actually create AI-resistant assignments.


Short answer: for take-home work you mostly cannot make it “AI proof.” What you can do is 3 things at once:

  1. Put some secure, AI-free checkpoints in every course.
  2. Redesign out-of-class work so AI is allowed but cannot substitute for the student’s thinking.
  3. Grade the process and the reflection at least as much as the final artifact.
@stephenturner
stephenturner / gh-orgs-licenses.R
Created August 20, 2025 15:12
Sequencing-related orgs' GitHub repos and licensing
# ------------------------------------------------------------
# GitHub org license audit + stacked bar chart (R / tidyverse)
# ------------------------------------------------------------
# Prereqs:
# install.packages(c("gh","dplyr","purrr","tidyr","stringr","ggplot2","forcats"))
# Auth: Sys.setenv(GITHUB_PAT = "<your fine-grained or classic PAT>") # optional but recommended
library(gh)
library(dplyr)
library(purrr)
@stephenturner
stephenturner / revcomp-copilot.md
Created July 16, 2025 09:10
Example code and output for reverse complementing a DNA sequence with R

Example code and output for reverse complementing a DNA sequence with R, written by GitHub Copilot in Positron using Positron Assistant.

For more details, see the blog post at:
https://blog.stephenturner.us/p/positron-assistant-copilot-chat-agent.

# R function to reverse complement a DNA sequence
reverse_complement <- function(dna_sequence) {
  # Convert the DNA sequence to uppercase
  dna_sequence <- toupper(dna_sequence)
@stephenturner
stephenturner / reticulate-huggingface-pybigwig.R
Last active May 18, 2025 11:58
Demonstration using reticulate to access the Hugging Face transformers library and pyBigWig in R using uv
# Demo 1: NLP -------------------------------------------------------------
# Load reticulate, declare that we'll use pytorch and huggingface transformers
library(reticulate)
py_require("torch")
py_require("transformers")
# Use the transformers python, and use the sentiment analysis pipeline
transformers <- import("transformers")
analyzer <- transformers$pipeline("sentiment-analysis")
@stephenturner
stephenturner / uv-polars-seaborn-demo.ipynb
Created February 15, 2025 10:51
Demo using polars and seaborn in jupyter via uv
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stephenturner
stephenturner / get-human-gene-info.R
Created December 30, 2024 14:36
Get information about human genes from RefSeq
library(tidyverse)
# Get Gene Summary info
gs_orig <- read_tsv("https://ftp.ncbi.nlm.nih.gov/gene/DATA/gene_summary.gz")
gs <- gs_orig |>
janitor::clean_names() |>
set_names(str_replace, "number_tax_id", "tax_id") |>
filter(tax_id==9606) |>
distinct()
gs
@stephenturner
stephenturner / 2024-12-18-2024-12-24-bsky-summary-llama3.3.md
Created December 27, 2024 19:27
Summary of #Rstats posts on bluesky from 2024-12-18 to 2024-12-24 using llama3.3

Summary

Produced with llama3.3

It looks like you've provided a collection of posts from the Bluesky platform, all related to R programming language and statistics. Here's a brief summary:

Main themes:

  1. RStats community: Many users are sharing their experiences, tools, and projects related to R programming.
  2. Data visualization: Several posts showcase beautiful visualizations created using R packages like ggplot2.
@stephenturner
stephenturner / 2024-12-18-2024-12-24-bsky-summary-mistral.md
Created December 27, 2024 19:24
Summary of #Rstats posts on bluesky from 2024-12-18 to 2024-12-24 using mistral

Summary

Produced with mistral

  1. Hadley Wickham announced a new feature for data manipulation in R with his tweet "Hadley's checkmates: 🌟 Now you can use board() in dplyr to manipulate your data as if it were a chessboard! Just another reason to love working with data in R. #Rstats"

  2. StatLab shared an interesting statistic about the number of posts tagged with #RStats, saying "Today's trivia: The average number of posts per day on our platform that include the hashtag #RStats (case insensitive) for the period September 1 - December 20 (excluding CRAN Package Updates Bot) is approximately xxx. Data visualized using bskyr and ggplot2 R packages."

  3. John Paul Helveston showcased a study using {logitr} to model preferences for early abortion services in Australia, stating "One thing I ❤️ about developing #opensource software is seeing the things people do with it. Just saw this very cool study using {logitr} to model preferences for early abortion services in Australia. Check out this gorgeous plo