diff options
author | erik <erik@cressdna.lab.siobain.com> | 2017-08-09 14:16:39 -0400 |
---|---|---|
committer | erik <erik@cressdna.lab.siobain.com> | 2017-08-09 14:16:39 -0400 |
commit | 0548e33b5ffa479db8fa5ea52ae27a4401a8c5ba (patch) | |
tree | 421605c0fc107ec1997f397b865aede010bacc4f /cgi-bin | |
parent | 3e5406bbd3e05ac59c1cc954de7bf8187baf9a39 (diff) | |
download | cressdna-0548e33b5ffa479db8fa5ea52ae27a4401a8c5ba.tar.gz cressdna-0548e33b5ffa479db8fa5ea52ae27a4401a8c5ba.zip |
add new website files
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/SVM_linear_aa_clf.pkl | bin | 0 -> 187597 bytes | |||
-rw-r--r-- | cgi-bin/UniqRepsGemys_6089_StSCALER.pkl | bin | 0 -> 980 bytes | |||
-rwxr-xr-x | cgi-bin/classifier.py | 52 |
3 files changed, 52 insertions, 0 deletions
diff --git a/cgi-bin/SVM_linear_aa_clf.pkl b/cgi-bin/SVM_linear_aa_clf.pkl Binary files differnew file mode 100644 index 0000000..1afce0a --- /dev/null +++ b/cgi-bin/SVM_linear_aa_clf.pkl diff --git a/cgi-bin/UniqRepsGemys_6089_StSCALER.pkl b/cgi-bin/UniqRepsGemys_6089_StSCALER.pkl Binary files differnew file mode 100644 index 0000000..3a098bd --- /dev/null +++ b/cgi-bin/UniqRepsGemys_6089_StSCALER.pkl diff --git a/cgi-bin/classifier.py b/cgi-bin/classifier.py new file mode 100755 index 0000000..fee11b9 --- /dev/null +++ b/cgi-bin/classifier.py @@ -0,0 +1,52 @@ +#!/home/erik/bin/python3.6m + +#import packages to be used +from sklearn.svm import SVC +from sklearn.feature_extraction.text import CountVectorizer +from sklearn.preprocessing import StandardScaler +from sklearn.externals import joblib +import cgi, cgitb + +cgitb.enable() +form=cgi.FieldStorage() +if form.getvalue('fasta'): + alignment = form.getvalue('fasta') + alignment=[alignment] + name=form.getvalue('seqname') + size=len(alignment[0]) +else: + alignment = ["MPSKKSGPQPHKRWVFTLNNPSEEEKNKIRELPISLFDYFVCGEEGLEEGRTAHLQGFANFAKKQTFNKVKWYFGARCHIEKAKGTDQQNKEYCSKEGHILIECGAPRNQGKRSDLSTAYFDYQQSGPPGMVLLNCCPSCRSSLSEDYYFAILEDCWRTINGGTRRPI"] + name='demo' + size=len(alignment[0]) + +html = open("./var/www/html/CRESSresults.html") +page=html.read() + + +AAs=['a','c','d','e','f','g','h','i','k','l','m','n','p','q','r','s','t','v','w','y'] +clf=joblib.load("./cgi-bin/SVM_linear_aa_clf.pkl") +StSc=joblib.load("./cgi-bin/UniqRepsGemys_6089_StSCALER.pkl") +cv=CountVectorizer(analyzer='char',ngram_range=(1,1),vocabulary=AAs) + + +#initialize text data vectorizer + +dataVect=cv.transform(alignment) + +#Scale the data to the training set +X=StSc.transform(dataVect.astype("float64")) + +#make predictions for the original dataset +results=",".join([name,clf.predict(X)[0]]) +results=",".join([results,str(size)]) +#for i in results: + #print(i[0],"\t",i[1]) + +output = page.format(prediction=results) +"""f=open('test.html','w') +f.write(output) +f.close()""" +print (output) + + +quit()
\ No newline at end of file |