pydigree.sgs package

Submodules

pydigree.sgs.sgs module

class pydigree.sgs.sgs.SGS(ind1, ind2, segments=None)

Bases: object

append(value)
extend(value)
ibd_state(locus, location_type='index')

locus: a 2-tuple in the form (chromosome, position) location_type: the type of location units specified. Valid entries are ‘index’ (the index of the markers), and ‘physical’ (positions in bp)

class pydigree.sgs.sgs.SGSAnalysis(pairs=None)

Bases: object

chromwide_ibd(chromidx, size=None, onlywithin=False, onlybetween=False)
static direct_to_disk(filename, pop, seed_size=500, min_length=1, size_unit='mb', min_density=100, maxmiss=0.25, onlywithin=False, njobs=1)
ibd_matrix(individuals, locus, location_type='index', onlywithin=False)

Creates an IBD matrix for a set of individuals at a locus

Parameters:
  • individuals (iterable) – individuals to form the matrix for
  • locus (2-tuple) – location to form the matrix on
  • location_type – the type of location units specified. Valid entries are ‘index’ (the index of the markers), ‘physical’ (the positions in bp), and ‘genetic’ (location in cM)
Returns:

IBD matrix

Return type:

scipy.sparse.lil_matrix

ibd_state(ind1, ind2, locus, location_type='index', onlywithin=False)

Gets the IBD state between two individuals at a locus

locus: a 2-tuple in the form (chromosome, position) location_type: the type of location units specified. Valid entries are ‘index’ (the index of the markers), and ‘physical’ (the positions in bp)

Returns 0 in the case of ind1 and ind2 not having any identified segments (or not being in the analysis at all)

individuals

Returns a set of all individuals present in the analysis

merge(other)

Merge two SGSAnalysis objects

segments

Returns an iterable of all the segments in the Analysis

update_segment_references(pedigrees)

Replace individual labels in the Segment objects of SGSAnalyses read from text with references to the actual individual object

class pydigree.sgs.sgs.Segment(ind1, ind2, chromosome, startidx, stopidx, physical_location=None)

Bases: object

chromosome
contains(locus, location_type='index')
ind1
ind2
marker_labels
missing
missing_rate

The number of missing genotypes in the segment

nmark

The number of markers in the segment

physical_location
physical_size

The size of the segmend in base pairs

start
stop
to_germline()
pydigree.sgs.sgs.filter_segments(chromosome, intervals, identical, min_length=1.0, min_density=100, size_unit='mb', maxmiss=0.25)

Perform quality control filtering on SGS results

pydigree.sgs.sgs.intervals_to_array(intervals, nmark)
pydigree.sgs.sgs.join_gaps(seq, max_gap=1)
pydigree.sgs.sgs.make_intervals(ibdarray)
pydigree.sgs.sgs.sgs_autozygous(ind, chromosome_idx, seed_size=500, min_length=1, size_unit='mb', min_density=100, maxmiss=0.25)
pydigree.sgs.sgs.sgs_population(pop, seed_size=500, min_length=1, size_unit='mb', min_density=100, maxmiss=0.25, onlywithin=False, njobs=1)

Performs SGS between all individuals in a population or pedigree

pydigree.sgs.sgs.sgs_unphased(ind1, ind2, chromosome_idx, seed_size=255, min_length=1, size_unit='mb', min_density=100, maxmiss=0.25, array=False)

Returns IBD states for each marker along a chromosome

Module contents