Re: [Biopython] Alternatives to Bio.Application for invoking command line tools?
Peter Cock <[email protected]> Tue, 12 May 2020 14:17:45 +0100
| Newsgroups | gmane.comp.python.bio.general |
|---|---|
| Message-ID | <CAKVJ-_5TDxfNGwURmBiCy1Rw4jkPQ9W=J7P55idNWv3ayA_K-A@mail.gmail.com> |
Thanks Stephane, If you mean you'd prefer to rely on the standard library (e.g. subprocess) over a third party dependency (like sh or plumbum or anything else), I understand that. We've been cautious about adding extra dependencies to Biopython, so it would have to be a compelling use case. The Biopython Tutorial already uses subprocess heavily for all our examples piping stdin/stdout. Working out how to do this can be tricky, so the examples help. Piping this way generally works fine, but when something fails (e.g. a malformed input), it becomes harder to debug than using temporary intermediate files. I don't yet see any reason to change those examples using subprocess. My point was subprocess does not help build up the command line - you must give it the command line string, or a list of arguments. Doing this "by hand" is fine for simple cases, and string templates or carefully constructed f-strings would cover most things elegantly. Peter P.S. I've opened an issue on GitHub as an easier long term way to track this discussion and any conclusions from it: https://github.com/biopython/biopython/issues/2877 On Mon, May 11, 2020 at 8:50 PM Stéphane Téletchéa < [email protected]> wrote: > Dear all, > > I was about to say the same, my preference for my own projects is always > to try to rely on upstream development as much as possible, so > subprocess it the recommandation. > > Concerning the pipes, isn't subprocess meant for that already? > > According to the doc (https://docs.python.org/3/library/subprocess.html) > and some answers in stack overflow > ( > https://stackoverflow.com/questions/13332268/how-to-use-subprocess-command-with-pipes), > > it should. > > Would you have some examples so we can try what is problematic (one/two > basic cases)? > > And yes, thanks for asking for comments :-) > > Stéphane > > Le 10/05/2020 à 19:09, Peter Cock a écrit : > > Yes, subprocess is very powerful but tricky. > > > > Sadly it doesn't help with giving a nice syntax for building command > > lines, which for me was the main thing our Bio.Application framework > > added. Perhaps someone else on the list will have a good suggestion. > > > > Peter > > -- > Assistant Professor, UFIP, UMR 6286 CNRS, Team Protein Design In Silico > UFR Sciences et Techniques, 2, rue de la Houssinière, Bât. 25, 44322 > Nantes cedex 03, France > Tél : +33 251 125 636 / Fax : +33 251 125 632 > http://www.ufip.univ-nantes.fr/ - http://www.steletch.org > > _______________________________________________ > Biopython mailing list - [email protected] > https://mailman.open-bio.org/mailman/listinfo/biopython _______________________________________________ Biopython mailing list - [email protected] https://mailman.open-bio.org/mailman/listinfo/biopython