From p.j.a.cock at googlemail.com Tue Jan 13 05:20:55 2015 From: p.j.a.cock at googlemail.com (Peter Cock) Date: Tue, 13 Jan 2015 05:20:55 +0000 Subject: [Biopython-dev] Introducing setup tools for building wheels In-Reply-To: References: Message-ID: On Mon, Dec 15, 2014 at 9:01 AM, Peter Cock wrote: > On Fri, Dec 12, 2014 at 12:01 PM, Schmitt Uwe (ID SIS) > wrote: >> >> >> Am 12.12.14 12:29 schrieb "Peter Cock" unter : >> >>>On Fri, Dec 12, 2014 at 11:14 AM, Schmitt Uwe (ID SIS) >>> wrote: >>>> Dear all, >> >>>> >>>>... >> >>>> I modified BioPythons setup.py locally so that it uses >>>> setuptools instead of distutils. This enables the creation >>>> of Python wheels which I prefer especially on Windows: >>>> wheels can be installed in virtualenvs which is not >>>> possible with the existing Windows installer. >>>> >>>> Is there some discussion about this ? I might contribute >>>> a pull request for my modifications. >>> >>>Oh not the Python packaging rabbit hole :( >>> >>>If you can modify setup.py to use setuptools WITHOUT >>>requiring it, so we don't need people to have setuptools >>>in order to install Biopython from source, that seems >>>worthwhile. >> >> I can try to implement a fallback to distutils if >> setuptools is not found. >> >> My changes are not yet in a separate branch, I just >> tested some modifications and was able to create a Windows >> wheel for a colleague. Before I wanted to check if >> my changes break anything or have some other unwanted >> consequences I wanted to ask here as I did now. >> >> So I will prepare a pull request, >> >> Regards, Uwe > > Uwe's pull request: > https://github.com/biopython/biopython/pull/446 > > Can people have a look at that please, and try it out with a > few different setups (e.g. virtualenv). > > Thanks, > > Peter Now that Biopython 1.65 is out, shall we apply Uwe's pull request and see if anything breaks? Any objections? Thanks, Peter From marco at ebi.ac.uk Tue Jan 13 14:53:26 2015 From: marco at ebi.ac.uk (Marco Galardini) Date: Tue, 13 Jan 2015 14:53:26 +0000 Subject: [Biopython-dev] Bio.motifs.parse fails on meme files with version 4.10 Message-ID: <54B53166.402@ebi.ac.uk> Hi biopythoneers, just noticed that the current meme version (4.10.0_2) introduced a change in its output file that breaks the biopython parser. The error is: >>>from Bio import motifs >>>motifs.read(open('meme.txt'), 'meme') Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line 141, in read motifs = parse(handle, format) File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line 77, in parse record = meme.read(handle) File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line 41, in read length, num_occurrences, evalue = __read_motif_statistics(line) File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line 219, in __read_motif_statistics length = int(ls[3]) ValueError: invalid literal for int() with base 10: '=' Relevant line before: MOTIF 1 width = 19 sites = 3 llr = 43 E-value = 6.9e-002 Relevant line now: MOTIF 1 MEME width = 19 sites = 3 llr = 43 E-value = 6.9e-002 A possible ugly workaround would be to change the way this line is parsed (doing splits on 'width' and the other parameters). If you like I can try to implement the fix myself and a couple of tests, just let me know. Marco -- Marco Galardini Postdoctoral Fellow EMBL-EBI - European Bioinformatics Institute Wellcome Trust Genome Campus Hinxton, Cambridge CB10 1SD, UK Phone: +44 (0)1223 49 2547 From p.j.a.cock at googlemail.com Tue Jan 13 15:25:14 2015 From: p.j.a.cock at googlemail.com (Peter Cock) Date: Tue, 13 Jan 2015 15:25:14 +0000 Subject: [Biopython-dev] Bio.motifs.parse fails on meme files with version 4.10 In-Reply-To: <54B53166.402@ebi.ac.uk> References: <54B53166.402@ebi.ac.uk> Message-ID: Thanks Marco, I'll let Michael answer on the best way to fix this, but if you have some small failing examples already which could be shared for use as Biopython test cases that would be great. Are you familiar with GitHub? We now use that for our issue tracker, and while it does not directly support attaching files to issues, you can post text files to GitHub as "gists": https://github.com/biopython/biopython/issues https://gist.github.com Thanks, Peter On Tue, Jan 13, 2015 at 2:53 PM, Marco Galardini wrote: > Hi biopythoneers, > > just noticed that the current meme version (4.10.0_2) introduced a change in > its output file that breaks the biopython parser. > > The error is: >>>>from Bio import motifs >>>>motifs.read(open('meme.txt'), 'meme') > Traceback (most recent call last): > File "", line 1, in > File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line > 141, in read > motifs = parse(handle, format) > File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line > 77, in parse > record = meme.read(handle) > File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line 41, > in read > length, num_occurrences, evalue = __read_motif_statistics(line) > File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line > 219, in __read_motif_statistics > length = int(ls[3]) > ValueError: invalid literal for int() with base 10: '=' > > Relevant line before: > MOTIF 1 width = 19 sites = 3 llr = 43 E-value = 6.9e-002 > Relevant line now: > MOTIF 1 MEME width = 19 sites = 3 llr = 43 E-value = 6.9e-002 > > A possible ugly workaround would be to change the way this line is parsed > (doing splits on 'width' and the other parameters). If you like I can try to > implement the fix myself and a couple of tests, just let me know. > > Marco > > -- > Marco Galardini > Postdoctoral Fellow > EMBL-EBI - European Bioinformatics Institute > Wellcome Trust Genome Campus > Hinxton, Cambridge CB10 1SD, UK > Phone: +44 (0)1223 49 2547 > > _______________________________________________ > Biopython-dev mailing list > Biopython-dev at mailman.open-bio.org > http://mailman.open-bio.org/mailman/listinfo/biopython-dev From marco at ebi.ac.uk Tue Jan 13 15:29:41 2015 From: marco at ebi.ac.uk (Marco Galardini) Date: Tue, 13 Jan 2015 15:29:41 +0000 Subject: [Biopython-dev] Bio.motifs.parse fails on meme files with version 4.10 In-Reply-To: References: <54B53166.402@ebi.ac.uk> Message-ID: <54B539E5.2090307@ebi.ac.uk> Thanks Peter, I'll open an issue and post a couple of examples as soon as I can, thank you. Marco On 13/01/15 15:25, Peter Cock wrote: > Thanks Marco, > > I'll let Michael answer on the best way to fix this, but if you > have some small failing examples already which could be > shared for use as Biopython test cases that would be great. > > Are you familiar with GitHub? We now use that for our issue > tracker, and while it does not directly support attaching > files to issues, you can post text files to GitHub as "gists": > > https://github.com/biopython/biopython/issues > https://gist.github.com > > Thanks, > > Peter > > On Tue, Jan 13, 2015 at 2:53 PM, Marco Galardini wrote: >> Hi biopythoneers, >> >> just noticed that the current meme version (4.10.0_2) introduced a change in >> its output file that breaks the biopython parser. >> >> The error is: >>>> >from Bio import motifs >>>>> motifs.read(open('meme.txt'), 'meme') >> Traceback (most recent call last): >> File "", line 1, in >> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line >> 141, in read >> motifs = parse(handle, format) >> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", line >> 77, in parse >> record = meme.read(handle) >> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line 41, >> in read >> length, num_occurrences, evalue = __read_motif_statistics(line) >> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line >> 219, in __read_motif_statistics >> length = int(ls[3]) >> ValueError: invalid literal for int() with base 10: '=' >> >> Relevant line before: >> MOTIF 1 width = 19 sites = 3 llr = 43 E-value = 6.9e-002 >> Relevant line now: >> MOTIF 1 MEME width = 19 sites = 3 llr = 43 E-value = 6.9e-002 >> >> A possible ugly workaround would be to change the way this line is parsed >> (doing splits on 'width' and the other parameters). If you like I can try to >> implement the fix myself and a couple of tests, just let me know. >> >> Marco >> >> -- >> Marco Galardini >> Postdoctoral Fellow >> EMBL-EBI - European Bioinformatics Institute >> Wellcome Trust Genome Campus >> Hinxton, Cambridge CB10 1SD, UK >> Phone: +44 (0)1223 49 2547 >> >> _______________________________________________ >> Biopython-dev mailing list >> Biopython-dev at mailman.open-bio.org >> http://mailman.open-bio.org/mailman/listinfo/biopython-dev -- Marco Galardini Postdoctoral Fellow EMBL-EBI - European Bioinformatics Institute Wellcome Trust Genome Campus Hinxton, Cambridge CB10 1SD, UK Phone: +44 (0)1223 49 2547 From p.j.a.cock at googlemail.com Wed Jan 14 00:59:55 2015 From: p.j.a.cock at googlemail.com (Peter Cock) Date: Wed, 14 Jan 2015 00:59:55 +0000 Subject: [Biopython-dev] Bio.motifs.parse fails on meme files with version 4.10 In-Reply-To: <54B539E5.2090307@ebi.ac.uk> References: <54B53166.402@ebi.ac.uk> <54B539E5.2090307@ebi.ac.uk> Message-ID: Thanks: https://github.com/biopython/biopython/issues/461 Peter On Tue, Jan 13, 2015 at 3:29 PM, Marco Galardini wrote: > Thanks Peter, > > I'll open an issue and post a couple of examples as soon as I can, thank > you. > > Marco > > > On 13/01/15 15:25, Peter Cock wrote: >> >> Thanks Marco, >> >> I'll let Michael answer on the best way to fix this, but if you >> have some small failing examples already which could be >> shared for use as Biopython test cases that would be great. >> >> Are you familiar with GitHub? We now use that for our issue >> tracker, and while it does not directly support attaching >> files to issues, you can post text files to GitHub as "gists": >> >> https://github.com/biopython/biopython/issues >> https://gist.github.com >> >> Thanks, >> >> Peter >> >> On Tue, Jan 13, 2015 at 2:53 PM, Marco Galardini wrote: >>> >>> Hi biopythoneers, >>> >>> just noticed that the current meme version (4.10.0_2) introduced a change >>> in >>> its output file that breaks the biopython parser. >>> >>> The error is: >>>>> >>>>> >from Bio import motifs >>>>>> >>>>>> motifs.read(open('meme.txt'), 'meme') >>> >>> Traceback (most recent call last): >>> File "", line 1, in >>> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", >>> line >>> 141, in read >>> motifs = parse(handle, format) >>> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/__init__.py", >>> line >>> 77, in parse >>> record = meme.read(handle) >>> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line >>> 41, >>> in read >>> length, num_occurrences, evalue = __read_motif_statistics(line) >>> File "/usr/local/lib/python2.7/dist-packages/Bio/motifs/meme.py", line >>> 219, in __read_motif_statistics >>> length = int(ls[3]) >>> ValueError: invalid literal for int() with base 10: '=' >>> >>> Relevant line before: >>> MOTIF 1 width = 19 sites = 3 llr = 43 E-value = 6.9e-002 >>> Relevant line now: >>> MOTIF 1 MEME width = 19 sites = 3 llr = 43 E-value = 6.9e-002 >>> >>> A possible ugly workaround would be to change the way this line is parsed >>> (doing splits on 'width' and the other parameters). If you like I can try >>> to >>> implement the fix myself and a couple of tests, just let me know. >>> >>> Marco >>> >>> -- >>> Marco Galardini >>> Postdoctoral Fellow >>> EMBL-EBI - European Bioinformatics Institute >>> Wellcome Trust Genome Campus >>> Hinxton, Cambridge CB10 1SD, UK >>> Phone: +44 (0)1223 49 2547 >>> >>> _______________________________________________ >>> Biopython-dev mailing list >>> Biopython-dev at mailman.open-bio.org >>> http://mailman.open-bio.org/mailman/listinfo/biopython-dev > > > -- > Marco Galardini > Postdoctoral Fellow > EMBL-EBI - European Bioinformatics Institute > Wellcome Trust Genome Campus > Hinxton, Cambridge CB10 1SD, UK > Phone: +44 (0)1223 49 2547 > > _______________________________________________ > Biopython-dev mailing list > Biopython-dev at mailman.open-bio.org > http://mailman.open-bio.org/mailman/listinfo/biopython-dev From eric.talevich at gmail.com Fri Jan 30 06:07:26 2015 From: eric.talevich at gmail.com (Eric Talevich) Date: Thu, 29 Jan 2015 22:07:26 -0800 Subject: [Biopython-dev] [Biopython] Phylo.draw_graphviz(tree) not showing node names In-Reply-To: References: Message-ID: Hmm, I don't have access to a Mac so I'm not going to be able to fix this one myself. Can anyone else take a shot at fixing this bug? Jan? On Tue, Jan 27, 2015 at 7:48 AM, Jan Zaucha wrote: > Hi Eric, > > This is brilliant, the problem is solved on the linux, and I'm totally > happy with that (as can get on with my work :) ), but please be advised > that this seems to have created some issue the matplotlib mac OSX backend > doesn't like: > > on mac OSX pylab.show() yields: > > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/artist.pyc > in draw_wrapper(artist, renderer, *args, **kwargs) > 57 def draw_wrapper(artist, renderer, *args, **kwargs): > 58 before(artist, renderer) > ---> 59 draw(artist, renderer, *args, **kwargs) > 60 after(artist, renderer) > 61 > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/figure.pyc > in draw(self, renderer) > 1077 dsu.sort(key=itemgetter(0)) > 1078 for zorder, a, func, args in dsu: > -> 1079 func(*args) > 1080 > 1081 renderer.close_group('figure') > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/artist.pyc > in draw_wrapper(artist, renderer, *args, **kwargs) > 57 def draw_wrapper(artist, renderer, *args, **kwargs): > 58 before(artist, renderer) > ---> 59 draw(artist, renderer, *args, **kwargs) > 60 after(artist, renderer) > 61 > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/axes/_base.pyc > in draw(self, renderer, inframe) > 2090 > 2091 for zorder, a in dsu: > -> 2092 a.draw(renderer) > 2093 > 2094 renderer.close_group('axes') > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/artist.pyc > in draw_wrapper(artist, renderer, *args, **kwargs) > 57 def draw_wrapper(artist, renderer, *args, **kwargs): > 58 before(artist, renderer) > ---> 59 draw(artist, renderer, *args, **kwargs) > 60 after(artist, renderer) > 61 > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/text.pyc > in draw(self, renderer) > 536 renderer.open_group('text', self.get_gid()) > 537 > --> 538 bbox, info, descent = self._get_layout(renderer) > 539 trans = self.get_transform() > 540 > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/text.pyc > in _get_layout(self, renderer) > 309 tmp, lp_h, lp_bl = > renderer.get_text_width_height_descent('lp', > 310 > self._fontproperties, > --> 311 > ismath=False) > 312 offsety = (lp_h - lp_bl) * self._linespacing > 313 > > /Users/janzaucha/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.pyc > in get_text_width_height_descent(self, s, prop, ismath) > 164 size = self.points_to_pixels(points) > 165 width, height, descent = > self.gc.get_text_width_height_descent( > --> 166 six.text_type(s), family, size, weight, style) > 167 return width, height, 0.0*descent > 168 > > Best wishes, > Jan Zaucha > > On 26 January 2015 at 21:06, Eric Talevich > wrote: > >> Thanks, Jan, that was helpful for debugging. I pushed a fix to GitHub, so >> if you can install the development version of Biopython, it should work for >> you now. >> >> The problem was a bug in networkx release 1.9.1 (and maybe others) that >> existed between August 2013 and September 2014. The networkx "draw" >> function would pass all keywords to "draw_networkx", except that while >> "draw_networkx" has a keywords argument "with_labels" that defaults to >> True, "draw" would override this to "False" unless it had been specified >> explicitly. It has since been fixed in networkx and should be included in >> the next release: >> >> https://github.com/networkx/networkx/blame/master/networkx/drawing/nx_pylab.py >> >> >> On Mon, Jan 26, 2015 at 2:41 AM, Jan Zaucha >> wrote: >> >>> Thanks Eric, >>> >>> I'm using biopython 1.65 and networkx 1.9.1. >>> >>> When I ran the commands you've proposed I still see the node names >>> assigned: >>> [Clade(branch_length=2.0, name='foo'), Clade(branch_length=4.0, >>> name='bar), Clade(...), ... ] >>> >>> I'm not sure what the source file format is, I created the tree myself >>> from a distance matrix, the examples I was looking at were importing trees >>> from PhyloXML. Here's the code I'm running, maybe this will help: >>> >>> ###################### testing graphviz >>> from Bio import Phylo >>> from Bio.Phylo.TreeConstruction import _DistanceMatrix >>> from Bio.Phylo.TreeConstruction import DistanceTreeConstructor >>> import pylab >>> >>> names = ['foo', 'bar', 'cat', 'dog'] >>> matrix = [[0], [1, 0], [2, 3, 0], [4, 5, 6, 0]] >>> m = _DistanceMatrix(names, matrix) >>> constructor = DistanceTreeConstructor() >>> tree = constructor.nj(m) >>> graph = Phylo.to_networkx(tree) >>> print graph.nodes() >>> Phylo.draw_graphviz(tree, prog="neato", node_size=50) >>> pylab.show() >>> ########################## >>> >>> >>> I still don't understand where I'm going wrong. >>> >>> Best wishes, >>> Jan >>> >>> >>> On 23 January 2015 at 16:33, Eric Talevich >>> wrote: >>> >>>> Hi Jan, >>>> >>>> Could you show us some more information about your tree, like the first >>>> few lines you see with "print tree"? Also try converting the tree to a >>>> NetworkX graph, which is the intermediate form used by draw_graphviz, and >>>> inspecting the nodes to see if names were lost or retained: >>>> >>>> graph = Phylo.to_networkx(tree) >>>> graph.nodes() >>>> >>>> Also: >>>> >>>> - What was the source file format (e.g. Newick, Nexus, PhyloXML, NeXML) >>>> - Which versions of Biopython and NetworkX are you using? >>>> >>>> It's possible the node names are assigned to a different attribute than >>>> the node name, in which case you can use the "label_func" argument in >>>> draw_graphviz to retrieve the name from the graph node. >>>> >>>> Hope that helps, >>>> Eric >>>> >>>> >>>> >>>> On Thu, Jan 22, 2015 at 8:02 AM, Jan Zaucha >>>> wrote: >>>> >>>>> Hi everyone, >>>>> >>>>> I'm trying to visualize the trees I generate, but for some reason the >>>>> plots do not display the node names. When I print the tree each node has an >>>>> associated name (string format). Phylo.draw(tree) also works fine and plots >>>>> a tree with the node names. >>>>> >>>>> I simply use: >>>>> Phylo.draw_graphviz(tree) >>>>> pylab.show() >>>>> >>>>> There is no error, I can't work out how to force the node names to be >>>>> printed. >>>>> >>>>> Any ideas? >>>>> >>>>> Thanks, >>>>> Jan Zaucha >>>>> >>>>> -- >>>>> Jan Zaucha >>>>> Bristol Centre for Complexity Sciences >>>>> Computational Genomics Group >>>>> University of Bristol >>>>> >>>>> _______________________________________________ >>>>> Biopython mailing list - Biopython at mailman.open-bio.org >>>>> http://mailman.open-bio.org/mailman/listinfo/biopython >>>>> >>>> >>>> >>> >>> >>> -- >>> Jan Zaucha >>> Bristol Centre for Complexity Sciences >>> Computational Genomics Group >>> University of Bristol >>> >> >> > > > -- > Jan Zaucha > Bristol Centre for Complexity Sciences > Computational Genomics Group > University of Bristol > -------------- next part -------------- An HTML attachment was scrubbed... URL: