You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,8 +105,9 @@ itself.
105
105
106
106
The `Mothur` class stores configuration options for how mothur is executed. These options include `mothur_path` to tell
107
107
mothur-py where to find the mothur executable, `verbosity` to control how much output there is, `mothur_seed` to control
108
-
the seed used by mothur for random number generation, `logfile_name` to set the name of the mothur logfile, and
109
-
`suppress_logfile` which suppresses the creation of the mothur logfile.
108
+
the seed used by mothur for random number generation, `logfile_name` to set the name of the mothur logfile,
109
+
`suppress_logfile` which suppresses the creation of the mothur logfile, and `line_limit` which sets the limit on how
110
+
many lines of stdout will be printed.
110
111
111
112
The default for `mothur_path` is `mothur` which will only work if mothur is in your PATH environment variable.
112
113
If it is not then you will need to specify where to find the mothur executable, including the name of the executable
@@ -134,15 +135,15 @@ Failure to correctly configure the `mothur_path` will usually result in a Permis
134
135
raise child_exception_type(errno_num, err_msg)
135
136
PermissionError: [Errno 13] Permission denied
136
137
137
-
When `verbosity` is set to `0` there is no output printed, `1` prints the normal output as would be seen with command
138
+
When `verbosity` is set to `0`(default) there is no output printed, `1` prints the normal output as would be seen with command
138
139
line execution (minus the header that contains the mothur version and runtime information), and `2` displays all output
139
140
including the commands being executed behind the scenes to enable the `current` keyword to work. The default option is
140
141
`0`, with `1` being useful when you want to see the standard mothur output, and `2` being useful for debugging purposes.
141
142
142
143
If `mothur_seed` is set to a valid integer then this number will be passed to mothur to be used for random number
143
-
generation. This is implemented by adding the `seed=<your seed here>` named parameter to each mothur command. Not all
144
-
commands will accept having a seed set. For these commands you may need to set the `mothur_seed` parameter to `None`
145
-
for the execution of that command, e.g.:
144
+
generation. This is implemented by adding the `seed=<your seed here>` named parameter to each mothur command. By default
145
+
no seed is set (`mothur_seed=None`). Not all commands will accept having a seed set. For these commands you may need to
146
+
set the `mothur_seed` parameter to `None`for the execution of that command, e.g.:
146
147
147
148
m = Mothur(mothur_seed=12345)
148
149
@@ -155,24 +156,37 @@ for the execution of that command, e.g.:
155
156
m.help()
156
157
m.mothur_seed = seed
157
158
158
-
The `logfile_name` option allows the user to specify the name of the mothur generated logfile. The logfile will store the output from all mothur commands executed for the Mothur object it is configured for.
159
+
The `logfile_name` option allows the user to specify the name of the mothur generated logfile. The logfile will store
160
+
the output from all mothur commands executed for the Mothur object it is configured for. When set to `None` (default) a
161
+
random logfile name is generated for the mothur object in the format `mothur.py.<random_5_digit_number>.logfile`.
159
162
160
163
**Note:** When copying mothur objects it is important to then specify different logfiles for them otherwise they
161
164
may attempt to use the same logfile. Additionally, if `suppress_logfile` is true, the logfile will be suppressed even
162
165
if it has been given a name by the user.
163
166
164
167
The `supress_logfile` option is useful when you don't want the log files, such as when running in an Jupyter (nee
165
168
IPython) notebook with `verbosity=1`, in which case you already have a record of mothur's output and the mothur logfiles
166
-
are superfluous.
169
+
are superfluous. Default setting is `False`.
167
170
168
171
**Note:** Currently, due to the way that mothur creates the logfiles, a logfile will always be created BUT it will be
169
172
cleaned up upon successful execution if `suppress_logfile=True`. However, if mothur fails to successfully execute, i.e.
170
173
execution hangs or is interrupted, the logfile will not be cleaned up. For relevant discussion of this behaviour in
171
174
mothur see [here](https://github.com/mothur/mothur/issues/281) and [here](https://github.com/mothur/mothur/issues/377).
172
175
176
+
The `line_limit` option is useful when the full stdout is not wanted, or when printing it will be problematic, such as
177
+
when stdout is excessive and causes memory issues in the Jupyter (nee IPython) notebook environment. Setting `line_limit`
178
+
to `-1` (default) imposes no line limit, while any positive integer (or zero) imposes a line limit that causes stdout to no
179
+
longer be printed once the limit is reaches. If the line limit is reached then a warning is printed to notify the user.
180
+
181
+
**Note:** Only lines related to the user specified command count towards the line limit, therefore commands running
182
+
in the background (viewable with verbosity == 2) do not count towards this limit. Additionally, when verbosity == 2
183
+
the additional commands that enable the `current` keyword functionality that are executed after the users command are
184
+
still displayed, even if the line limit has been reached. Setting a line limit does not change what is printed to the
185
+
logfile.
186
+
173
187
You can also instantiate the `Mothur` object with your desired configuration options.
174
188
175
-
m = Mothur(verbosity=1, mothur_seed=543210, suppress_logfile=True)
189
+
m = Mothur(verbosity=1, mothur_seed=543210, suppress_logfile=True, line_limit=1000)
176
190
177
191
---
178
192
@@ -245,6 +259,23 @@ This can be convenient for saving and loading the state of a mothur object to/fr
245
259
246
260
### Change Log
247
261
262
+
#### *v0.4.0*
263
+
264
+
New features:
265
+
* Added a line limit configuration option to limit the amount of stdout printed to screen. Helps with potential memory
266
+
issues when outputting in Jupyter (nee IPython) notebook
267
+
268
+
Big fixes:
269
+
* Current files/dirs and output are now only set after successful execution to prevent them being changed when mothur
270
+
errors
271
+
272
+
Changes:
273
+
* Added lines of text specifying transition from user input functions from background functions enabling the current
274
+
keyword functionality when verbosity == 2
275
+
* For verbosity == 1, now does not print redundant warning/error text at the end of stdout
276
+
* Split utility functions out into their own file (`mothur_py.utils`)
277
+
* Refined `__str__` and `__repr__` for Mothur and MothurCommand
0 commit comments