Skip to content

Commit 090a8f1

Browse files
committed
Update Readme
1 parent 5d3fcd7 commit 090a8f1

1 file changed

Lines changed: 40 additions & 9 deletions

File tree

README.md

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ itself.
105105

106106
The `Mothur` class stores configuration options for how mothur is executed. These options include `mothur_path` to tell
107107
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.
110111

111112
The default for `mothur_path` is `mothur` which will only work if mothur is in your PATH environment variable.
112113
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
134135
raise child_exception_type(errno_num, err_msg)
135136
PermissionError: [Errno 13] Permission denied
136137

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
138139
line execution (minus the header that contains the mothur version and runtime information), and `2` displays all output
139140
including the commands being executed behind the scenes to enable the `current` keyword to work. The default option is
140141
`0`, with `1` being useful when you want to see the standard mothur output, and `2` being useful for debugging purposes.
141142

142143
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.:
146147

147148
m = Mothur(mothur_seed=12345)
148149

@@ -155,24 +156,37 @@ for the execution of that command, e.g.:
155156
m.help()
156157
m.mothur_seed = seed
157158

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`.
159162

160163
**Note:** When copying mothur objects it is important to then specify different logfiles for them otherwise they
161164
may attempt to use the same logfile. Additionally, if `suppress_logfile` is true, the logfile will be suppressed even
162165
if it has been given a name by the user.
163166

164167
The `supress_logfile` option is useful when you don't want the log files, such as when running in an Jupyter (nee
165168
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`.
167170

168171
**Note:** Currently, due to the way that mothur creates the logfiles, a logfile will always be created BUT it will be
169172
cleaned up upon successful execution if `suppress_logfile=True`. However, if mothur fails to successfully execute, i.e.
170173
execution hangs or is interrupted, the logfile will not be cleaned up. For relevant discussion of this behaviour in
171174
mothur see [here](https://github.com/mothur/mothur/issues/281) and [here](https://github.com/mothur/mothur/issues/377).
172175

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+
173187
You can also instantiate the `Mothur` object with your desired configuration options.
174188

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)
176190

177191
---
178192

@@ -245,6 +259,23 @@ This can be convenient for saving and loading the state of a mothur object to/fr
245259

246260
### Change Log
247261

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
278+
248279
#### *v0.3.1*
249280

250281
New features:

0 commit comments

Comments
 (0)