コード例 #1
0
# * s = selection coefficient/effect size
# * label = The label assigned to a mutation.  These labels can be associated with Regions and Sregions.  Here, 1 is a mutation from the neutral region, 2 a selected mutation from the 'left' region and 3 a selected mutation from the 'right' regin.
#
# We can do all the usual subsetting, etc., using regular pandas tricks.  For example, let's get the neutral mutations for each population:

# In[6]:

nmuts = [i[i.neutral == True] for i in mutations2]
for i in nmuts:
    print(i.head())

# We can also take views of gametes:

# In[7]:

gametes = [fp.view_gametes(i) for i in pops]

# The format is really ugly. v Each gamete is a dict with two elements:
#
# * 'neutral' is a list of mutations _not_ affecting fitness.  The format is the same as for the mutation views above.
# * 'selected' is a list of mutations that _do_ affect fitness. The format is the same as for the mutation views above.

# In[8]:

for i in gametes:
    print(i[0])

# OK, let's clean that up.  We'll focus on the selected mutations for each individual, and turn everything into a pd.DataFrame.
#
# We're only going to do this for the first simulated population.
コード例 #2
0
ファイル: test_views.py プロジェクト: molpopgen/fwdpy
 def testNumGametes(self):
     gams = fwdpy.view_gametes(pops[0])
     nsingle=0
     for i in gams: nsingle += i['n']
     self.assertEqual(nsingle,2000)
コード例 #3
0
ファイル: views.py プロジェクト: molpopgen/fwdpy
# * label = The label assigned to a mutation.  These labels can be associated with Regions and Sregions.  Here, 1 is a mutation from the neutral region, 2 a selected mutation from the 'left' region and 3 a selected mutation from the 'right' regin.
# 
# We can do all the usual subsetting, etc., using regular pandas tricks.  For example, let's get the neutral mutations for each population:

# In[6]:

nmuts = [i[i.neutral == True] for i in mutations2]
for i in nmuts:
    print(i.head())


# We can also take views of gametes:

# In[7]:

gametes = [fp.view_gametes(i) for i in pops]


# The format is really ugly. v Each gamete is a dict with two elements:
# 
# * 'neutral' is a list of mutations _not_ affecting fitness.  The format is the same as for the mutation views above.
# * 'selected' is a list of mutations that _do_ affect fitness. The format is the same as for the mutation views above.

# In[8]:

for i in gametes:
    print(i[0])


# OK, let's clean that up.  We'll focus on the selected mutations for each individual, and turn everything into a pd.DataFrame.
# 
コード例 #4
0
 def testNumGametes(self):
     gams = fwdpy.view_gametes(pops[0])
     nsingle = 0
     for i in gams:
         nsingle += i['n']
     self.assertEqual(nsingle, 2000)