def getMotifGff(self): """Get a GFF with the best motifs for all sequences""" gff_dict = self.findMotifs() gff = [] for motif in gff_dict.values(): gff.extend(motif) bestfile = GffFile() bestfile.gff = gff gfffilename = self.tempFile("gff", bestfile.getFormattedGff()) return gfffilename
def findMotifs(self): """Fill a best-results dictionary and return it""" if len(self.seqs) == 0 and self.fastafilename is None: raise ValueError("Please add some sequences to find motifs in") if self.bgfilename is None: self.bgfilename = self.tempFile("bg", "") self.createBackground(self.fastafilename, self.bgfilename) if self.immfilename is None: self.sampleFiles() gffoutfilename = self.scanFiles(0.9999) gff = GffFile() gff.read(gffoutfilename, "") best_dict = gff.getAllMotifsAllGenes() return best_dict