On 12/9/06, Kamran Haider <[EMAIL PROTECTED]> wrote: > > Hi > > I have got some python related queries. I am working on an MRes project > which involves a bit of programing in python. Actually, I am using a > python program developed by someone, which gives pairwise genetic > distances between a set of sequences (I don't know how...) and outputs a > simple text file of the following format... > > s1,s2,s3,s4,s5 > 4,7,2,3 > 8,6,4 > 3,6 > 7 > where s1, s2, s3...represent sequences and the second line describes > the pairwise distance between s1 and all other sequences,thid line is > for the distance between s2 and other sequences. > and so on. > 1. I want to read this line into a data structure(most probably by making a > list of lists like [[s1,s2,4],[s1,s2,7],[s1,s3,2] and so on) which gives > each pair and the corresponding pairwise distances. Of course, I would do > this by writing a function that reads this file into a data structure which > gives the all the pairs of sequences and theircorresponding distance values, > but I am not sure how to do this.
This is a weighted graph. see http://en.wikipedia.org/wiki/Glossary_of_graph_theory Here is a nice text written for Python: http://www.python.org/doc/essays/graphs.html Should go a long way to solve your second problem as well. Tor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor