Skip to content

Instantly share code, notes, and snippets.

View chasemc's full-sized avatar
:octocat:

Chase Clark chasemc

:octocat:
View GitHub Profile
# Start with Ubuntu base image
FROM ubuntu:22.04
# Set environment variables to prevent prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Update and install dependencies
RUN apt-get update && apt-get install -y \
software-properties-common \
build-essential \
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chasemc
chasemc / mac_dirselect.R
Created January 2, 2024 17:20
Select a directory in R with macOS Finder
selected_dir<- system('osascript -l JavaScript -e \'a=Application.currentApplication();a.includeStandardAdditions=true;a.chooseFolder({withPrompt:"Please select a file to process:"}).toString()\'', intern = TRUE, ignore.stderr = T)
import pandas as pd
from shiny import App, Inputs, Outputs, Session, reactive, render, ui
from shiny.types import FileInfo
app_ui = ui.page_fluid(
ui.input_file("file1", "Choose CSV File", accept=[".csv"], multiple=False),
ui.input_checkbox_group(
"stats",
"Summary Stats",
library(IDBacApp)
library(dplyr)
library(DBI)
library(pool)
library(coop)
# Change this to be the full file path to your sqlite file
sqlite_filepath <- "/home/chase/Downloads/NK_Library_Full_Up_To_2023-10-02-Copy.sqlite"
def parse_fasta(filepath: str) -> Generator[str, str]:
seq_id = ""
with open(filepath, "r") as h:
seq_id = ""
seq = ""
for i in h:
if i[0] == ">":
if seq_id:
yield (seq_id, seq)
seq_id = i[1:].strip()
@chasemc
chasemc / fasta_to_sqlite.py
Created August 24, 2023 19:36
Convert a fasta file to sqlite, assumes defline is a unique id and there are no duplicates
#!/usr/bin/python3
# MIT License
# Copyright (c) Chase M. Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
https://docs.google.com/presentation/d/1NqwMVOYB2o_sqkOjoPH_AK1zKxrYyYcaUv8ZuAmU8og/edit?usp=sharing
import json
z=set()
with open("/media/socialgene_nvme/v0.2.3/refseq/socialgene_neo4j/import/antismash_results.jsonl", "r") as h:
for line in h:
for record in json.loads(line)['records']:
for k,v in record.items():
for i in v:
for ii in i['products']:
z.add(ii)