Skip to content

Instantly share code, notes, and snippets.

View EthanHolleman's full-sized avatar
🐱
cat

Ethan Holleman EthanHolleman

🐱
cat
View GitHub Profile
@EthanHolleman
EthanHolleman / G2R_parse.py
Created November 8, 2019 00:37
Small script to pull out specific highest p value genes from G2R expression data
import csv
GENES = set(['PML', 'OAS2', 'OASL', 'IRF7', 'OAS1', 'OAS3', 'BTBD1', 'BTBD2', 'IRF3', 'GBP1'])
# set of target genes
CGI = '' # G2R file path here
OUT = '' # output directory here
def find_genes():
results = {}
with open(CGI) as C:
@EthanHolleman
EthanHolleman / subset_sum.py
Created November 1, 2019 18:27
Greedy approach to subset sum problem in python
def subset_sum(l, k): # l = list values, k is subset sum
l = sorted(l, reverse=True)
subset = set([])
for i in l:
if k >= i and i not in subset:
k-= i
subset.add(i)
if k == 0:
break
return subset
@EthanHolleman
EthanHolleman / brownfield_cook.py
Last active October 7, 2019 01:56
Very quick and dirty parsing federal brownfield sites file for Cook county records
lines = []
f_set = set([])
with open('NATIONAL_FACILITY_FILE.CSV') as big:
for i, row in enumerate(big):
s = row.split(',')
if len(s) >= 10:
if s[6] == '"COOK"' and s[9] == '"ILLINOIS"':
lines.append(row)
@EthanHolleman
EthanHolleman / brownfield_cook.py
Created October 7, 2019 01:51
Very quick and dirty parsing federal brownfield sites file for Cook county records
lines = []
f_set = set([])
with open('NATIONAL_FACILITY_FILE.CSV') as big:
for i, row in enumerate(big):
s = row.split(',')
if len(s) >= 7:
if s[6] == '"COOK"':
lines.append(row)
f_set.add(s[1])
@EthanHolleman
EthanHolleman / repens_plot.py
Created September 12, 2019 18:19
Small script to plot basic locations and number of LTR predictions for repens genome scaffolds.
# script to plot the locations and number of LTR predictions for repens
# genome scaffolds. Previously thought that only scaffolds where present but
# some of the entries are labeled as chromosomes. Additionally, LTR elements
# almost exclusively predicted in the chromosome regions. chromosome predictably
# much longer than any single scaffold, not sure if they are seperate / unique
# from all scaffold sequences.
import csv
import matplotlib.pyplot as plt
@EthanHolleman
EthanHolleman / bovine.py
Last active May 8, 2019 22:32
In progress webscrape script for cattle-exchange.com
import requests
from bs4 import *
url = 'https://www.cattle-exchange.com/'
req = requests.get(url)
homePage = BeautifulSoup(req.text, 'html.parser')
breeds = (homePage.find("ul", {"class" : "views-summary"})).contents
extensions = []
@EthanHolleman
EthanHolleman / TextEdit.java
Created March 9, 2019 23:42
Comp HW 5 java code
import java.io.*;
import java.util.*;
public class Text {
private ArrayList<String> words = new ArrayList<String>();
private ArrayList<String> dictionary;
public Text() { //default contructor
@EthanHolleman
EthanHolleman / BowtieParamsTest.py
Created March 7, 2019 19:30
Script to test the results of allignments to GM chr 1 with LTR consensus sequence using a few differenent parameters
import os
a,b,c,d = 0,0,0,0
with open("commands.txt", "w") as list:
command = "bowtie2 -x V1V1Index -r LTRCon.txt -a -S test.sam --non-deterministic -p 4"
os.system(command)
print("command executed")
os.system("samtools view test.sam | wc -l > commandsNums.txt")
@EthanHolleman
EthanHolleman / BuzzbookReformat.py
Created March 7, 2019 19:27
Small script to organize a terribly formated contact sheet into more usable format for automated emailing programs
import openpyxl
wb = openpyxl.load_workbook('Buzz.xlsx')
sheets = wb.sheetnames
names = []
emails = []
for i in sheets: #loops through 4 sheets in the file
current = wb[i]
@EthanHolleman
EthanHolleman / blastTest.py
Created February 4, 2019 04:05
First blast db creation and search program.
#This code assumes that scripts are kept in bin file and all other folders are within bin
import os
import random
def makeBlastDB(title, inputFilePath, out): #makes local blast database
blastCommand = "makeblastdb -dbtype nucl -in {} -title {} -out {}".format(inputFilePath, title, out)
print(blastCommand)
os.system(blastCommand)