Skip to content

Instantly share code, notes, and snippets.

View dlebauer's full-sized avatar
😀

David LeBauer dlebauer

😀
View GitHub Profile
@dlebauer
dlebauer / hpc_job_stats.md
Created February 4, 2025 07:43
Slurm and SGE Job Stats

Equivalent Commands: Slurm vs SGE/OGS

1. Equivalent of seff (Job Efficiency Report)

Slurm:

seff <job_id>

SGE/OGS:

qacct -j 
library(xml2)
library(yaml)
# note: does not handle XML attributes or namespaces.
# should work for simple xml structure used by PEcAn
# Convert XML to YAML
xml2yml <- function(xml_string) {
yaml_string <- xml_string |>
read_xml() |>
/* required styles */
.leaflet-map-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
@dlebauer
dlebauer / sorghum-lines-genomics.md
Last active June 11, 2024 21:35
Genomics - Sorghum Lines
# to get the original version of the eCO2 file
download.file('https://github.com/cran/SoilR/raw/1.1-23/data/eCO2.rda',
'eCO2.rda')
load('eCO2.rda')
library(SoilR)
library(rstan)
totalC_t0 <- 7.7; # not included in data, so hard code here
t0 <- 0;
N_t <- 25; # calculated by inspection
library(tidyverse)
# x <- read_csv('C:/Users/David/Downloads/Untitled spreadsheet - Sheet1.csv')
#
# colnames(x)
# dim(x)
#
# xx <- x %>%
# rename(organ = `Plant tissue`,
# soil = `Soil \n Concentration`,
# bcf = BCF) %>%
@dlebauer
dlebauer / summarize_dbfiles.sql
Created November 2, 2022 18:57
figuring out why the dbfiles table gets so big
select extract(year from created_at) as year, container_type, count(*) as n from dbfiles where id between 1000000000 and 2000000000 group by container_type, year order by container_type, year;
select created_user_id, container_type, count(*) as n from dbfiles where id between 1000000000 and 2000000000 group by container_type, created_user_id order by n desc;
select * from dbfiles where created_user_id is not null;
select extract(year from created_at) as year, created_user_id, container_type, count(*) as n from dbfiles where id between 9000000000 and 10000000000 group by container_type, created_user_id, year order by year, container_type, created_user_id;
select null as year, created_user_id, container_type, count(*) as n from dbfiles where id between 9000000000 and 10000000000 group by container_type, created_user_id order by container_type, created_user_id;
@dlebauer
dlebauer / find_cohort_and_met_files.sql
Last active October 4, 2022 00:04
Find cohort files in BETYdb
select
site_id,
sites.sitename,
st_X(sites.geometry) as lon,
st_y(sites.geometry) as lat,
formats.name as format_name,
dbfiles.file_path as file_path,
inputs.name as filename,
inputs.start_date,
inputs.end_date,
We can't make this file beautiful and searchable because it's too large.
"site_id","sitename","lon","lat","format_name","file_path","filename","start_date","end_date","duration","created_at"
"1000026939","Moody AFB","-83.1753","30.984401","ed.met_driver_header files format","/projectnb/dietzelab/mccabete/test_pecan/cogongrass_projections/GFDL/moody_AFB/only_co2/ED_driver/Ed_driver/","Cmip5_RCP8.5_Present_day_temp","1/1/2006 06:00:00","1/1/2100 05:59:00","93 years 11 mons 30 days 23:59:00","6/4/2022 18:19:38.277567"
"1000026939","Moody AFB","-83.1753","30.984401","ed.met_driver_header files format","/projectnb/dietzelab/mccabete/test_pecan/cogongrass_projections/GFDL/moody_AFB/with_co2/ED_driver/","CMIP5_RCP8.5_with_Co2","1/1/2006 06:00:00","13/12/2100 05:59:00","94 years 11 mons 11 days 23:59:00","6/4/2022 18:17:08.145333"
"1000026939","Moody AFB","-83.1753","30.984401","ed.met_driver_header files format","/projectnb/dietzelab/mccabete/test_pecan/cogongrass_projections/GFDL/moody_AFB/resampled_present_day/ED_driver","Cmip5_Present_day","1/1/2006 06:00:00","1/1/2100 05:59:00","93 y
library(traits)
library(dplyr)
library(ggplot2)
options(betydb_url = 'https://www.betydb.org/',
betydb_api_version = 'v1'
)
yields <- betydb_search(result_type = 'yields', genus = 'Panicum', limit = 'none')
treatments <- betydb_query(table = 'treatments', limit = 'none') %>%
dplyr::mutate(treatment_id = id) %>%