This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Thing: | |
def speak(self) -> str: | |
raise NotImplementedError("Things don't inherently speak.") | |
class Rock(Thing): | |
def speak(self, msg): | |
return ValueError("Rocks cannot speak") | |
class Plant(Thing): | |
def speak(self) -> str: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyteomics import parser, mass | |
import matplotlib.pyplot as plt | |
# ============================ | |
# 1. Define protein sequence | |
# ============================ | |
protein_seq = "RELEELNVPGEIVESLSSSEESITRINKKIEKFQSEEQQQTEDELQDKIHPFAQTQSLVYPFPGPI" | |
# ============================ | |
# 2. In-silico trypsin digestion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import argparse | |
import os | |
def generate_vectors(num_slots, num_values, spacing, variance, diff_variance, diff_positions, diff_weight=1, aligned=True): | |
"""Generate two vectors with specified characteristics.""" | |
if spacing == "even": | |
positions = np.linspace(0, num_slots - 1, num_values, dtype=int) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load required libraries | |
library(cmapR) # For handling GCT files | |
library(ComplexHeatmap) # For visualization, see https://jokergoo.github.io/ComplexHeatmap-reference/book/ for a complete reference | |
library(RColorBrewer) # For color palettes | |
library(dplyr) | |
make_random_gct <- function(nrow = 100, ncol = 10) { | |
set.seed(369) | |
nrow <- max(nrow, 1) | |
ncol <- max(ncol, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
import hashlib | |
import time | |
import os | |
import pandas as pd | |
from datetime import datetime | |
class BaseCache: | |
"""Base class for caching strategies.""" | |
def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple script to separate MaxQuant experiments | |
""" | |
import os | |
import sys | |
import numpy as np | |
import pandas as pd | |
def main(f): | |
df = pd.read_table(f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def make_iterable(argn=0, exceptions=[]): | |
"""Check to make sure an argument is an iterator. | |
Default argument is args[0] | |
Add exceptions that you wish to enclose in an iterator by providing an | |
iterator of their type. | |
Ironically, exceptions must be encapsulated in an iterator""" | |
def decorate(func): | |
@wraps(func) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%http://tex.stackexchange.com/questions/77920/comment-package-excludecomment-gives-error | |
\documentclass[12pt]{article} | |
\usepackage{todonotes} % \missingfigure | |
\usepackage{comment} % to exclude whole sections when I want to | |
\newif\ifshow % toggle true or false based on if want to hide section | |
%\showtrue % show the sections | |
\showfalse % hide the sections | |
\ifshow |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#check if files in directory aren't in log of previously encountered log | |
from time import sleep | |
def filechecker(): | |
print '{} : Checking for new files...'.format(time.ctime()) | |
try : log = open('filelog.log','r+U') #open log file in append mode | |
except : log = open('filelog.log','ab+') # if it doesn't exist, create it | |
files = [line.strip('\n') for line in log.readlines()] # list of all files in log | |
for f in os.listdir(inputdir): # iterate through all files in directory |
NewerOlder