Back to index

python-biopython  1.60
Namespaces | Classes | Functions
Bio.PopGen.FDist Namespace Reference

Namespaces

namespace  Async
namespace  Controller
namespace  Utils

Classes

class  Record

Functions

def read

Function Documentation

def Bio.PopGen.FDist.read (   handle)
Parses FDist data into a Record object.

   handle is a file-like object that contains a FDist record.

Definition at line 24 of file __init__.py.

00024 
00025 def read(handle):
00026     """Parses FDist data into a Record object.
00027 
00028        handle is a file-like object that contains a FDist record.
00029     """
00030     record = Record()
00031     record.data_org = int(str(handle.next()).rstrip())
00032     record.num_pops = int(str(handle.next()).rstrip())
00033     record.num_loci = int(str(handle.next()).rstrip())
00034     for i in range(record.num_loci):
00035         handle.next()
00036         num_alleles = int(str(handle.next()).rstrip())
00037         pops_data = []
00038         if record.data_org==0:
00039             for j in range(record.num_pops):
00040                 line_comp = str(handle.next()).rstrip().split(' ')
00041                 pop_dist = map(lambda x: int(x), line_comp)
00042                 pops_data.append(pop_dist)
00043         else:
00044             raise NotImplementedError('1/alleles by rows not implemented')
00045         record.loci_data.append((num_alleles, pops_data))
00046     return record
00047