Skip to content

Instantly share code, notes, and snippets.

new_df = snp_df.merge(df, how='inner', on=['rsid', 'genotype'], suffixes=('_SNPedia', '_myDNA'))
# Create a DataFrame for some subsets of genes
good_genes = new_df[new_df.repute == 'Good']
bad_genes = new_df[new_df.repute == 'Bad']
interesting_genes = new_df[new_df.magnitude > 4] # 4 is the threshold for "worth your time" given by SNPedia
# Get the base URL from SNPedia
base_url = 'https://www.snpedia.com/index.php/'
# Create URLs for each gene that I want to study
gene_urls = [base_url + rsid for rsid in bad_genes['rsid']]
# Initialize Selenium
browser = webdriver.Chrome()
import time
# Write a function to visit the SNPedia URLs, click through to PubMed,
# and retrieve the info on the articles for each gene
def scrape_abstracts(urls):
# DataFrame to CSV
export_csv = abstracts_df.to_csv(r'/Users/lorajohns/Documents/Python/DNA/DNA_articles.csv')
import requests
from bs4 import BeautifulSoup
import time
# We've now imported the two packages that will do the heavy lifting
# for us, reqeusts and BeautifulSoup
# This is the URL that lists the current inmates
# Should this URL go away, and archive is available at
# http://perma.cc/2HZR-N38X
### Keybase proof
I hereby claim:
* I am lorarjohns on github.
* I am silly_meninsky (https://keybase.io/silly_meninsky) on keybase.
* I have a public key ASCCgBmQNmz7ZdAfSYaYd_Cg3sTPjkSrNfC10jlMfUh3XAo
To claim this, I am signing this object:
@lorarjohns
lorarjohns / git-log-to-tikz.rb
Created October 10, 2019 02:56 — forked from cl4u2/git-log-to-tikz.rb
Extract git history to tikz picture - complete latex document and minimal graph
#!/usr/bin/env ruby
# A small ruby script to extract a git history to a tikz picture
# Author: Michael Hauspie <Michael.Hauspie@lifl.fr>
# Author: Lennart C. Karssen <lennart@karssen.org>
# Author: Claudio Pisa <claudio.pisa@uniroma2.it>
#
# Not clean code, not always working well, but does its job in most of
# the cases I needed :)
#
@lorarjohns
lorarjohns / newproj.sh
Last active December 2, 2019 04:08
create a new project directory with pyenv virtualenv
#!/bin/sh
# Usage: $ sh newproj.sh pythonversion projectname
mkdir $2 && cd $2 && pyenv local $1 && pyenv virtualenv venv-$2 && pyenv local venv-$2 && pyenv activate venv-$2

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

from textblob import Word
def get_synonym_defs(word):
word = Word(word)
defs = zip(word.synsets, word.definitions)
print(*defs)
return word.synsets
def print_ontological_comps(synset):
print(f"SUB-COMPONENTS OF {synset.__repr__()}:\n")