def analysis(paths_dict, cov, ident, collapsed, absence, height, width): #statsA + statisticsA cov = int(cov.get()) ident = int(ident.get()) collapsed = int(collapsed.get()) absence = int(absence.get()) height =int(height.get()) width = int(width.get()) savepath = paths_dict[SAVEPATH] #openpath = paths_dict[OPENPATH] try: facade.analysis(savepath, cov, ident, collapsed, absence, sys.stderr) except Exception as e: _display(str(e)) sys.stderr.write(str(e)+"\n") tkMessageBox.showinfo("ORTHOPROK","analysis is done!!") # load the protein listbox with data df_protein = pd.read_csv(analyzer.get_file5(savepath)) protein_list= df_protein.ix[:,2::].columns.tolist() for item in protein_list: protein_listbox1.insert(END,item) novi = Toplevel() image = Image.open(analyzer.get_tmpfiles(savepath) +'graphic_stats.tif') photo = ImageTk.PhotoImage(image) #image not visual canvas = Canvas(novi, width = (width*100), height = (height*100), scrollregion = (0,0,(width*100),(height*100))) canvas.create_image(0, 0,image = photo, anchor="nw") canvas.photo = photo hbar=Scrollbar(novi,orient=HORIZONTAL) hbar.pack(side=BOTTOM,fill=X) hbar.config(command=canvas.xview) vbar=Scrollbar(novi,orient=VERTICAL) vbar.pack(side=RIGHT,fill=Y) vbar.config(command=canvas.yview) canvas.config(width=900,height=600) canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set) canvas.pack(side=LEFT,expand=True,fill=BOTH) canvas.pack(expand = YES, fill = BOTH) return
def get_all_text(self, post): """ Obtain all the text of a submission, including its comments. If a comment is passed, its parent submission will be determined. :param post: The comment of submission to obtain the thread's text from. :return: A cleaned up version of all the text within the thread, ready for further analysis. """ all_text = '' # Get the parent submission of a comment if isinstance(post, praw.objects.Comment): submission_id = post.link_id[3:] post = self.reddit.get_submission(submission_id=submission_id) submission_text = post.selftext submission_title = post.title ''.join((all_text, submission_title + '\n', submission_text + '\n')) comments = self.get_comments(post) for comment in comments: ''.join((all_text, comment.body + '\n')) clean_content = Analyzer.clean_up(all_text) return clean_content
def Blast (paths_dict, REDO): sys.stderr.write("Starting Blast command...\n") querypath = paths_dict[QUERYPATH] savepath = paths_dict[SAVEPATH] openpath = paths_dict[OPENPATH] utils.change_extension_fasta(openpath) utils.change_extension_fasta(querypath) queryDir = querypath+"/" subjectDir = openpath+"/" outputDir = analyzer.get_outputfolder(savepath) #creates output directory in project directory # newpath = savepath+"/output" # if not os.path.exists(newpath): # os.makedirs(newpath) if not os.path.exists(outputDir): os.makedirs(outputDir) facade.Blast(queryDir, subjectDir, outputDir, known_query_list, known_target_list, REDO , _display, sys.stderr) # CPC2018 tkMessageBox.showinfo("ORTHOPROK","Blast is finished!!") displayedText.set('Blast is done!!') sys.stderr.write("Finished Blast command\n") return
def is_recipe(self, content): """ Calls Analyzer method to check if a body of text has the qualities of a recipe. :param content: The body of text to analyze. """ return Analyzer.determine_if_recipe(content)
def check_post(self, post): """Checks a post for qualities of a recipe. :param post: The post to get the comments from. """ if isinstance(post, praw.objects.Submission): content = post.selftext url = post.permalink else: # Comment content = post.body submission_id = post.link_id[3:] parent_post = self.reddit.get_submission( submission_id=submission_id) url = parent_post.permalink + post.id clean_content = Analyzer.clean_up(content) if self.is_recipe(clean_content): print("Got a recipe!! Mama mia! " + str(datetime.now())) all_text = self.get_all_text(post) author = post.author.name karma = post.score date_posted = post.created post_id = post.id title = Analyzer.determine_title(post) ingredients = Analyzer.get_ingredients(content) instructions = Analyzer.get_instructions(content) recipe_type = Analyzer.determine_type(all_text) post_info = PostInfo(author, karma, date_posted, post_id, url) refined_post = RefinedPost(title, ingredients, instructions, recipe_type) recipe = Recipe(post_info, refined_post) self.recipe_handler.add(recipe)
def main(): analyzer = stat.Analyzer(len(sys.argv), sys.argv) analyzer.run()