def getCoverFeature(self): total = 0 nameParts = [] for w in self.words: count = sum([1 for b in self.getBeds(w)]) total+=count nameParts.append(w+"="+str(count)) b = bed.Feature(self.chrom, self.start, self.end, "_".join(nameParts), total, "+") return b
def getBeds(self, word): start = int(self.start) wordCount = len(self.words.get(word,[])) for p in self.words.get(word, []): if p == "": break #pos, strand = p.split("/") pos, strand = p pos = int(pos) yield(bed.Feature(self.chrom, start+pos, start+pos+len(word), word, wordCount, strand))
def getBedFeature(self): b = bed.Feature(seqid=self.chrom, start=self.start, end=self.end, score=self.score) return b