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 itertools | |
def all_perm(word): | |
# prints all permutation to a given word | |
for p in list(itertools.permutations(word)): | |
print ''.join(p) | |
all_perm("abcde") |
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
# -*- coding: UTF-8 -*- | |
def upside_down(inp): | |
#print upside-down of a given alphabetic string | |
rev_dict = {'z': u'z', 'y': u'ʎ', 'x': u'x', | |
'w': u'ʍ', 'v': u'ʌ', 'u': u'n', | |
't': u'ʇ', 's': u's', 'r': u'ɹ', | |
'q': u'b', 'p': u'd', 'o': u'o', | |
'n': u'u', 'm': u'ɯ', 'l': u'\u0285', | |
'k': u'ʞ', 'j': u'ɾ', 'i': u'ᴉ', |
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 glob | |
import os, time | |
time_and_file=dict() | |
folder_name=raw_input() | |
ct=1 | |
#assuming folder at the same directory as script | |
for filename in glob.glob(folder_name+"/*.*"): | |
name=filename.split('.')[0] | |
try: |
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
#___________myproject/settings.py__________ | |
INSTALLED_APPS = [ | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'anotherapp', | |
'activitystream' |
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
{"test_name":"TCHO","level_1_lower_range":10,"level_1_upper_range":20,"level_2_lower_range":20,"level_2_upper_range":30,"level_3_lower_range":30,"level_3_upper_range":40} |
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
library(Peptides) | |
library(seqinr) | |
get_comp <- function(fasta){ | |
s=getSequence(fasta, as.string = TRUE); | |
sname=getName(fasta); | |
comp = aaComp(s); | |
r<-c(name=sname, |
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
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
for epoch in range(n_epochs): | |
epoch_loss = 0 | |
i=0 | |
while i < len(train_x): | |
start = i | |
end = i+batch_size | |
batch_x = np.array(train_x[start:end]) |
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
def get_train_data_batch(n): | |
features = [] | |
with open('data.csv') as f: | |
count=0 | |
for line in f: | |
splitted = line.split(';') | |
featureset = [int(float(x)) for x in splitted[:len(splitted)-1]] | |
label = int(float(splitted[-1].rstrip())) | |
count+=1 | |
if count % n==0: |
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
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
for epoch in range(n_epochs): | |
train_data_batch_gen = get_train_data_batch(batch_size) | |
epoch_loss = 0 | |
i=0 | |
while i < total_lines: | |
train_x, train_y = next(train_data_batch_gen) | |
batch_x = np.array(train_x) |
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
findcommunities <- function(mygraph,minsize) | |
{ | |
# Function to find network communities in a graph | |
# Load up the igraph library: | |
require("igraph") | |
# Set the counter for the number of communities: | |
cnt <- 0 | |
# First find the connected components in the graph: | |
myconnectedcomponents <- connectedComp(mygraph) | |
# For each connected component, find the communities within that connected component: |
OlderNewer