[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ micropan  (version  1.0  ) ](/packages/micropan/versions/1.0)

#  panMatrix: Computing the pan-matrix for a set of gene clusters

##  Description

A pan-matrix has one row for each genome and one column for each gene cluster,
and cell  [i,j]  indicates how many members genome  i  has in gene family  j
.

##  Usage

    
    
    panMatrix(clustering)

##  Arguments

clustering

A vector of integers indicating the gene cluster for every sequence. Sequences
with the same number belong to the same cluster. The name of each element is
the tag identifying the sequence.

##  Value

The returned object belongs to the class ` Panmat ` , which is a small (S3)
extension to a matrix. It can be treated as a matrix, but the generic
functions ` [ plot.Panmat ](/link/plot.Panmat?package=micropan&version=1.0) `
, ` [ summary.Panmat ](/link/summary.Panmat?package=micropan&version=1.0) `
and ` [ str.Panmat ](/link/str.Panmat?package=micropan&version=1.0) ` are
defined for a ` Panmat ` object. The input vector  clustering  is attached as
the attribute  clustering  to the ` Panmat ` object.

##  Details

The pan-matrix is a central data structure for pan-genomic analysis. It is a
matrix with one row for each genome in the study, and one column for each gene
cluster. Cell  [i,j]  contains an integer indicating how many members genome
i  has in cluster  j  . The input ` clustering ` must be an integer vector
with one element for each sequence in the study, typically produced by either
` [ bClust ](/link/bClust?package=micropan&version=1.0) ` or ` [ dClust
](/link/dClust?package=micropan&version=1.0) ` . The name of each element is a
text identifying every sequence. The value of each element indicates the
cluster, i.e. those sequences with identical values are in the same cluster.
IMPORTANT: The name of each sequence must contain the GID-tag for each genome,
i.e. they must of the form  GID111_seq1  ,  GID111_seq2  ,... where the
GIDxxx  part indicates which genome the sequence belongs to. See ` [ panPrep
](/link/panPrep?package=micropan&version=1.0) ` for details. The rows of the
pan-matrix is named by the GID-tag for every genome. The columns are just
named  Cluster_x  where  x  is an integer copied from  clustering  .

##  See Also

` [ bClust ](/link/bClust?package=micropan&version=1.0) ` , ` [ dClust
](/link/dClust?package=micropan&version=1.0) ` , ` [ distManhattan
](/link/distManhattan?package=micropan&version=1.0) ` , ` [ distJaccard
](/link/distJaccard?package=micropan&version=1.0) ` , ` [ fluidity
](/link/fluidity?package=micropan&version=1.0) ` , ` [ chao
](/link/chao?package=micropan&version=1.0) ` , ` [ binomixEstimate
](/link/binomixEstimate?package=micropan&version=1.0) ` , ` [ heaps
](/link/heaps?package=micropan&version=1.0) ` , ` [ rarefaction
](/link/rarefaction?package=micropan&version=1.0) ` .

##  Examples

[ Run this code
](https://www.datacamp.com/datalab/preview?_tag=rdocs&rdocsPath=packages%2Fmicropan%2Fversions%2F1.0%2Ftopics%2FpanMatrix&utm_source=r-docs&utm_medium=docs&utm_term=panMatrix&utm_content=run_example_in_datalab)

    
    
    # Loading clustering data in the micropan package
    data(list=c("Mpneumoniae.blast.clustering","Mpneumoniae.domain.clustering"),package="micropan")
    
    # Pan-matrix based on BLAST clustering
    panmat.blast <- panMatrix(Mpneumoniae.blast.clustering)
    
    # Pan-matrix based on domain sequence clustering
    panmat.domains <- panMatrix(Mpneumoniae.domain.clustering)
    
    # Plotting the first pan-matrix, and then printing its summary
    plot(panmat.blast)
    summary(panmat.blast)
    str(panmat.blast)
    

Run the code above in your browser using  [ DataLab
](https://www.datacamp.com/datalab/preview?_tag=rdocs&rdocsPath=packages%2Fmicropan%2Fversions%2F1.0%2Ftopics%2FpanMatrix&utm_source=r-docs&utm_medium=docs&