partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | keras_tuples | Reformat data objects as keras-compatible tuples.
For more detail: https://keras.io/models/model/#fit
Parameters
----------
stream : iterable
Stream of data objects.
inputs : string or iterable of strings, None
Keys to use for ordered input data.
If not specified, returns ... | pescador/maps.py | def keras_tuples(stream, inputs=None, outputs=None):
"""Reformat data objects as keras-compatible tuples.
For more detail: https://keras.io/models/model/#fit
Parameters
----------
stream : iterable
Stream of data objects.
inputs : string or iterable of strings, None
Keys to us... | def keras_tuples(stream, inputs=None, outputs=None):
"""Reformat data objects as keras-compatible tuples.
For more detail: https://keras.io/models/model/#fit
Parameters
----------
stream : iterable
Stream of data objects.
inputs : string or iterable of strings, None
Keys to us... | [
"Reformat",
"data",
"objects",
"as",
"keras",
"-",
"compatible",
"tuples",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/maps.py#L120-L179 | [
"def",
"keras_tuples",
"(",
"stream",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
")",
":",
"flatten_inputs",
",",
"flatten_outputs",
"=",
"False",
",",
"False",
"if",
"inputs",
"and",
"isinstance",
"(",
"inputs",
",",
"six",
".",
"string_type... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | location | Creates histrogram of motif location.
Parameters
----------
args : argparse object
Command line arguments. | gimmemotifs/commands/location.py | def location(args):
"""
Creates histrogram of motif location.
Parameters
----------
args : argparse object
Command line arguments.
"""
fastafile = args.fastafile
pwmfile = args.pwmfile
lwidth = args.width
if not lwidth:
f = Fasta(fastafile)
lwidth = len(... | def location(args):
"""
Creates histrogram of motif location.
Parameters
----------
args : argparse object
Command line arguments.
"""
fastafile = args.fastafile
pwmfile = args.pwmfile
lwidth = args.width
if not lwidth:
f = Fasta(fastafile)
lwidth = len(... | [
"Creates",
"histrogram",
"of",
"motif",
"location",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/commands/location.py#L18-L54 | [
"def",
"location",
"(",
"args",
")",
":",
"fastafile",
"=",
"args",
".",
"fastafile",
"pwmfile",
"=",
"args",
".",
"pwmfile",
"lwidth",
"=",
"args",
".",
"width",
"if",
"not",
"lwidth",
":",
"f",
"=",
"Fasta",
"(",
"fastafile",
")",
"lwidth",
"=",
"l... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | which | Find location of executable. | gimmemotifs/shutils.py | def which(fname):
"""Find location of executable."""
if "PATH" not in os.environ or not os.environ["PATH"]:
path = os.defpath
else:
path = os.environ["PATH"]
for p in [fname] + [os.path.join(x, fname) for x in path.split(os.pathsep)]:
p = os.path.abspath(p)
if os.access(... | def which(fname):
"""Find location of executable."""
if "PATH" not in os.environ or not os.environ["PATH"]:
path = os.defpath
else:
path = os.environ["PATH"]
for p in [fname] + [os.path.join(x, fname) for x in path.split(os.pathsep)]:
p = os.path.abspath(p)
if os.access(... | [
"Find",
"location",
"of",
"executable",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/shutils.py#L11-L30 | [
"def",
"which",
"(",
"fname",
")",
":",
"if",
"\"PATH\"",
"not",
"in",
"os",
".",
"environ",
"or",
"not",
"os",
".",
"environ",
"[",
"\"PATH\"",
"]",
":",
"path",
"=",
"os",
".",
"defpath",
"else",
":",
"path",
"=",
"os",
".",
"environ",
"[",
"\"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | find_by_ext | Find all files in a directory by extension. | gimmemotifs/shutils.py | def find_by_ext(dirname, ext):
"""Find all files in a directory by extension."""
# Get all fasta-files
try:
files = os.listdir(dirname)
except OSError:
if os.path.exists(dirname):
cmd = "find {0} -maxdepth 1 -name \"*\"".format(dirname)
p = sp.Popen(cmd, shel... | def find_by_ext(dirname, ext):
"""Find all files in a directory by extension."""
# Get all fasta-files
try:
files = os.listdir(dirname)
except OSError:
if os.path.exists(dirname):
cmd = "find {0} -maxdepth 1 -name \"*\"".format(dirname)
p = sp.Popen(cmd, shel... | [
"Find",
"all",
"files",
"in",
"a",
"directory",
"by",
"extension",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/shutils.py#L32-L49 | [
"def",
"find_by_ext",
"(",
"dirname",
",",
"ext",
")",
":",
"# Get all fasta-files",
"try",
":",
"files",
"=",
"os",
".",
"listdir",
"(",
"dirname",
")",
"except",
"OSError",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"dirname",
")",
":",
"cmd",... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | default_motifs | Return list of Motif instances from default motif database. | gimmemotifs/motif.py | def default_motifs():
"""Return list of Motif instances from default motif database."""
config = MotifConfig()
d = config.get_motif_dir()
m = config.get_default_params()['motif_db']
if not d or not m:
raise ValueError("default motif database not configured")
fname = os.path.join(d, m)
... | def default_motifs():
"""Return list of Motif instances from default motif database."""
config = MotifConfig()
d = config.get_motif_dir()
m = config.get_default_params()['motif_db']
if not d or not m:
raise ValueError("default motif database not configured")
fname = os.path.join(d, m)
... | [
"Return",
"list",
"of",
"Motif",
"instances",
"from",
"default",
"motif",
"database",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1079-L1092 | [
"def",
"default_motifs",
"(",
")",
":",
"config",
"=",
"MotifConfig",
"(",
")",
"d",
"=",
"config",
".",
"get_motif_dir",
"(",
")",
"m",
"=",
"config",
".",
"get_default_params",
"(",
")",
"[",
"'motif_db'",
"]",
"if",
"not",
"d",
"or",
"not",
"m",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | motif_from_align | Convert alignment to motif.
Converts a list with sequences to a motif. Sequences should be the same
length.
Parameters
----------
align : list
List with sequences (A,C,G,T).
Returns
-------
m : Motif instance
Motif created from the aligned sequences. | gimmemotifs/motif.py | def motif_from_align(align):
"""Convert alignment to motif.
Converts a list with sequences to a motif. Sequences should be the same
length.
Parameters
----------
align : list
List with sequences (A,C,G,T).
Returns
-------
m : Motif instance
Motif created from ... | def motif_from_align(align):
"""Convert alignment to motif.
Converts a list with sequences to a motif. Sequences should be the same
length.
Parameters
----------
align : list
List with sequences (A,C,G,T).
Returns
-------
m : Motif instance
Motif created from ... | [
"Convert",
"alignment",
"to",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1094-L1118 | [
"def",
"motif_from_align",
"(",
"align",
")",
":",
"width",
"=",
"len",
"(",
"align",
"[",
"0",
"]",
")",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"pfm",
"=",
"[",
"[",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | motif_from_consensus | Convert consensus sequence to motif.
Converts a consensus sequences using the nucleotide IUPAC alphabet to a
motif.
Parameters
----------
cons : str
Consensus sequence using the IUPAC alphabet.
n : int , optional
Count used to convert the sequence to a PFM.
Returns
... | gimmemotifs/motif.py | def motif_from_consensus(cons, n=12):
"""Convert consensus sequence to motif.
Converts a consensus sequences using the nucleotide IUPAC alphabet to a
motif.
Parameters
----------
cons : str
Consensus sequence using the IUPAC alphabet.
n : int , optional
Count used to conv... | def motif_from_consensus(cons, n=12):
"""Convert consensus sequence to motif.
Converts a consensus sequences using the nucleotide IUPAC alphabet to a
motif.
Parameters
----------
cons : str
Consensus sequence using the IUPAC alphabet.
n : int , optional
Count used to conv... | [
"Convert",
"consensus",
"sequence",
"to",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1120-L1147 | [
"def",
"motif_from_consensus",
"(",
"cons",
",",
"n",
"=",
"12",
")",
":",
"width",
"=",
"len",
"(",
"cons",
")",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"pfm",
"=",
"[... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | parse_motifs | Parse motifs in a variety of formats to return a list of motifs.
Parameters
----------
motifs : list or str
Filename of motif, list of motifs or single Motif instance.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/motif.py | def parse_motifs(motifs):
"""Parse motifs in a variety of formats to return a list of motifs.
Parameters
----------
motifs : list or str
Filename of motif, list of motifs or single Motif instance.
Returns
-------
motifs : list
List of Motif instances.
"""
if isin... | def parse_motifs(motifs):
"""Parse motifs in a variety of formats to return a list of motifs.
Parameters
----------
motifs : list or str
Filename of motif, list of motifs or single Motif instance.
Returns
-------
motifs : list
List of Motif instances.
"""
if isin... | [
"Parse",
"motifs",
"in",
"a",
"variety",
"of",
"formats",
"to",
"return",
"a",
"list",
"of",
"motifs",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1149-L1178 | [
"def",
"parse_motifs",
"(",
"motifs",
")",
":",
"if",
"isinstance",
"(",
"motifs",
",",
"six",
".",
"string_types",
")",
":",
"with",
"open",
"(",
"motifs",
")",
"as",
"f",
":",
"if",
"motifs",
".",
"endswith",
"(",
"\"pwm\"",
")",
"or",
"motifs",
".... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | _read_motifs_from_filehandle | Read motifs from a file-like object.
Parameters
----------
handle : file-like object
Motifs.
fmt : string, optional
Motif format, can be 'pwm', 'transfac', 'xxmotif', 'jaspar' or 'align'.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/motif.py | def _read_motifs_from_filehandle(handle, fmt):
"""
Read motifs from a file-like object.
Parameters
----------
handle : file-like object
Motifs.
fmt : string, optional
Motif format, can be 'pwm', 'transfac', 'xxmotif', 'jaspar' or 'align'.
Returns
-------
motifs... | def _read_motifs_from_filehandle(handle, fmt):
"""
Read motifs from a file-like object.
Parameters
----------
handle : file-like object
Motifs.
fmt : string, optional
Motif format, can be 'pwm', 'transfac', 'xxmotif', 'jaspar' or 'align'.
Returns
-------
motifs... | [
"Read",
"motifs",
"from",
"a",
"file",
"-",
"like",
"object",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1180-L1233 | [
"def",
"_read_motifs_from_filehandle",
"(",
"handle",
",",
"fmt",
")",
":",
"if",
"fmt",
".",
"lower",
"(",
")",
"==",
"\"pwm\"",
":",
"motifs",
"=",
"_read_motifs_pwm",
"(",
"handle",
")",
"if",
"fmt",
".",
"lower",
"(",
")",
"==",
"\"transfac\"",
":",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | read_motifs | Read motifs from a file or stream or file-like object.
Parameters
----------
infile : string or file-like object, optional
Motif database, filename of motif file or file-like object. If infile
is not specified the default motifs as specified in the config file
will be returned.
... | gimmemotifs/motif.py | def read_motifs(infile=None, fmt="pwm", as_dict=False):
"""
Read motifs from a file or stream or file-like object.
Parameters
----------
infile : string or file-like object, optional
Motif database, filename of motif file or file-like object. If infile
is not specified the default... | def read_motifs(infile=None, fmt="pwm", as_dict=False):
"""
Read motifs from a file or stream or file-like object.
Parameters
----------
infile : string or file-like object, optional
Motif database, filename of motif file or file-like object. If infile
is not specified the default... | [
"Read",
"motifs",
"from",
"a",
"file",
"or",
"stream",
"or",
"file",
"-",
"like",
"object",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1236-L1269 | [
"def",
"read_motifs",
"(",
"infile",
"=",
"None",
",",
"fmt",
"=",
"\"pwm\"",
",",
"as_dict",
"=",
"False",
")",
":",
"if",
"infile",
"is",
"None",
"or",
"isinstance",
"(",
"infile",
",",
"six",
".",
"string_types",
")",
":",
"infile",
"=",
"pwmfile_lo... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.information_content | Return the total information content of the motif.
Return
------
ic : float
Motif information content. | gimmemotifs/motif.py | def information_content(self):
"""Return the total information content of the motif.
Return
------
ic : float
Motif information content.
"""
ic = 0
for row in self.pwm:
ic += 2.0 + np.sum([row[x] * log(row[x])/log(2) for x in range(4) if r... | def information_content(self):
"""Return the total information content of the motif.
Return
------
ic : float
Motif information content.
"""
ic = 0
for row in self.pwm:
ic += 2.0 + np.sum([row[x] * log(row[x])/log(2) for x in range(4) if r... | [
"Return",
"the",
"total",
"information",
"content",
"of",
"the",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L167-L178 | [
"def",
"information_content",
"(",
"self",
")",
":",
"ic",
"=",
"0",
"for",
"row",
"in",
"self",
".",
"pwm",
":",
"ic",
"+=",
"2.0",
"+",
"np",
".",
"sum",
"(",
"[",
"row",
"[",
"x",
"]",
"*",
"log",
"(",
"row",
"[",
"x",
"]",
")",
"/",
"lo... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pwm_min_score | Return the minimum PWM score.
Returns
-------
score : float
Minimum PWM score. | gimmemotifs/motif.py | def pwm_min_score(self):
"""Return the minimum PWM score.
Returns
-------
score : float
Minimum PWM score.
"""
if self.min_score is None:
score = 0
for row in self.pwm:
score += log(min(row) / 0.25 + 0.01)
s... | def pwm_min_score(self):
"""Return the minimum PWM score.
Returns
-------
score : float
Minimum PWM score.
"""
if self.min_score is None:
score = 0
for row in self.pwm:
score += log(min(row) / 0.25 + 0.01)
s... | [
"Return",
"the",
"minimum",
"PWM",
"score",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L180-L194 | [
"def",
"pwm_min_score",
"(",
"self",
")",
":",
"if",
"self",
".",
"min_score",
"is",
"None",
":",
"score",
"=",
"0",
"for",
"row",
"in",
"self",
".",
"pwm",
":",
"score",
"+=",
"log",
"(",
"min",
"(",
"row",
")",
"/",
"0.25",
"+",
"0.01",
")",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pwm_max_score | Return the maximum PWM score.
Returns
-------
score : float
Maximum PWM score. | gimmemotifs/motif.py | def pwm_max_score(self):
"""Return the maximum PWM score.
Returns
-------
score : float
Maximum PWM score.
"""
if self.max_score is None:
score = 0
for row in self.pwm:
score += log(max(row) / 0.25 + 0.01)
s... | def pwm_max_score(self):
"""Return the maximum PWM score.
Returns
-------
score : float
Maximum PWM score.
"""
if self.max_score is None:
score = 0
for row in self.pwm:
score += log(max(row) / 0.25 + 0.01)
s... | [
"Return",
"the",
"maximum",
"PWM",
"score",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L196-L210 | [
"def",
"pwm_max_score",
"(",
"self",
")",
":",
"if",
"self",
".",
"max_score",
"is",
"None",
":",
"score",
"=",
"0",
"for",
"row",
"in",
"self",
".",
"pwm",
":",
"score",
"+=",
"log",
"(",
"max",
"(",
"row",
")",
"/",
"0.25",
"+",
"0.01",
")",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.score_kmer | Calculate the log-odds score for a specific k-mer.
Parameters
----------
kmer : str
String representing a kmer. Should be the same length as the motif.
Returns
-------
score : float
Log-odd score. | gimmemotifs/motif.py | def score_kmer(self, kmer):
"""Calculate the log-odds score for a specific k-mer.
Parameters
----------
kmer : str
String representing a kmer. Should be the same length as the motif.
Returns
-------
score : float
Log-odd score.
... | def score_kmer(self, kmer):
"""Calculate the log-odds score for a specific k-mer.
Parameters
----------
kmer : str
String representing a kmer. Should be the same length as the motif.
Returns
-------
score : float
Log-odd score.
... | [
"Calculate",
"the",
"log",
"-",
"odds",
"score",
"for",
"a",
"specific",
"k",
"-",
"mer",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L212-L233 | [
"def",
"score_kmer",
"(",
"self",
",",
"kmer",
")",
":",
"if",
"len",
"(",
"kmer",
")",
"!=",
"len",
"(",
"self",
".",
"pwm",
")",
":",
"raise",
"Exception",
"(",
"\"incorrect k-mer length\"",
")",
"score",
"=",
"0.0",
"d",
"=",
"{",
"\"A\"",
":",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pfm_to_pwm | Convert PFM with counts to a PFM with fractions.
Parameters
----------
pfm : list
2-dimensional list with counts.
pseudo : float
Pseudocount used in conversion.
Returns
-------
pwm : list
2-dimensional list with fracti... | gimmemotifs/motif.py | def pfm_to_pwm(self, pfm, pseudo=0.001):
"""Convert PFM with counts to a PFM with fractions.
Parameters
----------
pfm : list
2-dimensional list with counts.
pseudo : float
Pseudocount used in conversion.
Returns
-------
p... | def pfm_to_pwm(self, pfm, pseudo=0.001):
"""Convert PFM with counts to a PFM with fractions.
Parameters
----------
pfm : list
2-dimensional list with counts.
pseudo : float
Pseudocount used in conversion.
Returns
-------
p... | [
"Convert",
"PFM",
"with",
"counts",
"to",
"a",
"PFM",
"with",
"fractions",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L235-L250 | [
"def",
"pfm_to_pwm",
"(",
"self",
",",
"pfm",
",",
"pseudo",
"=",
"0.001",
")",
":",
"return",
"[",
"[",
"(",
"x",
"+",
"pseudo",
")",
"/",
"(",
"float",
"(",
"np",
".",
"sum",
"(",
"row",
")",
")",
"+",
"pseudo",
"*",
"4",
")",
"for",
"x",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.to_motevo | Return motif formatted in MotEvo (TRANSFAC-like) format
Returns
-------
m : str
String of motif in MotEvo format. | gimmemotifs/motif.py | def to_motevo(self):
"""Return motif formatted in MotEvo (TRANSFAC-like) format
Returns
-------
m : str
String of motif in MotEvo format.
"""
m = "//\n"
m += "NA {}\n".format(self.id)
m += "P0\tA\tC\tG\tT\n"
for i, row in enume... | def to_motevo(self):
"""Return motif formatted in MotEvo (TRANSFAC-like) format
Returns
-------
m : str
String of motif in MotEvo format.
"""
m = "//\n"
m += "NA {}\n".format(self.id)
m += "P0\tA\tC\tG\tT\n"
for i, row in enume... | [
"Return",
"motif",
"formatted",
"in",
"MotEvo",
"(",
"TRANSFAC",
"-",
"like",
")",
"format",
"Returns",
"-------",
"m",
":",
"str",
"String",
"of",
"motif",
"in",
"MotEvo",
"format",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L252-L266 | [
"def",
"to_motevo",
"(",
"self",
")",
":",
"m",
"=",
"\"//\\n\"",
"m",
"+=",
"\"NA {}\\n\"",
".",
"format",
"(",
"self",
".",
"id",
")",
"m",
"+=",
"\"P0\\tA\\tC\\tG\\tT\\n\"",
"for",
"i",
",",
"row",
"in",
"enumerate",
"(",
"self",
".",
"pfm",
")",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.to_transfac | Return motif formatted in TRANSFAC format
Returns
-------
m : str
String of motif in TRANSFAC format. | gimmemotifs/motif.py | def to_transfac(self):
"""Return motif formatted in TRANSFAC format
Returns
-------
m : str
String of motif in TRANSFAC format.
"""
m = "%s\t%s\t%s\n" % ("DE", self.id, "unknown")
for i, (row, cons) in enumerate(zip(self.pfm, self.to_consensus... | def to_transfac(self):
"""Return motif formatted in TRANSFAC format
Returns
-------
m : str
String of motif in TRANSFAC format.
"""
m = "%s\t%s\t%s\n" % ("DE", self.id, "unknown")
for i, (row, cons) in enumerate(zip(self.pfm, self.to_consensus... | [
"Return",
"motif",
"formatted",
"in",
"TRANSFAC",
"format",
"Returns",
"-------",
"m",
":",
"str",
"String",
"of",
"motif",
"in",
"TRANSFAC",
"format",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L268-L280 | [
"def",
"to_transfac",
"(",
"self",
")",
":",
"m",
"=",
"\"%s\\t%s\\t%s\\n\"",
"%",
"(",
"\"DE\"",
",",
"self",
".",
"id",
",",
"\"unknown\"",
")",
"for",
"i",
",",
"(",
"row",
",",
"cons",
")",
"in",
"enumerate",
"(",
"zip",
"(",
"self",
".",
"pfm"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.to_meme | Return motif formatted in MEME format
Returns
-------
m : str
String of motif in MEME format. | gimmemotifs/motif.py | def to_meme(self):
"""Return motif formatted in MEME format
Returns
-------
m : str
String of motif in MEME format.
"""
motif_id = self.id.replace(" ", "_")
m = "MOTIF %s\n" % motif_id
m += "BL MOTIF %s width=0 seqs=0\n"% motif_id
... | def to_meme(self):
"""Return motif formatted in MEME format
Returns
-------
m : str
String of motif in MEME format.
"""
motif_id = self.id.replace(" ", "_")
m = "MOTIF %s\n" % motif_id
m += "BL MOTIF %s width=0 seqs=0\n"% motif_id
... | [
"Return",
"motif",
"formatted",
"in",
"MEME",
"format",
"Returns",
"-------",
"m",
":",
"str",
"String",
"of",
"motif",
"in",
"MEME",
"format",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L282-L295 | [
"def",
"to_meme",
"(",
"self",
")",
":",
"motif_id",
"=",
"self",
".",
"id",
".",
"replace",
"(",
"\" \"",
",",
"\"_\"",
")",
"m",
"=",
"\"MOTIF %s\\n\"",
"%",
"motif_id",
"m",
"+=",
"\"BL MOTIF %s width=0 seqs=0\\n\"",
"%",
"motif_id",
"m",
"+=",
"\"let... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.ic_pos | Calculate the information content of one position.
Returns
-------
score : float
Information content. | gimmemotifs/motif.py | def ic_pos(self, row1, row2=None):
"""Calculate the information content of one position.
Returns
-------
score : float
Information content.
"""
if row2 is None:
row2 = [0.25,0.25,0.25,0.25]
score = 0
for a,b in zip(row1, row2):
... | def ic_pos(self, row1, row2=None):
"""Calculate the information content of one position.
Returns
-------
score : float
Information content.
"""
if row2 is None:
row2 = [0.25,0.25,0.25,0.25]
score = 0
for a,b in zip(row1, row2):
... | [
"Calculate",
"the",
"information",
"content",
"of",
"one",
"position",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L297-L312 | [
"def",
"ic_pos",
"(",
"self",
",",
"row1",
",",
"row2",
"=",
"None",
")",
":",
"if",
"row2",
"is",
"None",
":",
"row2",
"=",
"[",
"0.25",
",",
"0.25",
",",
"0.25",
",",
"0.25",
"]",
"score",
"=",
"0",
"for",
"a",
",",
"b",
"in",
"zip",
"(",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pcc_pos | Calculate the Pearson correlation coefficient of one position
compared to another position.
Returns
-------
score : float
Pearson correlation coefficient. | gimmemotifs/motif.py | def pcc_pos(self, row1, row2):
"""Calculate the Pearson correlation coefficient of one position
compared to another position.
Returns
-------
score : float
Pearson correlation coefficient.
"""
mean1 = np.mean(row1)
mean2 = np.mean(row2)
... | def pcc_pos(self, row1, row2):
"""Calculate the Pearson correlation coefficient of one position
compared to another position.
Returns
-------
score : float
Pearson correlation coefficient.
"""
mean1 = np.mean(row1)
mean2 = np.mean(row2)
... | [
"Calculate",
"the",
"Pearson",
"correlation",
"coefficient",
"of",
"one",
"position",
"compared",
"to",
"another",
"position",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L314-L337 | [
"def",
"pcc_pos",
"(",
"self",
",",
"row1",
",",
"row2",
")",
":",
"mean1",
"=",
"np",
".",
"mean",
"(",
"row1",
")",
"mean2",
"=",
"np",
".",
"mean",
"(",
"row2",
")",
"a",
"=",
"0",
"x",
"=",
"0",
"y",
"=",
"0",
"for",
"n1",
",",
"n2",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.rc | Return the reverse complemented motif.
Returns
-------
m : Motif instance
New Motif instance with the reverse complement of the input motif. | gimmemotifs/motif.py | def rc(self):
"""Return the reverse complemented motif.
Returns
-------
m : Motif instance
New Motif instance with the reverse complement of the input motif.
"""
m = Motif()
m.pfm = [row[::-1] for row in self.pfm[::-1]]
m.pwm = [row[::-1] for ... | def rc(self):
"""Return the reverse complemented motif.
Returns
-------
m : Motif instance
New Motif instance with the reverse complement of the input motif.
"""
m = Motif()
m.pfm = [row[::-1] for row in self.pfm[::-1]]
m.pwm = [row[::-1] for ... | [
"Return",
"the",
"reverse",
"complemented",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L339-L351 | [
"def",
"rc",
"(",
"self",
")",
":",
"m",
"=",
"Motif",
"(",
")",
"m",
".",
"pfm",
"=",
"[",
"row",
"[",
":",
":",
"-",
"1",
"]",
"for",
"row",
"in",
"self",
".",
"pfm",
"[",
":",
":",
"-",
"1",
"]",
"]",
"m",
".",
"pwm",
"=",
"[",
"ro... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.trim | Trim positions with an information content lower than the threshold.
The default threshold is set to 0.4. The Motif will be changed in-place.
Parameters
----------
edge_ic_cutoff : float, optional
Information content threshold. All motif positions at the flanks
... | gimmemotifs/motif.py | def trim(self, edge_ic_cutoff=0.4):
"""Trim positions with an information content lower than the threshold.
The default threshold is set to 0.4. The Motif will be changed in-place.
Parameters
----------
edge_ic_cutoff : float, optional
Information content threshold.... | def trim(self, edge_ic_cutoff=0.4):
"""Trim positions with an information content lower than the threshold.
The default threshold is set to 0.4. The Motif will be changed in-place.
Parameters
----------
edge_ic_cutoff : float, optional
Information content threshold.... | [
"Trim",
"positions",
"with",
"an",
"information",
"content",
"lower",
"than",
"the",
"threshold",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L353-L383 | [
"def",
"trim",
"(",
"self",
",",
"edge_ic_cutoff",
"=",
"0.4",
")",
":",
"pwm",
"=",
"self",
".",
"pwm",
"[",
":",
"]",
"while",
"len",
"(",
"pwm",
")",
">",
"0",
"and",
"self",
".",
"ic_pos",
"(",
"pwm",
"[",
"0",
"]",
")",
"<",
"edge_ic_cutof... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.consensus_scan | Scan FASTA with the motif as a consensus sequence.
Parameters
----------
fa : Fasta object
Fasta object to scan
Returns
-------
matches : dict
Dictionaru with matches. | gimmemotifs/motif.py | def consensus_scan(self, fa):
"""Scan FASTA with the motif as a consensus sequence.
Parameters
----------
fa : Fasta object
Fasta object to scan
Returns
-------
matches : dict
Dictionaru with matches.
"""
regexp = ... | def consensus_scan(self, fa):
"""Scan FASTA with the motif as a consensus sequence.
Parameters
----------
fa : Fasta object
Fasta object to scan
Returns
-------
matches : dict
Dictionaru with matches.
"""
regexp = ... | [
"Scan",
"FASTA",
"with",
"the",
"motif",
"as",
"a",
"consensus",
"sequence",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L385-L406 | [
"def",
"consensus_scan",
"(",
"self",
",",
"fa",
")",
":",
"regexp",
"=",
"\"\"",
".",
"join",
"(",
"[",
"\"[\"",
"+",
"\"\"",
".",
"join",
"(",
"self",
".",
"iupac",
"[",
"x",
".",
"upper",
"(",
")",
"]",
")",
"+",
"\"]\"",
"for",
"x",
"in",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pwm_scan | Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be returned.
Only the position of the matches is returned.
Par... | gimmemotifs/motif.py | def pwm_scan(self, fa, cutoff=0.9, nreport=50, scan_rc=True):
"""Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be ret... | def pwm_scan(self, fa, cutoff=0.9, nreport=50, scan_rc=True):
"""Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be ret... | [
"Scan",
"sequences",
"with",
"this",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L408-L443 | [
"def",
"pwm_scan",
"(",
"self",
",",
"fa",
",",
"cutoff",
"=",
"0.9",
",",
"nreport",
"=",
"50",
",",
"scan_rc",
"=",
"True",
")",
":",
"c",
"=",
"self",
".",
"pwm_min_score",
"(",
")",
"+",
"(",
"self",
".",
"pwm_max_score",
"(",
")",
"-",
"self... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pwm_scan_all | Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be returned.
The score, position and strand for every match is returned... | gimmemotifs/motif.py | def pwm_scan_all(self, fa, cutoff=0.9, nreport=50, scan_rc=True):
"""Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be... | def pwm_scan_all(self, fa, cutoff=0.9, nreport=50, scan_rc=True):
"""Scan sequences with this motif.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be... | [
"Scan",
"sequences",
"with",
"this",
"motif",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L445-L479 | [
"def",
"pwm_scan_all",
"(",
"self",
",",
"fa",
",",
"cutoff",
"=",
"0.9",
",",
"nreport",
"=",
"50",
",",
"scan_rc",
"=",
"True",
")",
":",
"c",
"=",
"self",
".",
"pwm_min_score",
"(",
")",
"+",
"(",
"self",
".",
"pwm_max_score",
"(",
")",
"-",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.pwm_scan_to_gff | Scan sequences with this motif and save to a GFF file.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nreport to 1, the best match for every sequence will be returned.
The output is save to a file in GFF... | gimmemotifs/motif.py | def pwm_scan_to_gff(self, fa, gfffile, cutoff=0.9, nreport=50, scan_rc=True, append=False):
"""Scan sequences with this motif and save to a GFF file.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nrepor... | def pwm_scan_to_gff(self, fa, gfffile, cutoff=0.9, nreport=50, scan_rc=True, append=False):
"""Scan sequences with this motif and save to a GFF file.
Scan sequences from a FASTA object with this motif. Less efficient
than using a Scanner object. By setting the cutoff to 0.0 and
nrepor... | [
"Scan",
"sequences",
"with",
"this",
"motif",
"and",
"save",
"to",
"a",
"GFF",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L517-L564 | [
"def",
"pwm_scan_to_gff",
"(",
"self",
",",
"fa",
",",
"gfffile",
",",
"cutoff",
"=",
"0.9",
",",
"nreport",
"=",
"50",
",",
"scan_rc",
"=",
"True",
",",
"append",
"=",
"False",
")",
":",
"if",
"append",
":",
"out",
"=",
"open",
"(",
"gfffile",
","... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.average_motifs | Return the average of two motifs.
Combine this motif with another motif and return the average as a new
Motif object. The position and orientatien need to be supplied. The pos
parameter is the position of the second motif relative to this motif.
For example, take the following ... | gimmemotifs/motif.py | def average_motifs(self, other, pos, orientation, include_bg=False):
"""Return the average of two motifs.
Combine this motif with another motif and return the average as a new
Motif object. The position and orientatien need to be supplied. The pos
parameter is the position of the second... | def average_motifs(self, other, pos, orientation, include_bg=False):
"""Return the average of two motifs.
Combine this motif with another motif and return the average as a new
Motif object. The position and orientatien need to be supplied. The pos
parameter is the position of the second... | [
"Return",
"the",
"average",
"of",
"two",
"motifs",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L566-L637 | [
"def",
"average_motifs",
"(",
"self",
",",
"other",
",",
"pos",
",",
"orientation",
",",
"include_bg",
"=",
"False",
")",
":",
"# xxCATGYT",
"# GGCTTGYx",
"# pos = -2",
"pfm1",
"=",
"self",
".",
"pfm",
"[",
":",
"]",
"pfm2",
"=",
"other",
".",
"pfm",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif._pwm_to_str | Return string representation of pwm.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
Returns
-------
pwm_string : str | gimmemotifs/motif.py | def _pwm_to_str(self, precision=4):
"""Return string representation of pwm.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
Returns
-------
pwm_string : str
"""
if not self.pwm:
return ... | def _pwm_to_str(self, precision=4):
"""Return string representation of pwm.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
Returns
-------
pwm_string : str
"""
if not self.pwm:
return ... | [
"Return",
"string",
"representation",
"of",
"pwm",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L906-L925 | [
"def",
"_pwm_to_str",
"(",
"self",
",",
"precision",
"=",
"4",
")",
":",
"if",
"not",
"self",
".",
"pwm",
":",
"return",
"\"\"",
"fmt",
"=",
"\"{{:.{:d}f}}\"",
".",
"format",
"(",
"precision",
")",
"return",
"\"\\n\"",
".",
"join",
"(",
"[",
"\"\\t\"",... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.to_pwm | Return pwm as string.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
extra_str |: str, optional
Extra text to include with motif id line.
Returns
-------
motif_str : str
M... | gimmemotifs/motif.py | def to_pwm(self, precision=4, extra_str=""):
"""Return pwm as string.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
extra_str |: str, optional
Extra text to include with motif id line.
Retur... | def to_pwm(self, precision=4, extra_str=""):
"""Return pwm as string.
Parameters
----------
precision : int, optional, default 4
Floating-point precision.
extra_str |: str, optional
Extra text to include with motif id line.
Retur... | [
"Return",
"pwm",
"as",
"string",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L937-L964 | [
"def",
"to_pwm",
"(",
"self",
",",
"precision",
"=",
"4",
",",
"extra_str",
"=",
"\"\"",
")",
":",
"motif_id",
"=",
"self",
".",
"id",
"if",
"extra_str",
":",
"motif_id",
"+=",
"\"_%s\"",
"%",
"extra_str",
"if",
"not",
"self",
".",
"pwm",
":",
"self"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.to_img | Create a sequence logo using seqlogo.
Create a sequence logo and save it to a file. Valid formats are: PNG,
EPS, GIF and PDF.
Parameters
----------
fname : str
Output filename.
fmt : str , optional
Output format (case-insensitive). Valid format... | gimmemotifs/motif.py | def to_img(self, fname, fmt="PNG", add_left=0, seqlogo=None, height=6):
"""Create a sequence logo using seqlogo.
Create a sequence logo and save it to a file. Valid formats are: PNG,
EPS, GIF and PDF.
Parameters
----------
fname : str
Output filename.
... | def to_img(self, fname, fmt="PNG", add_left=0, seqlogo=None, height=6):
"""Create a sequence logo using seqlogo.
Create a sequence logo and save it to a file. Valid formats are: PNG,
EPS, GIF and PDF.
Parameters
----------
fname : str
Output filename.
... | [
"Create",
"a",
"sequence",
"logo",
"using",
"seqlogo",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L966-L1039 | [
"def",
"to_img",
"(",
"self",
",",
"fname",
",",
"fmt",
"=",
"\"PNG\"",
",",
"add_left",
"=",
"0",
",",
"seqlogo",
"=",
"None",
",",
"height",
"=",
"6",
")",
":",
"if",
"not",
"seqlogo",
":",
"seqlogo",
"=",
"self",
".",
"seqlogo",
"if",
"not",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Motif.randomize | Create a new motif with shuffled positions.
Shuffle the positions of this motif and return a new Motif instance.
Returns
-------
m : Motif instance
Motif instance with shuffled positions. | gimmemotifs/motif.py | def randomize(self):
"""Create a new motif with shuffled positions.
Shuffle the positions of this motif and return a new Motif instance.
Returns
-------
m : Motif instance
Motif instance with shuffled positions.
"""
random_pfm = [[c for c in row] for... | def randomize(self):
"""Create a new motif with shuffled positions.
Shuffle the positions of this motif and return a new Motif instance.
Returns
-------
m : Motif instance
Motif instance with shuffled positions.
"""
random_pfm = [[c for c in row] for... | [
"Create",
"a",
"new",
"motif",
"with",
"shuffled",
"positions",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/motif.py#L1045-L1059 | [
"def",
"randomize",
"(",
"self",
")",
":",
"random_pfm",
"=",
"[",
"[",
"c",
"for",
"c",
"in",
"row",
"]",
"for",
"row",
"in",
"self",
".",
"pfm",
"]",
"random",
".",
"shuffle",
"(",
"random_pfm",
")",
"m",
"=",
"Motif",
"(",
"pfm",
"=",
"random_... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | maelstrom | Run the maelstrom method. | gimmemotifs/commands/maelstrom.py | def maelstrom(args):
"""Run the maelstrom method."""
infile = args.inputfile
genome = args.genome
outdir = args.outdir
pwmfile = args.pwmfile
methods = args.methods
ncpus = args.ncpus
if not os.path.exists(infile):
raise ValueError("file {} does not exist".format(infile))
... | def maelstrom(args):
"""Run the maelstrom method."""
infile = args.inputfile
genome = args.genome
outdir = args.outdir
pwmfile = args.pwmfile
methods = args.methods
ncpus = args.ncpus
if not os.path.exists(infile):
raise ValueError("file {} does not exist".format(infile))
... | [
"Run",
"the",
"maelstrom",
"method",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/commands/maelstrom.py#L12-L27 | [
"def",
"maelstrom",
"(",
"args",
")",
":",
"infile",
"=",
"args",
".",
"inputfile",
"genome",
"=",
"args",
".",
"genome",
"outdir",
"=",
"args",
".",
"outdir",
"pwmfile",
"=",
"args",
".",
"pwmfile",
"methods",
"=",
"args",
".",
"methods",
"ncpus",
"="... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | zmq_send_data | Send data, e.g. {key: np.ndarray}, with metadata | pescador/zmq_stream.py | def zmq_send_data(socket, data, flags=0, copy=True, track=False):
"""Send data, e.g. {key: np.ndarray}, with metadata"""
header, payload = [], []
for key in sorted(data.keys()):
arr = data[key]
if not isinstance(arr, np.ndarray):
raise DataError('Only ndarray types can be seri... | def zmq_send_data(socket, data, flags=0, copy=True, track=False):
"""Send data, e.g. {key: np.ndarray}, with metadata"""
header, payload = [], []
for key in sorted(data.keys()):
arr = data[key]
if not isinstance(arr, np.ndarray):
raise DataError('Only ndarray types can be seri... | [
"Send",
"data",
"e",
".",
"g",
".",
"{",
"key",
":",
"np",
".",
"ndarray",
"}",
"with",
"metadata"
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/zmq_stream.py#L47-L69 | [
"def",
"zmq_send_data",
"(",
"socket",
",",
"data",
",",
"flags",
"=",
"0",
",",
"copy",
"=",
"True",
",",
"track",
"=",
"False",
")",
":",
"header",
",",
"payload",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"key",
"in",
"sorted",
"(",
"data",
".",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | zmq_recv_data | Receive data over a socket. | pescador/zmq_stream.py | def zmq_recv_data(socket, flags=0, copy=True, track=False):
"""Receive data over a socket."""
data = dict()
msg = socket.recv_multipart(flags=flags, copy=copy, track=track)
headers = json.loads(msg[0].decode('ascii'))
if len(headers) == 0:
raise StopIteration
for header, payload in ... | def zmq_recv_data(socket, flags=0, copy=True, track=False):
"""Receive data over a socket."""
data = dict()
msg = socket.recv_multipart(flags=flags, copy=copy, track=track)
headers = json.loads(msg[0].decode('ascii'))
if len(headers) == 0:
raise StopIteration
for header, payload in ... | [
"Receive",
"data",
"over",
"a",
"socket",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/zmq_stream.py#L72-L93 | [
"def",
"zmq_recv_data",
"(",
"socket",
",",
"flags",
"=",
"0",
",",
"copy",
"=",
"True",
",",
"track",
"=",
"False",
")",
":",
"data",
"=",
"dict",
"(",
")",
"msg",
"=",
"socket",
".",
"recv_multipart",
"(",
"flags",
"=",
"flags",
",",
"copy",
"=",... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | ZMQStreamer.iterate | Note: A ZMQStreamer does not activate its stream,
but allows the zmq_worker to do that.
Yields
------
data : dict
Data drawn from `streamer(max_iter)`. | pescador/zmq_stream.py | def iterate(self, max_iter=None):
"""
Note: A ZMQStreamer does not activate its stream,
but allows the zmq_worker to do that.
Yields
------
data : dict
Data drawn from `streamer(max_iter)`.
"""
context = zmq.Context()
if six.PY2:
... | def iterate(self, max_iter=None):
"""
Note: A ZMQStreamer does not activate its stream,
but allows the zmq_worker to do that.
Yields
------
data : dict
Data drawn from `streamer(max_iter)`.
"""
context = zmq.Context()
if six.PY2:
... | [
"Note",
":",
"A",
"ZMQStreamer",
"does",
"not",
"activate",
"its",
"stream",
"but",
"allows",
"the",
"zmq_worker",
"to",
"do",
"that",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/zmq_stream.py#L169-L218 | [
"def",
"iterate",
"(",
"self",
",",
"max_iter",
"=",
"None",
")",
":",
"context",
"=",
"zmq",
".",
"Context",
"(",
")",
"if",
"six",
".",
"PY2",
":",
"warnings",
".",
"warn",
"(",
"'zmq_stream cannot preserve numpy array alignment '",
"'in Python 2'",
",",
"... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | Fasta.hardmask | Mask all lowercase nucleotides with N's | gimmemotifs/fasta.py | def hardmask(self):
""" Mask all lowercase nucleotides with N's """
p = re.compile("a|c|g|t|n")
for seq_id in self.fasta_dict.keys():
self.fasta_dict[seq_id] = p.sub("N", self.fasta_dict[seq_id])
return self | def hardmask(self):
""" Mask all lowercase nucleotides with N's """
p = re.compile("a|c|g|t|n")
for seq_id in self.fasta_dict.keys():
self.fasta_dict[seq_id] = p.sub("N", self.fasta_dict[seq_id])
return self | [
"Mask",
"all",
"lowercase",
"nucleotides",
"with",
"N",
"s"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/fasta.py#L39-L44 | [
"def",
"hardmask",
"(",
"self",
")",
":",
"p",
"=",
"re",
".",
"compile",
"(",
"\"a|c|g|t|n\"",
")",
"for",
"seq_id",
"in",
"self",
".",
"fasta_dict",
".",
"keys",
"(",
")",
":",
"self",
".",
"fasta_dict",
"[",
"seq_id",
"]",
"=",
"p",
".",
"sub",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Fasta.get_random | Return n random sequences from this Fasta object | gimmemotifs/fasta.py | def get_random(self, n, l=None):
""" Return n random sequences from this Fasta object """
random_f = Fasta()
if l:
ids = self.ids[:]
random.shuffle(ids)
i = 0
while (i < n) and (len(ids) > 0):
seq_id = ids.pop()
if (... | def get_random(self, n, l=None):
""" Return n random sequences from this Fasta object """
random_f = Fasta()
if l:
ids = self.ids[:]
random.shuffle(ids)
i = 0
while (i < n) and (len(ids) > 0):
seq_id = ids.pop()
if (... | [
"Return",
"n",
"random",
"sequences",
"from",
"this",
"Fasta",
"object"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/fasta.py#L46-L69 | [
"def",
"get_random",
"(",
"self",
",",
"n",
",",
"l",
"=",
"None",
")",
":",
"random_f",
"=",
"Fasta",
"(",
")",
"if",
"l",
":",
"ids",
"=",
"self",
".",
"ids",
"[",
":",
"]",
"random",
".",
"shuffle",
"(",
"ids",
")",
"i",
"=",
"0",
"while",... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Fasta.writefasta | Write sequences to FASTA formatted file | gimmemotifs/fasta.py | def writefasta(self, fname):
""" Write sequences to FASTA formatted file"""
f = open(fname, "w")
fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in self.items()])
f.write(fa_str)
f.close() | def writefasta(self, fname):
""" Write sequences to FASTA formatted file"""
f = open(fname, "w")
fa_str = "\n".join([">%s\n%s" % (id, self._format_seq(seq)) for id, seq in self.items()])
f.write(fa_str)
f.close() | [
"Write",
"sequences",
"to",
"FASTA",
"formatted",
"file"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/fasta.py#L117-L122 | [
"def",
"writefasta",
"(",
"self",
",",
"fname",
")",
":",
"f",
"=",
"open",
"(",
"fname",
",",
"\"w\"",
")",
"fa_str",
"=",
"\"\\n\"",
".",
"join",
"(",
"[",
"\">%s\\n%s\"",
"%",
"(",
"id",
",",
"self",
".",
"_format_seq",
"(",
"seq",
")",
")",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | cluster_motifs | Clusters a set of sequence motifs. Required arg 'motifs' is a file containing
positional frequency matrices or an array with motifs.
Optional args:
'match', 'metric' and 'combine' specify the method used to compare and score
the motifs. By default the WIC score is used (metric='wic'), using the the
... | gimmemotifs/cluster.py | def cluster_motifs(motifs, match="total", metric="wic", combine="mean", pval=True, threshold=0.95, trim_edges=False, edge_ic_cutoff=0.2, include_bg=True, progress=True, ncpus=None):
"""
Clusters a set of sequence motifs. Required arg 'motifs' is a file containing
positional frequency matrices or an array w... | def cluster_motifs(motifs, match="total", metric="wic", combine="mean", pval=True, threshold=0.95, trim_edges=False, edge_ic_cutoff=0.2, include_bg=True, progress=True, ncpus=None):
"""
Clusters a set of sequence motifs. Required arg 'motifs' is a file containing
positional frequency matrices or an array w... | [
"Clusters",
"a",
"set",
"of",
"sequence",
"motifs",
".",
"Required",
"arg",
"motifs",
"is",
"a",
"file",
"containing",
"positional",
"frequency",
"matrices",
"or",
"an",
"array",
"with",
"motifs",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/cluster.py#L83-L225 | [
"def",
"cluster_motifs",
"(",
"motifs",
",",
"match",
"=",
"\"total\"",
",",
"metric",
"=",
"\"wic\"",
",",
"combine",
"=",
"\"mean\"",
",",
"pval",
"=",
"True",
",",
"threshold",
"=",
"0.95",
",",
"trim_edges",
"=",
"False",
",",
"edge_ic_cutoff",
"=",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | batch_length | Determine the number of samples in a batch.
Parameters
----------
batch : dict
A batch dictionary. Each value must implement `len`.
All values must have the same `len`.
Returns
-------
n : int >= 0 or None
The number of samples in this batch.
If the batch has n... | pescador/util.py | def batch_length(batch):
'''Determine the number of samples in a batch.
Parameters
----------
batch : dict
A batch dictionary. Each value must implement `len`.
All values must have the same `len`.
Returns
-------
n : int >= 0 or None
The number of samples in this b... | def batch_length(batch):
'''Determine the number of samples in a batch.
Parameters
----------
batch : dict
A batch dictionary. Each value must implement `len`.
All values must have the same `len`.
Returns
-------
n : int >= 0 or None
The number of samples in this b... | [
"Determine",
"the",
"number",
"of",
"samples",
"in",
"a",
"batch",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/util.py#L121-L150 | [
"def",
"batch_length",
"(",
"batch",
")",
":",
"n",
"=",
"None",
"for",
"value",
"in",
"six",
".",
"itervalues",
"(",
"batch",
")",
":",
"if",
"n",
"is",
"None",
":",
"n",
"=",
"len",
"(",
"value",
")",
"elif",
"len",
"(",
"value",
")",
"!=",
"... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | Mux._activate | Activates a number of streams | pescador/mux.py | def _activate(self):
"""Activates a number of streams"""
self.distribution_ = 1. / self.n_streams * np.ones(self.n_streams)
self.valid_streams_ = np.ones(self.n_streams, dtype=bool)
self.streams_ = [None] * self.k
self.stream_weights_ = np.zeros(self.k)
self.stream_coun... | def _activate(self):
"""Activates a number of streams"""
self.distribution_ = 1. / self.n_streams * np.ones(self.n_streams)
self.valid_streams_ = np.ones(self.n_streams, dtype=bool)
self.streams_ = [None] * self.k
self.stream_weights_ = np.zeros(self.k)
self.stream_coun... | [
"Activates",
"a",
"number",
"of",
"streams"
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L237-L259 | [
"def",
"_activate",
"(",
"self",
")",
":",
"self",
".",
"distribution_",
"=",
"1.",
"/",
"self",
".",
"n_streams",
"*",
"np",
".",
"ones",
"(",
"self",
".",
"n_streams",
")",
"self",
".",
"valid_streams_",
"=",
"np",
".",
"ones",
"(",
"self",
".",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | Mux._new_stream | Randomly select and create a stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace | pescador/mux.py | def _new_stream(self, idx):
'''Randomly select and create a stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# instantiate
if self.rate is not None:
n_stream = 1 + self.rng.poisson(lam=self.rate)
... | def _new_stream(self, idx):
'''Randomly select and create a stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# instantiate
if self.rate is not None:
n_stream = 1 + self.rng.poisson(lam=self.rate)
... | [
"Randomly",
"select",
"and",
"create",
"a",
"stream",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L341-L366 | [
"def",
"_new_stream",
"(",
"self",
",",
"idx",
")",
":",
"# instantiate",
"if",
"self",
".",
"rate",
"is",
"not",
"None",
":",
"n_stream",
"=",
"1",
"+",
"self",
".",
"rng",
".",
"poisson",
"(",
"lam",
"=",
"self",
".",
"rate",
")",
"else",
":",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | BaseMux.iterate | Yields items from the mux, and handles stream exhaustion and
replacement. | pescador/mux.py | def iterate(self, max_iter=None):
"""Yields items from the mux, and handles stream exhaustion and
replacement.
"""
if max_iter is None:
max_iter = np.inf
# Calls Streamer's __enter__, which calls activate()
with self as active_mux:
# Main sampling... | def iterate(self, max_iter=None):
"""Yields items from the mux, and handles stream exhaustion and
replacement.
"""
if max_iter is None:
max_iter = np.inf
# Calls Streamer's __enter__, which calls activate()
with self as active_mux:
# Main sampling... | [
"Yields",
"items",
"from",
"the",
"mux",
"and",
"handles",
"stream",
"exhaustion",
"and",
"replacement",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L479-L511 | [
"def",
"iterate",
"(",
"self",
",",
"max_iter",
"=",
"None",
")",
":",
"if",
"max_iter",
"is",
"None",
":",
"max_iter",
"=",
"np",
".",
"inf",
"# Calls Streamer's __enter__, which calls activate()",
"with",
"self",
"as",
"active_mux",
":",
"# Main sampling loop",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | StochasticMux._next_sample_index | StochasticMux chooses its next sample stream randomly | pescador/mux.py | def _next_sample_index(self):
"""StochasticMux chooses its next sample stream randomly"""
return self.rng.choice(self.n_active,
p=(self.stream_weights_ /
self.weight_norm_)) | def _next_sample_index(self):
"""StochasticMux chooses its next sample stream randomly"""
return self.rng.choice(self.n_active,
p=(self.stream_weights_ /
self.weight_norm_)) | [
"StochasticMux",
"chooses",
"its",
"next",
"sample",
"stream",
"randomly"
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L713-L717 | [
"def",
"_next_sample_index",
"(",
"self",
")",
":",
"return",
"self",
".",
"rng",
".",
"choice",
"(",
"self",
".",
"n_active",
",",
"p",
"=",
"(",
"self",
".",
"stream_weights_",
"/",
"self",
".",
"weight_norm_",
")",
")"
] | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | StochasticMux._activate_stream | Randomly select and create a stream.
StochasticMux adds mode handling to _activate_stream, making it so that
if we're not sampling "with_replacement", the distribution for this
chosen streamer is set to 0, causing the streamer not to be available
until it is exhausted.
Paramete... | pescador/mux.py | def _activate_stream(self, idx):
'''Randomly select and create a stream.
StochasticMux adds mode handling to _activate_stream, making it so that
if we're not sampling "with_replacement", the distribution for this
chosen streamer is set to 0, causing the streamer not to be available
... | def _activate_stream(self, idx):
'''Randomly select and create a stream.
StochasticMux adds mode handling to _activate_stream, making it so that
if we're not sampling "with_replacement", the distribution for this
chosen streamer is set to 0, causing the streamer not to be available
... | [
"Randomly",
"select",
"and",
"create",
"a",
"stream",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L738-L771 | [
"def",
"_activate_stream",
"(",
"self",
",",
"idx",
")",
":",
"# Get the number of samples for this streamer.",
"n_samples_to_stream",
"=",
"None",
"if",
"self",
".",
"rate",
"is",
"not",
"None",
":",
"n_samples_to_stream",
"=",
"1",
"+",
"self",
".",
"rng",
"."... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | StochasticMux._new_stream | Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace | pescador/mux.py | def _new_stream(self, idx):
'''Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# Choose the stream index from the candidate pool
self.stream_idxs_[idx] = self.rng.choice(
... | def _new_stream(self, idx):
'''Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# Choose the stream index from the candidate pool
self.stream_idxs_[idx] = self.rng.choice(
... | [
"Randomly",
"select",
"and",
"create",
"a",
"new",
"stream",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L773-L790 | [
"def",
"_new_stream",
"(",
"self",
",",
"idx",
")",
":",
"# Choose the stream index from the candidate pool",
"self",
".",
"stream_idxs_",
"[",
"idx",
"]",
"=",
"self",
".",
"rng",
".",
"choice",
"(",
"self",
".",
"n_streams",
",",
"p",
"=",
"self",
".",
"... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | ShuffledMux._activate | ShuffledMux's activate is similar to StochasticMux,
but there is no 'n_active', since all the streams are always available. | pescador/mux.py | def _activate(self):
"""ShuffledMux's activate is similar to StochasticMux,
but there is no 'n_active', since all the streams are always available.
"""
self.streams_ = [None] * self.n_streams
# Weights of the active streams.
# Once a stream is exhausted, it is set to 0.
... | def _activate(self):
"""ShuffledMux's activate is similar to StochasticMux,
but there is no 'n_active', since all the streams are always available.
"""
self.streams_ = [None] * self.n_streams
# Weights of the active streams.
# Once a stream is exhausted, it is set to 0.
... | [
"ShuffledMux",
"s",
"activate",
"is",
"similar",
"to",
"StochasticMux",
"but",
"there",
"is",
"no",
"n_active",
"since",
"all",
"the",
"streams",
"are",
"always",
"available",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L888-L906 | [
"def",
"_activate",
"(",
"self",
")",
":",
"self",
".",
"streams_",
"=",
"[",
"None",
"]",
"*",
"self",
".",
"n_streams",
"# Weights of the active streams.",
"# Once a stream is exhausted, it is set to 0.",
"# Upon activation, this is just a copy of self.weights.",
"self",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | ShuffledMux._next_sample_index | ShuffledMux chooses its next sample stream randomly,
conditioned on the stream weights. | pescador/mux.py | def _next_sample_index(self):
"""ShuffledMux chooses its next sample stream randomly,
conditioned on the stream weights.
"""
return self.rng.choice(self.n_streams,
p=(self.stream_weights_ /
self.weight_norm_)) | def _next_sample_index(self):
"""ShuffledMux chooses its next sample stream randomly,
conditioned on the stream weights.
"""
return self.rng.choice(self.n_streams,
p=(self.stream_weights_ /
self.weight_norm_)) | [
"ShuffledMux",
"chooses",
"its",
"next",
"sample",
"stream",
"randomly",
"conditioned",
"on",
"the",
"stream",
"weights",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L917-L923 | [
"def",
"_next_sample_index",
"(",
"self",
")",
":",
"return",
"self",
".",
"rng",
".",
"choice",
"(",
"self",
".",
"n_streams",
",",
"p",
"=",
"(",
"self",
".",
"stream_weights_",
"/",
"self",
".",
"weight_norm_",
")",
")"
] | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | ShuffledMux._new_stream | Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace | pescador/mux.py | def _new_stream(self, idx):
'''Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# Don't activate the stream if the weight is 0 or None
if self.stream_weights_[idx]:
... | def _new_stream(self, idx):
'''Randomly select and create a new stream.
Parameters
----------
idx : int, [0:n_streams - 1]
The stream index to replace
'''
# Don't activate the stream if the weight is 0 or None
if self.stream_weights_[idx]:
... | [
"Randomly",
"select",
"and",
"create",
"a",
"new",
"stream",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L932-L947 | [
"def",
"_new_stream",
"(",
"self",
",",
"idx",
")",
":",
"# Don't activate the stream if the weight is 0 or None",
"if",
"self",
".",
"stream_weights_",
"[",
"idx",
"]",
":",
"self",
".",
"streams_",
"[",
"idx",
"]",
"=",
"self",
".",
"streamers",
"[",
"idx",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | RoundRobinMux._next_sample_index | Rotates through each active sampler by incrementing the index | pescador/mux.py | def _next_sample_index(self):
"""Rotates through each active sampler by incrementing the index"""
# Return the next streamer index where the streamer is not None,
# wrapping around.
idx = self.active_index_
self.active_index_ += 1
if self.active_index_ >= len(self.stream... | def _next_sample_index(self):
"""Rotates through each active sampler by incrementing the index"""
# Return the next streamer index where the streamer is not None,
# wrapping around.
idx = self.active_index_
self.active_index_ += 1
if self.active_index_ >= len(self.stream... | [
"Rotates",
"through",
"each",
"active",
"sampler",
"by",
"incrementing",
"the",
"index"
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L1058-L1080 | [
"def",
"_next_sample_index",
"(",
"self",
")",
":",
"# Return the next streamer index where the streamer is not None,",
"# wrapping around.",
"idx",
"=",
"self",
".",
"active_index_",
"self",
".",
"active_index_",
"+=",
"1",
"if",
"self",
".",
"active_index_",
">=",
"le... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | RoundRobinMux._new_stream | Activate a new stream, given the index into the stream pool.
BaseMux's _new_stream simply chooses a new stream and activates it.
For special behavior (ie Weighted streams), you must override this
in a child class.
Parameters
----------
idx : int, [0:n_streams - 1]
... | pescador/mux.py | def _new_stream(self, idx):
"""Activate a new stream, given the index into the stream pool.
BaseMux's _new_stream simply chooses a new stream and activates it.
For special behavior (ie Weighted streams), you must override this
in a child class.
Parameters
----------
... | def _new_stream(self, idx):
"""Activate a new stream, given the index into the stream pool.
BaseMux's _new_stream simply chooses a new stream and activates it.
For special behavior (ie Weighted streams), you must override this
in a child class.
Parameters
----------
... | [
"Activate",
"a",
"new",
"stream",
"given",
"the",
"index",
"into",
"the",
"stream",
"pool",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L1082-L1101 | [
"def",
"_new_stream",
"(",
"self",
",",
"idx",
")",
":",
"# Get the stream index from the candidate pool",
"stream_index",
"=",
"self",
".",
"stream_idxs_",
"[",
"idx",
"]",
"# Activate the Streamer, and get the weights",
"self",
".",
"streams_",
"[",
"idx",
"]",
"=",... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | RoundRobinMux._replace_stream | Called by `BaseMux`'s iterate() when a stream is exhausted.
Set the stream to None so it is ignored once exhausted.
Parameters
----------
idx : int or None
Raises
------
StopIteration
If all streams are consumed, and `mode`=="exahustive" | pescador/mux.py | def _replace_stream(self, idx=None):
"""Called by `BaseMux`'s iterate() when a stream is exhausted.
Set the stream to None so it is ignored once exhausted.
Parameters
----------
idx : int or None
Raises
------
StopIteration
If all streams are... | def _replace_stream(self, idx=None):
"""Called by `BaseMux`'s iterate() when a stream is exhausted.
Set the stream to None so it is ignored once exhausted.
Parameters
----------
idx : int or None
Raises
------
StopIteration
If all streams are... | [
"Called",
"by",
"BaseMux",
"s",
"iterate",
"()",
"when",
"a",
"stream",
"is",
"exhausted",
".",
"Set",
"the",
"stream",
"to",
"None",
"so",
"it",
"is",
"ignored",
"once",
"exhausted",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L1103-L1127 | [
"def",
"_replace_stream",
"(",
"self",
",",
"idx",
"=",
"None",
")",
":",
"self",
".",
"streams_",
"[",
"idx",
"]",
"=",
"None",
"# Check if we've now exhausted all the streams.",
"if",
"not",
"self",
".",
"_streamers_available",
"(",
")",
":",
"if",
"self",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | ChainMux._new_stream | Grab the next stream from the input streamers, and start it.
Raises
------
StopIteration
When the input list or generator of streamers is complete,
will raise a StopIteration. If `mode == cycle`, it
will instead restart iterating from the beginning of the seq... | pescador/mux.py | def _new_stream(self):
'''Grab the next stream from the input streamers, and start it.
Raises
------
StopIteration
When the input list or generator of streamers is complete,
will raise a StopIteration. If `mode == cycle`, it
will instead restart itera... | def _new_stream(self):
'''Grab the next stream from the input streamers, and start it.
Raises
------
StopIteration
When the input list or generator of streamers is complete,
will raise a StopIteration. If `mode == cycle`, it
will instead restart itera... | [
"Grab",
"the",
"next",
"stream",
"from",
"the",
"input",
"streamers",
"and",
"start",
"it",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/mux.py#L1247-L1287 | [
"def",
"_new_stream",
"(",
"self",
")",
":",
"try",
":",
"# Advance the stream_generator_ to get the next available stream.",
"# If successful, this will make self.chain_streamer_.active True",
"next_stream",
"=",
"six",
".",
"advance_iterator",
"(",
"self",
".",
"stream_generato... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | split_and_save_datasets | Shuffle X and Y into n / len(paths) datasets, and save them
to disk at the locations provided in paths. | examples/mux/mux_files_example.py | def split_and_save_datasets(X, Y, paths):
"""Shuffle X and Y into n / len(paths) datasets, and save them
to disk at the locations provided in paths.
"""
shuffled_idxs = np.random.permutation(np.arange(len(X)))
for i in range(len(paths)):
# Take every len(paths) item, starting at i.
... | def split_and_save_datasets(X, Y, paths):
"""Shuffle X and Y into n / len(paths) datasets, and save them
to disk at the locations provided in paths.
"""
shuffled_idxs = np.random.permutation(np.arange(len(X)))
for i in range(len(paths)):
# Take every len(paths) item, starting at i.
... | [
"Shuffle",
"X",
"and",
"Y",
"into",
"n",
"/",
"len",
"(",
"paths",
")",
"datasets",
"and",
"save",
"them",
"to",
"disk",
"at",
"the",
"locations",
"provided",
"in",
"paths",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/mux/mux_files_example.py#L38-L49 | [
"def",
"split_and_save_datasets",
"(",
"X",
",",
"Y",
",",
"paths",
")",
":",
"shuffled_idxs",
"=",
"np",
".",
"random",
".",
"permutation",
"(",
"np",
".",
"arange",
"(",
"len",
"(",
"X",
")",
")",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | npz_generator | Generate data from an npz file. | examples/mux/mux_files_example.py | def npz_generator(npz_path):
"""Generate data from an npz file."""
npz_data = np.load(npz_path)
X = npz_data['X']
# Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,)
y = npz_data['Y']
n = X.shape[0]
while True:
i = np.random.randint(0, n)
yield {'X': X[i]... | def npz_generator(npz_path):
"""Generate data from an npz file."""
npz_data = np.load(npz_path)
X = npz_data['X']
# Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,)
y = npz_data['Y']
n = X.shape[0]
while True:
i = np.random.randint(0, n)
yield {'X': X[i]... | [
"Generate",
"data",
"from",
"an",
"npz",
"file",
"."
] | pescadores/pescador | python | https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/mux/mux_files_example.py#L60-L71 | [
"def",
"npz_generator",
"(",
"npz_path",
")",
":",
"npz_data",
"=",
"np",
".",
"load",
"(",
"npz_path",
")",
"X",
"=",
"npz_data",
"[",
"'X'",
"]",
"# Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,)",
"y",
"=",
"npz_data",
"[",
"'Y'",
"]",
"... | 786e2b5f882d13ea563769fbc7ad0a0a10c3553d |
train | phyper | Current hypergeometric implementation in scipy is broken, so here's the correct version | gimmemotifs/utils.py | def phyper(k, good, bad, N):
""" Current hypergeometric implementation in scipy is broken, so here's the correct version """
pvalues = [phyper_single(x, good, bad, N) for x in range(k + 1, N + 1)]
return np.sum(pvalues) | def phyper(k, good, bad, N):
""" Current hypergeometric implementation in scipy is broken, so here's the correct version """
pvalues = [phyper_single(x, good, bad, N) for x in range(k + 1, N + 1)]
return np.sum(pvalues) | [
"Current",
"hypergeometric",
"implementation",
"in",
"scipy",
"is",
"broken",
"so",
"here",
"s",
"the",
"correct",
"version"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L77-L80 | [
"def",
"phyper",
"(",
"k",
",",
"good",
",",
"bad",
",",
"N",
")",
":",
"pvalues",
"=",
"[",
"phyper_single",
"(",
"x",
",",
"good",
",",
"bad",
",",
"N",
")",
"for",
"x",
"in",
"range",
"(",
"k",
"+",
"1",
",",
"N",
"+",
"1",
")",
"]",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | write_equalwidth_bedfile | Read input from <bedfile>, set the width of all entries to <width> and
write the result to <outfile>.
Input file needs to be in BED or WIG format. | gimmemotifs/utils.py | def write_equalwidth_bedfile(bedfile, width, outfile):
"""Read input from <bedfile>, set the width of all entries to <width> and
write the result to <outfile>.
Input file needs to be in BED or WIG format."""
BUFSIZE = 10000
f = open(bedfile)
out = open(outfile, "w")
lines = f.readlines(BUF... | def write_equalwidth_bedfile(bedfile, width, outfile):
"""Read input from <bedfile>, set the width of all entries to <width> and
write the result to <outfile>.
Input file needs to be in BED or WIG format."""
BUFSIZE = 10000
f = open(bedfile)
out = open(outfile, "w")
lines = f.readlines(BUF... | [
"Read",
"input",
"from",
"<bedfile",
">",
"set",
"the",
"width",
"of",
"all",
"entries",
"to",
"<width",
">",
"and",
"write",
"the",
"result",
"to",
"<outfile",
">",
".",
"Input",
"file",
"needs",
"to",
"be",
"in",
"BED",
"or",
"WIG",
"format",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L143-L177 | [
"def",
"write_equalwidth_bedfile",
"(",
"bedfile",
",",
"width",
",",
"outfile",
")",
":",
"BUFSIZE",
"=",
"10000",
"f",
"=",
"open",
"(",
"bedfile",
")",
"out",
"=",
"open",
"(",
"outfile",
",",
"\"w\"",
")",
"lines",
"=",
"f",
".",
"readlines",
"(",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | calc_motif_enrichment | Calculate enrichment based on hypergeometric distribution | gimmemotifs/utils.py | def calc_motif_enrichment(sample, background, mtc=None, len_sample=None, len_back=None):
"""Calculate enrichment based on hypergeometric distribution"""
INF = "Inf"
if mtc not in [None, "Bonferroni", "Benjamini-Hochberg", "None"]:
raise RuntimeError("Unknown correction: %s" % mtc)
sig = ... | def calc_motif_enrichment(sample, background, mtc=None, len_sample=None, len_back=None):
"""Calculate enrichment based on hypergeometric distribution"""
INF = "Inf"
if mtc not in [None, "Bonferroni", "Benjamini-Hochberg", "None"]:
raise RuntimeError("Unknown correction: %s" % mtc)
sig = ... | [
"Calculate",
"enrichment",
"based",
"on",
"hypergeometric",
"distribution"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L264-L321 | [
"def",
"calc_motif_enrichment",
"(",
"sample",
",",
"background",
",",
"mtc",
"=",
"None",
",",
"len_sample",
"=",
"None",
",",
"len_back",
"=",
"None",
")",
":",
"INF",
"=",
"\"Inf\"",
"if",
"mtc",
"not",
"in",
"[",
"None",
",",
"\"Bonferroni\"",
",",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | parse_cutoff | Provide either a file with one cutoff per motif or a single cutoff
returns a hash with motif id as key and cutoff as value | gimmemotifs/utils.py | def parse_cutoff(motifs, cutoff, default=0.9):
""" Provide either a file with one cutoff per motif or a single cutoff
returns a hash with motif id as key and cutoff as value
"""
cutoffs = {}
if os.path.isfile(str(cutoff)):
for i,line in enumerate(open(cutoff)):
if line !... | def parse_cutoff(motifs, cutoff, default=0.9):
""" Provide either a file with one cutoff per motif or a single cutoff
returns a hash with motif id as key and cutoff as value
"""
cutoffs = {}
if os.path.isfile(str(cutoff)):
for i,line in enumerate(open(cutoff)):
if line !... | [
"Provide",
"either",
"a",
"file",
"with",
"one",
"cutoff",
"per",
"motif",
"or",
"a",
"single",
"cutoff",
"returns",
"a",
"hash",
"with",
"motif",
"id",
"as",
"key",
"and",
"cutoff",
"as",
"value"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L400-L424 | [
"def",
"parse_cutoff",
"(",
"motifs",
",",
"cutoff",
",",
"default",
"=",
"0.9",
")",
":",
"cutoffs",
"=",
"{",
"}",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"str",
"(",
"cutoff",
")",
")",
":",
"for",
"i",
",",
"line",
"in",
"enumerate",
"("... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | determine_file_type | Detect file type.
The following file types are supported:
BED, narrowPeak, FASTA, list of chr:start-end regions
If the extension is bed, fa, fasta or narrowPeak, we will believe this
without checking!
Parameters
----------
fname : str
File name.
Returns
-------
filetyp... | gimmemotifs/utils.py | def determine_file_type(fname):
"""
Detect file type.
The following file types are supported:
BED, narrowPeak, FASTA, list of chr:start-end regions
If the extension is bed, fa, fasta or narrowPeak, we will believe this
without checking!
Parameters
----------
fname : str
Fil... | def determine_file_type(fname):
"""
Detect file type.
The following file types are supported:
BED, narrowPeak, FASTA, list of chr:start-end regions
If the extension is bed, fa, fasta or narrowPeak, we will believe this
without checking!
Parameters
----------
fname : str
Fil... | [
"Detect",
"file",
"type",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L495-L562 | [
"def",
"determine_file_type",
"(",
"fname",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"fname",
",",
"str",
")",
"or",
"isinstance",
"(",
"fname",
",",
"unicode",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"{} is not a file name!\"",
",",
"fname",
")... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | get_seqs_type | automagically determine input type
the following types are detected:
- Fasta object
- FASTA file
- list of regions
- region file
- BED file | gimmemotifs/utils.py | def get_seqs_type(seqs):
"""
automagically determine input type
the following types are detected:
- Fasta object
- FASTA file
- list of regions
- region file
- BED file
"""
region_p = re.compile(r'^(.+):(\d+)-(\d+)$')
if isinstance(seqs, Fasta):
re... | def get_seqs_type(seqs):
"""
automagically determine input type
the following types are detected:
- Fasta object
- FASTA file
- list of regions
- region file
- BED file
"""
region_p = re.compile(r'^(.+):(\d+)-(\d+)$')
if isinstance(seqs, Fasta):
re... | [
"automagically",
"determine",
"input",
"type",
"the",
"following",
"types",
"are",
"detected",
":",
"-",
"Fasta",
"object",
"-",
"FASTA",
"file",
"-",
"list",
"of",
"regions",
"-",
"region",
"file",
"-",
"BED",
"file"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L565-L598 | [
"def",
"get_seqs_type",
"(",
"seqs",
")",
":",
"region_p",
"=",
"re",
".",
"compile",
"(",
"r'^(.+):(\\d+)-(\\d+)$'",
")",
"if",
"isinstance",
"(",
"seqs",
",",
"Fasta",
")",
":",
"return",
"\"fasta\"",
"elif",
"isinstance",
"(",
"seqs",
",",
"list",
")",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | file_checksum | Return md5 checksum of file.
Note: only works for files < 4GB.
Parameters
----------
filename : str
File used to calculate checksum.
Returns
-------
checkum : str | gimmemotifs/utils.py | def file_checksum(fname):
"""Return md5 checksum of file.
Note: only works for files < 4GB.
Parameters
----------
filename : str
File used to calculate checksum.
Returns
-------
checkum : str
"""
size = os.path.getsize(fname)
with open(fname, "r+") as f:
... | def file_checksum(fname):
"""Return md5 checksum of file.
Note: only works for files < 4GB.
Parameters
----------
filename : str
File used to calculate checksum.
Returns
-------
checkum : str
"""
size = os.path.getsize(fname)
with open(fname, "r+") as f:
... | [
"Return",
"md5",
"checksum",
"of",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L616-L633 | [
"def",
"file_checksum",
"(",
"fname",
")",
":",
"size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"fname",
")",
"with",
"open",
"(",
"fname",
",",
"\"r+\"",
")",
"as",
"f",
":",
"checksum",
"=",
"hashlib",
".",
"md5",
"(",
"mmap",
".",
"mmap",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | download_annotation | Download gene annotation from UCSC based on genomebuild.
Will check UCSC, Ensembl and RefSeq annotation.
Parameters
----------
genomebuild : str
UCSC genome name.
gene_file : str
Output file name. | gimmemotifs/genome_index.py | def download_annotation(genomebuild, gene_file):
"""
Download gene annotation from UCSC based on genomebuild.
Will check UCSC, Ensembl and RefSeq annotation.
Parameters
----------
genomebuild : str
UCSC genome name.
gene_file : str
Output file name.
"""
pred_bin = ... | def download_annotation(genomebuild, gene_file):
"""
Download gene annotation from UCSC based on genomebuild.
Will check UCSC, Ensembl and RefSeq annotation.
Parameters
----------
genomebuild : str
UCSC genome name.
gene_file : str
Output file name.
"""
pred_bin = ... | [
"Download",
"gene",
"annotation",
"from",
"UCSC",
"based",
"on",
"genomebuild",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L98-L157 | [
"def",
"download_annotation",
"(",
"genomebuild",
",",
"gene_file",
")",
":",
"pred_bin",
"=",
"\"genePredToBed\"",
"pred",
"=",
"find_executable",
"(",
"pred_bin",
")",
"if",
"not",
"pred",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"{} not found in path!\... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex._check_dir | Check if dir exists, if not: give warning and die | gimmemotifs/genome_index.py | def _check_dir(self, dirname):
""" Check if dir exists, if not: give warning and die"""
if not os.path.exists(dirname):
print("Directory %s does not exist!" % dirname)
sys.exit(1) | def _check_dir(self, dirname):
""" Check if dir exists, if not: give warning and die"""
if not os.path.exists(dirname):
print("Directory %s does not exist!" % dirname)
sys.exit(1) | [
"Check",
"if",
"dir",
"exists",
"if",
"not",
":",
"give",
"warning",
"and",
"die"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L278-L282 | [
"def",
"_check_dir",
"(",
"self",
",",
"dirname",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dirname",
")",
":",
"print",
"(",
"\"Directory %s does not exist!\"",
"%",
"dirname",
")",
"sys",
".",
"exit",
"(",
"1",
")"
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex._make_index | Index a single, one-sequence fasta-file | gimmemotifs/genome_index.py | def _make_index(self, fasta, index):
""" Index a single, one-sequence fasta-file"""
out = open(index, "wb")
f = open(fasta)
# Skip first line of fasta-file
line = f.readline()
offset = f.tell()
line = f.readline()
while line:
out.write(pack(sel... | def _make_index(self, fasta, index):
""" Index a single, one-sequence fasta-file"""
out = open(index, "wb")
f = open(fasta)
# Skip first line of fasta-file
line = f.readline()
offset = f.tell()
line = f.readline()
while line:
out.write(pack(sel... | [
"Index",
"a",
"single",
"one",
"-",
"sequence",
"fasta",
"-",
"file"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L284-L297 | [
"def",
"_make_index",
"(",
"self",
",",
"fasta",
",",
"index",
")",
":",
"out",
"=",
"open",
"(",
"index",
",",
"\"wb\"",
")",
"f",
"=",
"open",
"(",
"fasta",
")",
"# Skip first line of fasta-file",
"line",
"=",
"f",
".",
"readline",
"(",
")",
"offset"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex.create_index | Index all fasta-files in fasta_dir (one sequence per file!) and
store the results in index_dir | gimmemotifs/genome_index.py | def create_index(self,fasta_dir=None, index_dir=None):
"""Index all fasta-files in fasta_dir (one sequence per file!) and
store the results in index_dir"""
# Use default directories if they are not supplied
if not fasta_dir:
fasta_dir = self.fasta_dir
if not... | def create_index(self,fasta_dir=None, index_dir=None):
"""Index all fasta-files in fasta_dir (one sequence per file!) and
store the results in index_dir"""
# Use default directories if they are not supplied
if not fasta_dir:
fasta_dir = self.fasta_dir
if not... | [
"Index",
"all",
"fasta",
"-",
"files",
"in",
"fasta_dir",
"(",
"one",
"sequence",
"per",
"file!",
")",
"and",
"store",
"the",
"results",
"in",
"index_dir"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L299-L398 | [
"def",
"create_index",
"(",
"self",
",",
"fasta_dir",
"=",
"None",
",",
"index_dir",
"=",
"None",
")",
":",
"# Use default directories if they are not supplied",
"if",
"not",
"fasta_dir",
":",
"fasta_dir",
"=",
"self",
".",
"fasta_dir",
"if",
"not",
"index_dir",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex._read_index_file | read the param_file, index_dir should already be set | gimmemotifs/genome_index.py | def _read_index_file(self):
"""read the param_file, index_dir should already be set """
param_file = os.path.join(self.index_dir, self.param_file)
with open(param_file) as f:
for line in f.readlines():
(name, fasta_file, index_file, line_size, total_size) = line.strip... | def _read_index_file(self):
"""read the param_file, index_dir should already be set """
param_file = os.path.join(self.index_dir, self.param_file)
with open(param_file) as f:
for line in f.readlines():
(name, fasta_file, index_file, line_size, total_size) = line.strip... | [
"read",
"the",
"param_file",
"index_dir",
"should",
"already",
"be",
"set"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L400-L409 | [
"def",
"_read_index_file",
"(",
"self",
")",
":",
"param_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"index_dir",
",",
"self",
".",
"param_file",
")",
"with",
"open",
"(",
"param_file",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex._read_seq_from_fasta | retrieve a number of lines from a fasta file-object, starting at offset | gimmemotifs/genome_index.py | def _read_seq_from_fasta(self, fasta, offset, nr_lines):
""" retrieve a number of lines from a fasta file-object, starting at offset"""
fasta.seek(offset)
lines = [fasta.readline().strip() for _ in range(nr_lines)]
return "".join(lines) | def _read_seq_from_fasta(self, fasta, offset, nr_lines):
""" retrieve a number of lines from a fasta file-object, starting at offset"""
fasta.seek(offset)
lines = [fasta.readline().strip() for _ in range(nr_lines)]
return "".join(lines) | [
"retrieve",
"a",
"number",
"of",
"lines",
"from",
"a",
"fasta",
"file",
"-",
"object",
"starting",
"at",
"offset"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L411-L415 | [
"def",
"_read_seq_from_fasta",
"(",
"self",
",",
"fasta",
",",
"offset",
",",
"nr_lines",
")",
":",
"fasta",
".",
"seek",
"(",
"offset",
")",
"lines",
"=",
"[",
"fasta",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
"for",
"_",
"in",
"range",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex.get_sequences | Retrieve multiple sequences from same chr (RC not possible yet) | gimmemotifs/genome_index.py | def get_sequences(self, chr, coords):
""" Retrieve multiple sequences from same chr (RC not possible yet)"""
# Check if we have an index_dir
if not self.index_dir:
print("Index dir is not defined!")
sys.exit()
# retrieve all information for this specific sequ... | def get_sequences(self, chr, coords):
""" Retrieve multiple sequences from same chr (RC not possible yet)"""
# Check if we have an index_dir
if not self.index_dir:
print("Index dir is not defined!")
sys.exit()
# retrieve all information for this specific sequ... | [
"Retrieve",
"multiple",
"sequences",
"from",
"same",
"chr",
"(",
"RC",
"not",
"possible",
"yet",
")"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L461-L495 | [
"def",
"get_sequences",
"(",
"self",
",",
"chr",
",",
"coords",
")",
":",
"# Check if we have an index_dir",
"if",
"not",
"self",
".",
"index_dir",
":",
"print",
"(",
"\"Index dir is not defined!\"",
")",
"sys",
".",
"exit",
"(",
")",
"# retrieve all information f... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex.get_sequence | Retrieve a sequence | gimmemotifs/genome_index.py | def get_sequence(self, chrom, start, end, strand=None):
""" Retrieve a sequence """
# Check if we have an index_dir
if not self.index_dir:
print("Index dir is not defined!")
sys.exit()
# retrieve all information for this specific sequence
fasta_file =... | def get_sequence(self, chrom, start, end, strand=None):
""" Retrieve a sequence """
# Check if we have an index_dir
if not self.index_dir:
print("Index dir is not defined!")
sys.exit()
# retrieve all information for this specific sequence
fasta_file =... | [
"Retrieve",
"a",
"sequence"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L498-L532 | [
"def",
"get_sequence",
"(",
"self",
",",
"chrom",
",",
"start",
",",
"end",
",",
"strand",
"=",
"None",
")",
":",
"# Check if we have an index_dir",
"if",
"not",
"self",
".",
"index_dir",
":",
"print",
"(",
"\"Index dir is not defined!\"",
")",
"sys",
".",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | GenomeIndex.get_size | Return the sizes of all sequences in the index, or the size of chrom if specified
as an optional argument | gimmemotifs/genome_index.py | def get_size(self, chrom=None):
""" Return the sizes of all sequences in the index, or the size of chrom if specified
as an optional argument """
if len(self.size) == 0:
raise LookupError("no chromosomes in index, is the index correct?")
if chrom:
if chrom in sel... | def get_size(self, chrom=None):
""" Return the sizes of all sequences in the index, or the size of chrom if specified
as an optional argument """
if len(self.size) == 0:
raise LookupError("no chromosomes in index, is the index correct?")
if chrom:
if chrom in sel... | [
"Return",
"the",
"sizes",
"of",
"all",
"sequences",
"in",
"the",
"index",
"or",
"the",
"size",
"of",
"chrom",
"if",
"specified",
"as",
"an",
"optional",
"argument"
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L538-L553 | [
"def",
"get_size",
"(",
"self",
",",
"chrom",
"=",
"None",
")",
":",
"if",
"len",
"(",
"self",
".",
"size",
")",
"==",
"0",
":",
"raise",
"LookupError",
"(",
"\"no chromosomes in index, is the index correct?\"",
")",
"if",
"chrom",
":",
"if",
"chrom",
"in"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | get_tool | Returns an instance of a specific tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool : MotifProgram instance | gimmemotifs/tools.py | def get_tool(name):
"""
Returns an instance of a specific tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool : MotifProgram instance
"""
tool = name.lower()
if tool not in __tools__:
raise ValueError("Tool {0} n... | def get_tool(name):
"""
Returns an instance of a specific tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool : MotifProgram instance
"""
tool = name.lower()
if tool not in __tools__:
raise ValueError("Tool {0} n... | [
"Returns",
"an",
"instance",
"of",
"a",
"specific",
"tool",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L33-L58 | [
"def",
"get_tool",
"(",
"name",
")",
":",
"tool",
"=",
"name",
".",
"lower",
"(",
")",
"if",
"tool",
"not",
"in",
"__tools__",
":",
"raise",
"ValueError",
"(",
"\"Tool {0} not found!\\n\"",
".",
"format",
"(",
"name",
")",
")",
"t",
"=",
"__tools__",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | locate_tool | Returns the binary of a tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool_bin : str
Binary of tool. | gimmemotifs/tools.py | def locate_tool(name, verbose=True):
"""
Returns the binary of a tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool_bin : str
Binary of tool.
"""
m = get_tool(name)
tool_bin = which(m.cmd)
if tool_bin:
... | def locate_tool(name, verbose=True):
"""
Returns the binary of a tool.
Parameters
----------
name : str
Name of the tool (case-insensitive).
Returns
-------
tool_bin : str
Binary of tool.
"""
m = get_tool(name)
tool_bin = which(m.cmd)
if tool_bin:
... | [
"Returns",
"the",
"binary",
"of",
"a",
"tool",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L60-L81 | [
"def",
"locate_tool",
"(",
"name",
",",
"verbose",
"=",
"True",
")",
":",
"m",
"=",
"get_tool",
"(",
"name",
")",
"tool_bin",
"=",
"which",
"(",
"m",
".",
"cmd",
")",
"if",
"tool_bin",
":",
"if",
"verbose",
":",
"print",
"(",
"\"Found {} in {}\"",
".... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifProgram.bin | Get the command used to run the tool.
Returns
-------
command : str
The tool system command. | gimmemotifs/tools.py | def bin(self):
"""
Get the command used to run the tool.
Returns
-------
command : str
The tool system command.
"""
if self.local_bin:
return self.local_bin
else:
return self.config.bin(self.name) | def bin(self):
"""
Get the command used to run the tool.
Returns
-------
command : str
The tool system command.
"""
if self.local_bin:
return self.local_bin
else:
return self.config.bin(self.name) | [
"Get",
"the",
"command",
"used",
"to",
"run",
"the",
"tool",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L93-L105 | [
"def",
"bin",
"(",
"self",
")",
":",
"if",
"self",
".",
"local_bin",
":",
"return",
"self",
".",
"local_bin",
"else",
":",
"return",
"self",
".",
"config",
".",
"bin",
"(",
"self",
".",
"name",
")"
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifProgram.is_installed | Check if the tool is installed.
Returns
-------
is_installed : bool
True if the tool is installed. | gimmemotifs/tools.py | def is_installed(self):
"""
Check if the tool is installed.
Returns
-------
is_installed : bool
True if the tool is installed.
"""
return self.is_configured() and os.access(self.bin(), os.X_OK) | def is_installed(self):
"""
Check if the tool is installed.
Returns
-------
is_installed : bool
True if the tool is installed.
"""
return self.is_configured() and os.access(self.bin(), os.X_OK) | [
"Check",
"if",
"the",
"tool",
"is",
"installed",
".",
"Returns",
"-------",
"is_installed",
":",
"bool",
"True",
"if",
"the",
"tool",
"is",
"installed",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L129-L138 | [
"def",
"is_installed",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_configured",
"(",
")",
"and",
"os",
".",
"access",
"(",
"self",
".",
"bin",
"(",
")",
",",
"os",
".",
"X_OK",
")"
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifProgram.run | Run the tool and predict motifs from a FASTA file.
Parameters
----------
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required parameters
are passed using this dictionary.
t... | gimmemotifs/tools.py | def run(self, fastafile, params=None, tmp=None):
"""
Run the tool and predict motifs from a FASTA file.
Parameters
----------
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | def run(self, fastafile, params=None, tmp=None):
"""
Run the tool and predict motifs from a FASTA file.
Parameters
----------
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | [
"Run",
"the",
"tool",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L140-L179 | [
"def",
"run",
"(",
"self",
",",
"fastafile",
",",
"params",
"=",
"None",
",",
"tmp",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_configured",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"%s is not configured\"",
"%",
"self",
".",
"name",
")",... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | XXmotif._parse_params | Parse parameters.
Combine default and user-defined parameters. | gimmemotifs/tools.py | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background"]:
# Absolute path, just to be su... | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background"]:
# Absolute path, just to be su... | [
"Parse",
"parameters",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L203-L223 | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"if",
"prm",
"[",
"\"ba... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | XXmotif._run_program | Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | def _run_program(self, bin, fastafile, params=None):
"""
Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | [
"Run",
"XXmotif",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L225-L284 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"outfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"tmpdir",
",",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Homer._parse_params | Parse parameters.
Combine default and user-defined parameters. | gimmemotifs/tools.py | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
# Background file is essential!
if not prm["background"]... | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
# Background file is essential!
if not prm["background"]... | [
"Parse",
"parameters",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L305-L326 | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"# Background file is essenti... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Homer._run_program | Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required p... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | def _run_program(self, bin, fastafile, params=None):
"""
Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"Run",
"Homer",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L328-L387 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"outfile",
"=",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"w\"",
",",
"dir",
"=",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | BioProspector.parse | Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances.
"""
m... | def parse(self, fo):
"""
Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances.
"""
m... | [
"Convert",
"BioProspector",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"BioProspector",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L488-L524 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'^\\d+\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)'",
")",
"pwm",
"=",
"[",
"]",
"motif_id",
"=",
"\"\"",
"for",
"line",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Hms._run_program | Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required par... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | def _run_program(self, bin, fastafile, params=None):
"""
Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | [
"Run",
"HMS",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L575-L631 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"default_params",
"=",
"{",
"\"width\"",
":",
"10",
"}",
"if",
"params",
"is",
"not... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Hms.parse | Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
m... | def parse(self, fo):
"""
Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
m... | [
"Convert",
"HMS",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"HMS",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L633-L653 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"m",
"=",
"[",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"fo",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
"]",
"for",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Amd._run_program | Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required par... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | def _run_program(self, bin, fastafile, params=None):
"""
Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | [
"Run",
"AMD",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L688-L744 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"fgfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"tmpdir",
",",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Amd.parse | Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | def parse(self, fo):
"""
Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | [
"Convert",
"AMD",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"AMD",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L746-L781 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"#160: 112 CACGTGC 7.25 chr14:32308489-32308689",
"p",
"=",
"re",
".",
"compile",
"(",
"r'\\d+\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)'",
")",
"wm",
"=",
"[",
"]",
"name"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Improbizer.parse | Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs ... | def parse(self, fo):
"""
Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs ... | [
"Convert",
"Improbizer",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"Improbizer",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L873-L905 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'\\d+\\s+@\\s+\\d+\\.\\d+\\s+sd\\s+\\d+\\.\\d+\\s+(\\w+)$'",
")",
"line",
"=",
"fo",
".",
"readline",
"(",
")",
"while",
"line",
"and",
"line"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Trawler._run_program | Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | def _run_program(self, bin, fastafile, params=None):
"""
Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | [
"Run",
"Trawler",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L945-L1023 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"tmp",
"=",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"w\"",
",",
"dir",
"=",
"self... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Weeder._run_program | Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required ... | gimmemotifs/tools.py | def _run_program(self, bin,fastafile, params=None):
"""
Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | def _run_program(self, bin,fastafile, params=None):
"""
Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"Run",
"Weeder",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1055-L1137 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"organism",
"=",
"params",
"[",
"\"organism\"",
"]",
"weeder_organisms",
"=",
"{",
"\... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifSampler._parse_params | Parse parameters.
Combine default and user-defined parameters. | gimmemotifs/tools.py | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background_model"]:
# Absolute path, just to... | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background_model"]:
# Absolute path, just to... | [
"Parse",
"parameters",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1173-L1206 | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"if",
"prm",
"[",
"\"ba... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifSampler._run_program | Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools req... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : ... | def _run_program(self, bin, fastafile, params=None):
"""
Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : ... | [
"Run",
"MotifSampler",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1208-L1264 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"# TODO: test organism",
"#cmd = \"%s -f %s -b %s -m %s -w %s -n %s -o %s -s %s > /dev/null 2>&1\" % ... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifSampler.parse | Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
mot... | def parse(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
mot... | [
"Convert",
"MotifSampler",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MotifSampler",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1266-L1299 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"pwm",
"=",
"[",
"]",
"info",
"=",
"{",
"}",
"for",
"line",
"in",
"fo",
".",
"readlines",
"(",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"vals... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MotifSampler.parse_out | Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse_out(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | def parse_out(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | [
"Convert",
"MotifSampler",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MotifSampler",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1301-L1348 | [
"def",
"parse_out",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"pseudo",
"=",
"0.0",
"# Should be 1/sqrt(# of seqs)",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MDmodule._run_program | Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | def _run_program(self, bin, fastafile, params=None):
"""
Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | [
"Run",
"MDmodule",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1378-L1436 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"\"width\"",
":",
"10",
",",
"\"number\"",
":",
"10",
"}",
"if",
"params",
"is",
"not",
"None",
":",
"default_params",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | MDmodule.parse | Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []... | def parse(self, fo):
"""
Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []... | [
"Convert",
"MDmodule",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MDmodule",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1438-L1493 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"p",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\s+(\\... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | ChIPMunk._parse_params | Parse parameters.
Combine default and user-defined parameters. | gimmemotifs/tools.py | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
return prm | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
return prm | [
"Parse",
"parameters",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1509-L1519 | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"return",
"prm"
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | ChIPMunk._run_program | Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | def _run_program(self, bin, fastafile, params=None):
"""
Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | [
"Run",
"ChIPMunk",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1521-L1596 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"basename",
"=",
"\"munk_in.fa\"",
"new_file",
"=",
"os",
".",
"path",
".",
"join",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | ChIPMunk.parse | Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances.
"""
#KDIC|6.124... | def parse(self, fo):
"""
Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances.
"""
#KDIC|6.124... | [
"Convert",
"ChIPMunk",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"ChIPMunk",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1598-L1633 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"#KDIC|6.124756232026243",
"#A|517.9999999999999 42.99999999999999 345.99999999999994 25.999999999999996 602.9999999999999 155.99999999999997 2.9999999999999996 91.99999999999999",
"#C|5.999999999999999 4.999999999999999 2.9999999999999996 956.99... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Posmo._run_program | Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required p... | gimmemotifs/tools.py | def _run_program(self, bin, fastafile, params=None):
"""
Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | def _run_program(self, bin, fastafile, params=None):
"""
Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"Run",
"Posmo",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1664-L1729 | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"}",
"if",
"params",
"is",
"not",
"None",
":",
"default_params",
".",
"update",
"(",
"params",
")",
"width",
"=",
"param... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Posmo.parse | Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo, width, seed=None):
"""
Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | def parse(self, fo, width, seed=None):
"""
Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | [
"Convert",
"Posmo",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"Posmo",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1731-L1764 | [
"def",
"parse",
"(",
"self",
",",
"fo",
",",
"width",
",",
"seed",
"=",
"None",
")",
":",
"motifs",
"=",
"[",
"]",
"lines",
"=",
"[",
"fo",
".",
"readline",
"(",
")",
"for",
"x",
"in",
"range",
"(",
"6",
")",
"]",
"while",
"lines",
"[",
"0",
... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
train | Gadem.parse | Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances. | gimmemotifs/tools.py | def parse(self, fo):
"""
Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | def parse(self, fo):
"""
Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | [
"Convert",
"GADEM",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"GADEM",
"output",
"."
] | vanheeringen-lab/gimmemotifs | python | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1847-L1896 | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"lines",
"=",
"fo",
".",
"readlines",
"(",
")",
"fo... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.