def run_single(self, debug=0): warnings.simplefilter('always') warnings.warn("Deprecated method: run_BLAST.run_single\nBLAST single sequence, slow!! ", DeprecationWarning) print("Running AmiGO:BLAST") temp_output = open(self.outfile + "_temp", "w") if self.record_index == None: self.record_index = SeqIO.index(self.infile, "fasta") all_orfs = dict() for key in self.record_index: print key this_seq = GoSequence(key, self.record_index[key].seq) # Bio.SeqRecord.SeqRecord this_seq.blast_AmiGO() this_seq.extract_ID() this_seq.parse_go_term(self.e_threshold) # seq.combined_terms self.results[key] = this_seq all_orfs[key] = this_seq.combined_terms # print this_seq # print this_seq.combined_terms temp_output.write("%s \t %s\n" % (key, this_seq.combined_terms)) # temp_output.flush() # temp_output.close() self.counter = self.create_counter(all_orfs) # new_outfile = self.init_output(self.counter,0) # self.sample = self.update_sample_from_counters(new_outfile, self.counter) # hasattr output_csv(self.outfile, self.header, self.counter)
def test_GoConnector_long(self): data = self.record_index["lcl|AE014075.1_gene_3"].seq # # good seq = GoSequence("G3", None) seq.blast_AmiGO(data) seq.extract_ID() seq.parse_go_term(self.e_threshold) expected = set(['GO:0071470', 'GO:0016310', 'GO:0005886', 'GO:0009067', 'GO:0000023', 'GO:0016597', 'GO:0043085', 'GO:0016491', 'GO:0005737', 'GO:0050661', 'GO:0040007', 'GO:0005618', 'GO:0009570', 'GO:0005634', 'GO:0006520', 'GO:0019877', 'GO:0000166', 'GO:0016740', 'GO:0009097', 'GO:0009090', 'GO:0019252', 'GO:0019761', 'GO:0016301', 'GO:0008152', 'GO:0009088', 'GO:0055114', 'GO:0009507', 'GO:0008652', 'GO:0005829', 'GO:0006555', 'GO:0004412', 'GO:0005575', 'GO:0009089', 'GO:0005524', 'GO:0006164', 'GO:0006531', 'GO:0009086', 'GO:0004072', 'GO:0009082']) self.assertEqual(expected, seq.combined_terms)
def test_GoConnector_short(self): data = self.record_index["lcl|AE014075.1_gene_2"].seq # # good seq = GoSequence("G2", None) seq.blast_AmiGO(data) seq.extract_ID() seq.parse_go_term(self.e_threshold) expected = set(['GO:0004803', 'GO:0006313']) self.assertEqual(expected, seq.combined_terms)