IBDsegment-class {hapFabia} | R Documentation

## IBDsegment instances and methods

### Description

`IBDsegment` is a class to store characteristics of an IBD segment in one of its instances. Characteristics of an IBD segment include its genomic position, its length, the individuals/chromosomes that belong to it, the tagSNVs that tag/mark it, etc.

### Usage

    ## S4 method for signature 'IBDsegment'
    plot(x,filename, ...)

    ## S4 method for signature 'IBDsegment'
    plotLarger(x,filename,fact=1.0,addSamp=c(), ...)

    ## S4 method for signature 'IBDsegment'
    summary(object, ...)

### Arguments

`x` | object of the class `IBDsegment`.
`object` | object of the class `IBDsegment`.
`filename` | filename of the file that contains the genotyping data. Call of `readSamplesSpfabia` from the package fabia to read genotype data for the plot. ATTENTION: without file type ".txt"!
`fact` | factor by which the IBD segment is extended. The extension is done both at the left and at the right hand side.
`addSamp` | vector giving additional individuals, e.g. for adding 10 individuals out of N the code `sample(N,10)` may be used.
`...` | further arguments.

### Details

plot

  Plots an IBD segment where the SNVs within the cluster are shown. In the plot the $y$-axis gives the individuals or the chromosomes and the $x$-axis consecutive SNVs. Minor alleles of tagSNVs are marked by a particular color. Minor alleles of other SNVs (private, common, from other clusters, etc) are marked by a different color. The model from fabia is also shown. The default color coding uses yellow for major alleles, violet for minor alleles of tagSNVs, and blue for minor alleles of other SNVs. `model L` indicates tagSNVs identified by hapFabia in violet.

plotLarger

  Plots an IBD segment where the SNVs within the cluster are shown, however additional individuals that do not possess the IBD segment can be added. Further the range can be increased by a certain factor. Additional arguments are `fact` and `addSamp`. `fact` gives the factor by which the IBD segment should be extended to both the left and the right. `addSamp` is a vector of individuals/haplotypes which are added to the individuals that possess the IBD segment. The plot allows to view the IBD segment in the context of its DNA location and additional individuals.

summary

  Prints the ID of the IBD segment, the bicluster it is derived from, the chromosome and position where it is located, its length, the number of individuals/chromosomes that belong to it, the number of tagSNVs that mark it.

Implementation in R.

### Value

`` | no value.

### Slots

Objects of class `IBDsegment` have the following slots:

`ID`

  number of the IBD segment in the current extraction.

`bicluster_id`

  ID of the bicluster the IBD segment was found in.

`chromosome`

  the chromosome.

`IBDsegmentPos`

  genomic location of the IBD segment.

`IBDsegmentLength`

  length of the IBD segment in the number of SNVs. For the length in bp: `max(tagSNVPositions(x))-min(tagSNVPositions(x))`.

`numberIndividuals`

  number of samples belonging to the IBD segment.

`numbertagSNVs`

  number tagSNVs marking the IBD segment.

`individuals`

  IDs of individuals or chromosomes belonging to the IBD segment.

`tagSNVs`

  IDs of SNVs that mark the IBD segment (tagSNVs).

`populationIndividuals`

  the population each individual belongs to.

`idIndividuals`

  IDs of the individuals or chromosomes.

`labelIndividuals`

  label of the individuals.

`platformIndividuals`

  for each individual the technology/platform that was used to genotype it.

`coreClusterIndividuals`

  IDs of individuals that constitute the core of the IBD segment.

`tagSNVPositions`

  physical positions of the tagSNVs on the chromosome in base pairs.

`tagSNVAlleles`

  alleles of the tagSNVs in the form `Ref:Alt` where Ref denotes reference allele and Alt the alternative allele.

`tagSNVNames`

  name of the tagSNVs according to a given annotation.

`tagSNVFreq`

  frequency of tagSNVs in the whole data set.

`tagSNVGroupFreq`

  frequency of tagSNVs in the population that is considered.

`tagSNVChange`

  if the minor allele was more frequent than the major, then both were switched. Switching is marked by a 1 and otherwise it is 0.

`tagSNVsPerIndividual`

  for each sample: tagSNVs are counted for which the sample has the minor allele.

`individualPerTagSNV`

  for each tagSNV: samples are counted for which the SNV has its minor allele.

`tagSNVAnno`

  the functional annotation of tagSNVs for each tagSNV: like stop-loss, stop-gain, non-synonymous, synonymous, promoter, exonic, intronic, intergenic, etc.

### Constructor

Constructor of class IBDsegment.

`IBDsegment(ID=0,bicluster_id=0,chromosome="",IBDsegmentPos=0,IBDsegmentLength=0,numberIndividuals=0,numbertagSNVs=0,individuals=as.vector(0),tagSNVs=as.vector(0),populationIndividuals=as.vector(""),idIndividuals=as.vector(0),labelIndividuals=as.vector(""),platformIndividuals=as.vector(""),coreClusterIndividuals=as.vector(0),tagSNVPositions=as.vector(0),tagSNVAlleles=as.vector(""),tagSNVNames=as.vector(""),tagSNVFreq=as.vector(0),tagSNVGroupFreq=as.vector(0),tagSNVChange=as.vector(0),tagSNVsPerIndividual=as.vector(0),individualPerTagSNV=as.vector(0),tagSNVAnno=as.vector(c(list(""))))`

### Accessors

In the following `x` denotes an IBDsegment object.

  `ID(x)`, `ID(x) <- value`: Returns or sets `ID`, where the return value and `value` are both numeric.

  `bicluster_id(x)`, `bicluster_id(x) <- value`: Returns or sets `bicluster_id`, where the return value and `value` are both numeric.

  `chromosome(x)`, `chromosome(x) <- value`: Returns or sets `chromosome`, where the return value and `value` are both strings.

  `IBDsegmentPos(x)`, `IBDsegmentPos(x) <- value`: Returns or sets `IBDsegmentPos`, where the return value and `value` are both numeric.

  `IBDsegmentLength(x)`, `IBDsegmentLength(x) <- value`: Returns or sets `IBDsegmentLength`, where the return value and `value` are both numeric.

  `numberIndividuals(x)`, `numberIndividuals(x) <- value`: Returns or sets `numberIndividuals`, where the return value and `value` are both numeric.

  `numbertagSNVs(x)`, `numbertagSNVs(x) <- value`: Returns or sets `numbertagSNVs`, where the return value and `value` are both numeric.

  `individuals(x)`, `individuals(x) <- value`: Returns or sets `individuals`, where the return value and `value` are both vectors.

  `tagSNVs(x)`, `tagSNVs(x) <- value`: Returns or sets `tagSNVs`, where the return value and `value` are both vectors.

  `populationIndividuals(x)`, `populationIndividuals(x) <- value`: Returns or sets `populationIndividuals`, where the return value and `value` are both vectors.

  `idIndividuals(x)`, `idIndividuals(x) <- value`: Returns or sets `idIndividuals`, where the return value and `value` are both vectors.

  `labelIndividuals(x)`, `labelIndividuals(x) <- value`: Returns or sets `labelIndividuals`, where the return value and `value` are both vectors.

  `platformIndividuals(x)`, `platformIndividuals(x) <- value`: Returns or sets `platformIndividuals`, where the return value and `value` are both vectors.

  `coreClusterIndividuals(x)`, `coreClusterIndividuals(x) <- value`: Returns or sets `coreClusterIndividuals`, where the return value and `value` are both vectors.

  `tagSNVPositions(x)`, `tagSNVPositions(x) <- value`: Returns or sets `tagSNVPositions`, where the return value and `value` are both vectors.

  `tagSNVAlleles(x)`, `tagSNVAlleles(x) <- value`: Returns or sets `tagSNVAlleles`, where the return value and `value` are both vectors.

  `tagSNVNames(x)`, `tagSNVNames(x) <- value`: Returns or sets `tagSNVNames`, where the return value and `value` are both vectors.

  `tagSNVFreq(x)`, `tagSNVFreq(x) <- value`: Returns or sets `tagSNVFreq`, where the return value and `value` are both vectors.

  `tagSNVGroupFreq(x)`, `tagSNVGroupFreq(x) <- value`: Returns or sets `tagSNVGroupFreq`, where the return value and `value` are both vectors.

  `tagSNVChange(x)`, `tagSNVChange(x) <- value`: Returns or sets `tagSNVChange`, where the return value and `value` are both vectors.

  `tagSNVsPerIndividual(x)`, `tagSNVsPerIndividual(x) <- value`: Returns or sets `tagSNVsPerIndividual`, where the return value and `value` are both vectors.

  `individualPerTagSNV(x)`, `individualPerTagSNV(x) <- value`: Returns or sets `individualPerTagSNV`, where the return value and `value` are both vectors.

  `tagSNVAnno(x)`, `tagSNVAnno(x) <- value`: Returns or sets `tagSNVAnno`, where the return value and `value` are both vectors.

### Signatures

plot

  `signature(x = "IBDsegment", y = "missing")`

Plot of an IBD segment, where tagSNVs, minor and major alleles are plotted.

plotLarger

  `signature(x="IBDsegment", filename="character",fact="numeric",addSamp="ANY")`

Plot of an IBD segment with additional individuals and the IBD segment extended to the left and to the right.

summary

  `signature(object = "IBDsegment")`

Summary of IBD segment object.

### Author(s)

Sepp Hochreiter

### References

S. Hochreiter et al., ‘FABIA: Factor Analysis for Bicluster Acquisition’, Bioinformatics 26(12):1520-1527, 2010.

### See Also

`IBDsegment-class`, `IBDsegmentList-class`, `analyzeIBDsegments`, `compareIBDsegmentLists`, `extractIBDsegments`, `findDenseRegions`, `hapFabia`, `hapFabiaVersion`, `hapRes`, `chr1ASW1000G`, `IBDsegmentList2excel`, `identifyDuplicates`, `iterateIntervals`, `makePipelineFile`, `matrixPlot`, `mergeIBDsegmentLists`, `mergedIBDsegmentList`, `plotIBDsegment`, `res`, `setAnnotation`, `setStatistics`, `sim`, `simu`, `simulateIBDsegmentsFabia`, `simulateIBDsegments`, `split_sparse_matrix`, `toolsFactorizationClass`, `vcftoFABIA`

### Examples

    old_dir <- getwd()
    setwd(tempdir())

    data(hapRes)
    data(simu)
    namesL <- simu[["namesL"]]
    haploN <- simu[["haploN"]]
    snvs <- simu[["snvs"]]
    annot <- simu[["annot"]]
    alleleIimp <- simu[["alleleIimp"]]
    write.table(namesL,file="dataSim1fabia_individuals.txt",
       quote = FALSE,row.names = FALSE,col.names = FALSE)
    write(as.integer(haploN),file="dataSim1fabia_annot.txt",
       ncolumns=100)
    write(as.integer(snvs),file="dataSim1fabia_annot.txt",
       append=TRUE,ncolumns=100)
    write.table(annot,file="dataSim1fabia_annot.txt",
       sep = " ", quote = FALSE,row.names = FALSE,
       col.names = FALSE,append=TRUE)
    write(as.integer(haploN),file="dataSim1fabia_mat.txt",
       ncolumns=100)
    write(as.integer(snvs),file="dataSim1fabia_mat.txt",
       append=TRUE,ncolumns=100)

    for (i in 1:haploN) {

      a1 <- which(alleleIimp[i,]>0.01)

      al <- length(a1)
      b1 <- alleleIimp[i,a1]

      a1 <- a1 - 1
      dim(a1) <- c(1,al)
      b1 <- format(as.double(b1),nsmall=1)
      dim(b1) <- c(1,al)

      write.table(al,file="dataSim1fabia_mat.txt",
        sep = " ", quote = FALSE,row.names = FALSE,
        col.names = FALSE,append=TRUE)
      write.table(a1,file="dataSim1fabia_mat.txt",
        sep = " ", quote = FALSE,row.names = FALSE,
        col.names = FALSE,append=TRUE)
      write.table(b1,file="dataSim1fabia_mat.txt",
        sep = " ", quote = FALSE,row.names = FALSE,
        col.names = FALSE,append=TRUE)

    }

    mergedIBDsegmentList <- hapRes$mergedIBDsegmentList

    IBDsegment <- mergedIBDsegmentList[[1]]

    # Summary method
    summary(IBDsegment)

    # Plot method
    plot(IBDsegment,filename="dataSim1fabia_mat")

    # Extended plot: more examples and borders
    plotLarger(IBDsegment,filename="dataSim1fabia_mat",3,sample(100,10))

    # ACCESSORS

    # IDs of the IBD segment
       ID(IBDsegment)
       bicluster_id(IBDsegment)

    # General Information
        IBDsegmentPos(IBDsegment)
        IBDsegmentLength(IBDsegment)
        numberIndividuals(IBDsegment)
        numbertagSNVs(IBDsegment)
        coreClusterIndividuals(IBDsegment)

    # Information on individuals / chromosomes
        individuals(IBDsegment)
        populationIndividuals(IBDsegment)
        idIndividuals(IBDsegment)
        labelIndividuals(IBDsegment)
        platformIndividuals(IBDsegment)
        tagSNVsPerIndividual(IBDsegment)

    # Information on tagSNVs
        tagSNVs(IBDsegment)
        tagSNVPositions(IBDsegment)
        tagSNVAlleles(IBDsegment)
        tagSNVNames(IBDsegment)
        tagSNVFreq(IBDsegment)
        tagSNVGroupFreq(IBDsegment)
        tagSNVChange(IBDsegment)
        individualPerTagSNV(IBDsegment)
        tagSNVAnno(IBDsegment)

    setwd(old_dir)

[Package hapFabia version 1.26.0 Index]