mkCoocurNetwork: Converting a given network into a co-occurrence network

View source: R/func__geoTempAnalyser__mkCoocurNetwork.R

mkCoocurNetworkR Documentation

Converting a given network into a co-occurrence network

Description

Converting a given network into a co-occurrence network

Usage

mkCoocurNetwork(
  alleles = NULL,
  net = NULL,
  pam = NULL,
  sam = NULL,
  name.col = 1,
  years = 0,
  ds = NULL,
  use.ingroup.d = FALSE
)

Arguments

alleles

A vector of alleles for which pairwise co-occurrence counts will be calculated.

net

A Graph object defining a network whose edge weights will be replaced with co-occurrence counts. The argument "alleles" overrides this argument. When alleles = NULL and net != NULL, the net will be converted into a co-occurrence network while no edges will be added to it. To define the object "net", the first two columns of the edge attribute must be node names. Edge attributes must include "d_min" and "d_max" for the ingroup distances when the parameter ds is specified and use.ingroup.d = TRUE.

pam

An allelic presence-absence matrix produced by the function importAllelicPAM.

sam

A data frame of sample information. It must have two columns named "Year_low" and "Year_up" for the lower bound and upper bound of years that an isolate was obtained. For isolates whose isolation years are known explicitly, Year_low = Year_up. In addition, the first column must be isolate names.

name.col

The index for the column of sam for strain names. By default, name.col = 1. Namely, the first column in sam stores the strain names.

years

An integer vector for every year the co-occurrence network is generated. Leave this argument as 0 (default) to disable year-based sampling.

ds

A data frame of allelic physical distances, which is generated by the physDist pipeline. This is an optional argument.

use.ingroup.d

A logical argument specifying the function to filter the physical allelic distances (in ds) using the d_min and d_max in edge attributes. By default, use.ingroup.d = FALSE, so All distances are used to calculate the distance measurability.

Value

A list of two elements. The first element "G" is a list of Graph objects, each named by a year; the second element w is a numeric vector for weighted occurrence count per isolate. However, when years <= 0, the G element is a single Graph object.

Author(s)

Yu Wan (wanyuac@126.com)


wanyuac/GeneMates documentation built on Aug. 12, 2022, 7:37 a.m.