This file contains 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 kmer(sequence,k): | |
length=len(sequence) | |
#if the kmer size if greater than the lenght of the sequene | |
if k>=length: | |
print "You specified a kmer size, which if greater or equal to the length of the sequence" | |
return | |
stepsize=k-1 | |
i=0 | |
kmers=[] |
This file contains 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 kmer(sequence,k): | |
length=len(sequence) | |
#if the kmer size if greater than the lenght of the sequene | |
if k>=length: | |
print "You specified a kmer size, which if greater or equal to the length of the sequence" | |
return | |
stepsize=k-1 | |
i=0 | |
kmers=[] |
This file contains 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 -*- | |
#make a tree of all the possible kmers in a given alphabet | |
#this method creates a subtree given an alphabet and a parentnode | |
def maketree(alphabet,parentnode): | |
for letter in alphabet: | |
parentnode.append([letter]) | |
return parentnode | |
print "======================TESTING METHOD: MAKETREE===================" |
This file contains 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 itertools import product | |
for roll in product(['A','C','T','G'], repeat = 6): | |
print(roll) | |
allkmers=[] | |
kmers=product(['A','C','T','G'],repeat=6) |
This file contains 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 modshogun import StringCharFeatures,DNA | |
from modshogun import StringWordFeatures | |
#training set | |
train_dna=['ACGTGT', | |
'ACGGTT', | |
'AGTGTT', | |
'ACCGGT', | |
'TGTGTA', | |
'TTGGGT'] |
This file contains 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
try: | |
from shogun.PreProc import SortWordString, SortUlongString | |
except ImportError: | |
from shogun.Preprocessor import SortWordString, SortUlongString | |
from shogun.Kernel import CommWordStringKernel, CommUlongStringKernel, \ | |
CombinedKernel | |
from shogun.Features import StringWordFeatures, StringUlongFeatures, \ | |
StringCharFeatures, CombinedFeatures, DNA, Labels | |
from shogun.Classifier import MSG_INFO, MSG_ERROR |
This file contains 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
"""Demonstrates how to construct and send raw Ethernet packets on the | |
network. | |
You probably need root privs to be able to bind to the network interface, | |
e.g.: | |
$ sudo python sendeth.py | |
""" | |
from socket import * |
This file contains 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 RxPy example | |
""" | |
from rx import Observer, Observable | |
from numpy import random | |
class DataAnalyser(Observer): | |
#a class for analyzing data | |
def on_next(self, value): |