def write(motifs, format): """Return a string representation of motifs in the given format. Currently supported formats (case is ignored): - clusterbuster: Cluster Buster position frequency matrix format - pfm : JASPAR simple single Position Frequency Matrix - jaspar : JASPAR multiple PFM format - transfac : TRANSFAC like files """ format = format.lower() if format in ("pfm", "jaspar"): from Bio.motifs import jaspar return jaspar.write(motifs, format) elif format == "transfac": from Bio.motifs import transfac return transfac.write(motifs) elif format == "clusterbuster": from Bio.motifs import clusterbuster return clusterbuster.write(motifs) else: raise ValueError("Unknown format type %s" % format)
def __format__(self, format_spec): """Return a string representation of the Motif in the given format. Currently supported formats: - clusterbuster: Cluster Buster position frequency matrix format - pfm : JASPAR single Position Frequency Matrix - jaspar : JASPAR multiple Position Frequency Matrix - transfac : TRANSFAC like files """ if format_spec in ("pfm", "jaspar"): from Bio.motifs import jaspar motifs = [self] return jaspar.write(motifs, format_spec) elif format_spec == "transfac": from Bio.motifs import transfac motifs = [self] return transfac.write(motifs) elif format_spec == "clusterbuster": from Bio.motifs import clusterbuster motifs = [self] return clusterbuster.write(motifs) else: raise ValueError("Unknown format type %s" % format_spec)
def format(self, format): """Return a string representation of the Motif in the given format. Currently supported fromats: - clusterbuster: Cluster Buster position frequency matrix format - pfm : JASPAR single Position Frequency Matrix - jaspar : JASPAR multiple Position Frequency Matrix - transfac : TRANSFAC like files """ if format in ('pfm', 'jaspar'): from Bio.motifs import jaspar motifs = [self] return jaspar.write(motifs, format) elif format == "transfac": from Bio.motifs import transfac motifs = [self] return transfac.write(motifs) elif format == "clusterbuster": from Bio.motifs import clusterbuster motifs = [self] return clusterbuster.write(motifs) else: raise ValueError("Unknown format type %s" % format)