[Bioc-devel] topGO and cat() and print() statements in program code

Morgan, Martin Martin.Morgan at roswellpark.org
Fri Feb 5 12:47:32 CET 2016


I followed your lead and updated topGO in Bioc devel branch to version 2.23.3, replacing cat() with message() directly rather a wrapper .cat2message(). I did not change use of cat() in print() and show() methods, where output to stdout is appropriate.

Generally, using message() simplified code, replacing multiple calls to cat() and nested paste() statements with a single call to message().

Martin

________________________________________
From: Bioc-devel <bioc-devel-bounces at r-project.org> on behalf of Witold E Wolski <wewolski at gmail.com>
Sent: Friday, February 5, 2016 5:50 AM
To: Dan Tenenbaum; henrik.bengtsson at gmail.com
Cc: bioc-devel; James W. MacDonald
Subject: Re: [Bioc-devel] topGO and cat() and print() statements in program     code

I did replace the call to cat in topGO with with a call to a package
private .cat2message function (which makes some adjustments to the
passed arguments so that the messages look as before). The patched
package is available from here.
https://github.com/wolski/topGO
Upstream commits made on 3 February by h.bengtsson are merged.
AFAIK all is working OK (checks pass and my code using topGO is still working)


Witold






On 4 February 2016 at 11:56, Witold E Wolski <wewolski at gmail.com> wrote:
> Hi Dan,
>
> Excellent suggestion. This is very similar to how I am plan to do the
> refactoring. Write a function cat2message which has a signature like
> cat but uses message in the implementation and than replace all calls
> to cat in the topGO package.
>
> best
>
> On 4 February 2016 at 00:56, Dan Tenenbaum <dtenenba at fredhutch.org> wrote:
>> Another dirty hack is to redefine cat() in your own code to do nothing:
>>
>> cat <- function(....) {}
>>
>> Dan
>>
>>
>> ----- Original Message -----
>>> From: "James W. MacDonald" <jmacdon at uw.edu>
>>> To: "Witold E Wolski" <wewolski at gmail.com>
>>> Cc: "bioc-devel" <bioc-devel at r-project.org>
>>> Sent: Tuesday, February 2, 2016 6:50:21 AM
>>> Subject: Re: [Bioc-devel] topGO and cat() and print() statements in program   code
>>
>>> I can't speak to the issue of changing somebody else's code without forking
>>> (which you are free to do), or getting their OK. But do note that there are
>>> usually ways around this. First, you can use include = FALSE in your chunk
>>> options statement, which will run all the code, but silence everything.
>>> This isn't a good use case if you need to print, but that can usually be
>>> split out. Something like
>>>
>>> ```r{noisypart, include = FALSE}
>>>
>>> noisy code goes here
>>>
>>> ```
>>>
>>> ```r{quietpart, echo = FALSE, fig.cap = ""}
>>>
>>> plots go here
>>>
>>> ```
>>>
>>> An alternative is to use GOstats, which may be less noisy, but which still
>>> has 18 calls to cat() (vs 121 for topGO) and 2 calls to print() (vs 29 for
>>> topGO).
>>>
>>> Best,
>>>
>>> Jim
>>>
>>>
>>>
>>> On Tue, Feb 2, 2016 at 5:19 AM, Witold E Wolski <wewolski at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am using the very usefull package topGO to generate a report (R
>>>> markdown). There is not much to complain about topGO (on the contrary)
>>>> except that the package uses cat instead of message to display
>>>> progress information. which ruins the report.
>>>>
>>>> Also the bioconductor package guidelines state:
>>>> cat() or print() are used only when displaying an object to the user,
>>>> e.g., in a show method.
>>>>
>>>> This makes it difficult to integrate topGO.
>>>>
>>>> I did contact the maintainer asking to update topGO. However I did not
>>>> get an reply. It seems that the maintainer is occupied with other
>>>> problems. I did offer to replace the cat with message for these
>>>> functions I am using myself. No reply.
>>>>
>>>> So what I am wondering is... If I do the corrections, and would like
>>>> to commit the code... Sure I could create a branch but since I do not
>>>> have write access to svn no chance to push (commit) it for review.
>>>> And who is going to review it if the maintainer does not have time?
>>>>
>>>> best
>>>> Witold
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Witold Eryk Wolski
>>>>
>>>> _______________________________________________
>>>> Bioc-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>>
>>>
>>>
>>>
>>> --
>>> James W. MacDonald, M.S.
>>> Biostatistician
>>> University of Washington
>>> Environmental and Occupational Health Sciences
>>> 4225 Roosevelt Way NE, # 100
>>> Seattle WA 98105-6099
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>
>
> --
> Witold Eryk Wolski



--
Witold Eryk Wolski

_______________________________________________
Bioc-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.


More information about the Bioc-devel mailing list