Python scripts for analyzing networks of genetic relatedness in ant supercolonies
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Nov 11, 2015
MYLA_allSamples_Genotypes.txt Added data etc Apr 20, 2017
README Update README Apr 22, 2017
ants.py Added functionality; fixed bug in shuffling May 31, 2016
geocoords_all.csv Added data etc Apr 20, 2017
netext.py Initial commit for Python scripts Nov 16, 2015
pynet.py Initial commit for Python scripts Nov 16, 2015
transforms.py Added transforms.py May 31, 2016

README

# =============================================================================
#
#    Code & data for
#    Genetic structure of native ant supercolonies varies in space and time, 
#    Molecularar Ecology. 25, 6196-6213 (2016)
#
#    Please cite this paper if you publish something with our code or data. 
#    
#    author: Jari Saramaki, jari.saramaki@aalto.fi
#    v1.0
#
# ============================================================================

# Python modules:
# 	 ants.py - this is the main module for analysis 
#
#	 pynet.py - contains the network class used (pynet.SymmNet)
#	 netext.py - network-related functions
#	 transforms.py - functions that transform networks	 
#	 		
# In practice you should not need to touch anything besides ants.py	

# ====== USAGE EXAMPLE ==============================================
#
# (in e.g. ipython shell, or in a Jupyter Notebook)

# import ants
# alltypes=["eworker","queen","lateworker","malepupa","queenpupa","workerpupa"] # all ant types in data
# antdict=ants.load_relatedness_data(filename="MYLA_allSamples_Genotypes.txt",colonyfilter='MY')  # reads data for the MY supercolony
# net_workers_MY=ants.antnet(antdict,anttypes=["eworker"],reftypes=alltypes) # generates a network for early workers in MY, using early workers and queens for background relateness
# coords = ants.readcoords()
# rshuffle_workers_MY=ants.shuffled_rvalues_conserve(antdict,100,anttypes=["eworker"],reftypes=alltypes) # generates 100 reference nets between early workers with ants randomly shuffled between nests
# ants.plot_map_network_pvalue(net_workers_MY,coords,rshuffle_workers_MY,show='MY')

# ======= PYNET NETWORK FORMAT =======================================
#
# The object net (a pynet.Symmnet object) returns the relatedness between
# sites i and j as follows: net[i][j]
# Note that we add 1.0 to relatedness values because a relatedness of 0.0
# would be interpreted as missing link. So subtract 1.0 whenever necessary.