示例#1
0
	def funcpred_analysis(self):
		cursor = self.conn.cursor(MySQLdb.cursors.DictCursor)

		#kdrew: get domains from diff tables (eg. hddb_IEA_mygoLite_062005_062009)
		domains = NewAnnotatedDomains(self.conn, self.sequence_table, self.domain_table, self.evidence_codes)
		domains.load_domains()

		for domain in domains:

			#kdrew: if single domain flag is set and parent and domain sequence keys do not match, move to the next domain
			#kdrew: generally when parent sequence key and domain sequence key are not the same the protein is a single domain protein
			if self.single_domain and domain.get_parent_sequence_key() != domain.get_domain_sequence_key():
				continue

			print domain.get_parent_sequence_key(), domain.get_domain_sequence_key()

		#kdrew: get_old_annotations
			old_anns = Terms(ecode=self.evidence_codes)
			old_anns.load_terms(conn=self.old_mg.get_conn(), psk=domain.get_parent_sequence_key(), go_type=self.term_types, term_table=self.old_annotations_table)
			#print "old annotations: "
			#old_anns.print_terms()
		#kdrew: get_new_annotations
			new_anns = Terms(ecode=self.evidence_codes)
			new_anns.load_terms(self.new_mg.get_conn(), domain.get_parent_sequence_key(), self.term_types, term_table=self.new_annotations_table)
			#print "new annotations: "
			#new_anns.print_terms()
		#kdrew: get_predictions
			preds = Predictions(conn=self.pred_conn, table=self.prediction_table)
			preds.load_predictions(domain.get_parent_sequence_key(), domain.get_domain_sequence_key())

		#kdrew: predictions_trim = predictions - old_annotations
			predictions_trim = Predictions()
			#kdrew: produces a list of every prediction that is not in the old annotations
			predictions_trim.extend(list((x) for x in preds if x.function not in old_anns))
			#print "predictions_trim: ", predictions_trim.filter(pls_llr=0, base_llr=-2)

		#kdrew: new_annotations_trim = new_annotations - old_annotations
			#kdrew: produces a list of only the new annotations that are truely new, not been seen before
			new_annotations_trim = list(set(new_anns) - set(old_anns))
			#print "new annotations trim: ", new_annotations_trim

		#kdrew: predictions_trim & new_annotations_trim
			new_ann_trim_tmp = list((x) for x in new_annotations_trim if predictions_trim.getByAcc(x.acc))
			#print "new_ann_trim_tmp: ", new_ann_trim_tmp
			prediction_new_annotation_intersection = Predictions()
			prediction_new_annotation_intersection.extend(list((x) for x in predictions_trim if x.function in new_annotations_trim))

			if len(prediction_new_annotation_intersection) > 0:
				print "pred & new: " , prediction_new_annotation_intersection.filter(pls_llr=self.pls_min, base_llr=self.base_max)