def parse(hmmin): self.scores = hmmer.parse_scores(hmmin)
prev = hits[0] prev_name,_ = prev buf = [] maxScores = [] for hit in hits: name,score = hit if name==prev_name: buf.append(score) else: maxScores.append(max(buf)) buf = [score] prev_name = name return maxScores folder = "/Users/mortonyt/Documents/MiamiBio/workspace" toxin_scores = hmmer.parse_scores("%s/boa_scores.out"%folder) #modifier_scores = hmmer.parse_scores("%s/modifier.out"%folder) #immunity_scores = hmmer.parse_scores("%s/immunity.out"%folder) #regulator_scores = hmmer.parse_scores("%s/regulator.out"%folder) #transport_scores = hmmer.parse_scores("%s/transport.out"%folder) bagel_scores = hmmer.parse_scores("%s/bagel_toxin.out"%folder) #all_scores = numpy.array(toxin_scores+modifier_scores+immunity_scores+regulator_scores+transport_scores) all_scores = toxin_scores print all_scores[:10] print "Number of all scores",len(all_scores) print "Number of bagel scores",len(bagel_scores) gmm = GaussianMixtureModel(all_scores) #params = gmm.expectation_maximization(1000) g = mixture.GMM(n_components=2) model = g.fit(all_scores) x = numpy.linspace(min(all_scores),max(all_scores),1000)