From 0a13a6387b7a9f70ae58fdcd7196b7c480be40bd Mon Sep 17 00:00:00 2001 From: elavington Date: Mon, 25 Sep 2017 11:43:53 -0400 Subject: Revised Folder contents and classifier code --- bin/classifier.py | 25 +++++++++++++------------ index.html | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/bin/classifier.py b/bin/classifier.py index 0ae13b5..044c6ca 100755 --- a/bin/classifier.py +++ b/bin/classifier.py @@ -13,7 +13,7 @@ import cgi, cgitb # | cgitb.enable() form=cgi.FieldStorage() -alignment = form.getvalue('fasta') +alignment = str(form.getvalue('fasta')) if alignment.startswith(">"): #naive check for FASTA format list=alignment.split(">") book={} @@ -51,8 +51,8 @@ else: AAs=['a','c','d','e','f','g','h','i','k','l','m','n','p','q','r','s','t','v','w','y'] #load the classifier and scaler -clf=joblib.load("./cgi-bin/SVM_linear_aa_clf.pkl") -StSc=joblib.load("./cgi-bin/UniqRepsGemys_6089_StSCALER.pkl") +clf=joblib.load("SVM_linear_aa_clf.pkl") +StSc=joblib.load("UniqRepsGemys_6089_StSCALER.pkl") cv=CountVectorizer(analyzer='char',ngram_range=(1,1),vocabulary=AAs) #initialize text data vectorizer @@ -69,12 +69,14 @@ predictions=clf.predict(X) # Build HTML table of results \ # \_______________________________________________________ # | -results="""""" -for k in len(seqList): - results+="""{0}{1}{2}""".format(nameList[k],lenList[k],predictions[k]) +results="""""" if "demo" in nameList: results+="""

There seems to have been an error.
If you are expecting more than one prediction or - do not see the name you entered please try the submission form again, making sure that the input is in FASTA format.""" + do not see the name you entered please try the submission form again, making sure that the input is in FASTA format.""" +else: + for k in len(seqList): + results+="""{0}{1}{2}""".format(nameList[k],lenList[k],predictions[k]) + #----------------------------------------------\ # Build output page \ @@ -82,13 +84,12 @@ if "demo" in nameList: # | #build output page parts #Header and CSS Style bits -header=""" - +header="""