Skip to content

Instantly share code, notes, and snippets.

@Winterflower
Created July 15, 2014 12:34
Show Gist options
  • Save Winterflower/efa78416b03633ffcda5 to your computer and use it in GitHub Desktop.
Save Winterflower/efa78416b03633ffcda5 to your computer and use it in GitHub Desktop.
Understanding the kmersvm
from modshogun import StringCharFeatures,DNA
from modshogun import StringWordFeatures
#training set
train_dna=['ACGTGT',
'ACGGTT',
'AGTGTT',
'ACCGGT',
'TGTGTA',
'TTGGGT']
train_features=StringCharFeatures(train_dna, DNA)
#desired kmerlength
kmerlen=6
word_features=StringWordFeatures(DNA)
word_features.obtain_from_char(train_features,kmerlen-1,kmerlen,0,False)
@prabhuprachiti
Copy link

From the shogun toolbox documentation:

void obtain_from_char ( char * str, uint64_t len)

convert string of length len into bit sequence
Parameters:
str string
len length of string in bits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment