top_pairs_analysis: Calculates the number of contacts for each element of the top...

View source: R/top_pairs_analysis.R

top_pairs_analysisR Documentation

Calculates the number of contacts for each element of the top pairs

Description

Given a correlation object, calculates the number of pairs (contacts) each element in the top X pairs are involved in

Usage

  top_pairs_analysis(corr_matrix, filepathroot=NULL, top=25, entropy=NULL, filter=NULL)

Arguments

corr_matrix

One of the matrices created by a correlation/covariation function (omes, mip, elsc, mcbasc, dynamic_circular, dynamic_omes, dynamic_mip).

filepathroot

The root of the full path names of the output files for top_pairs_analysis. Default is NULL (two csv files are created : TOPn_CONTACTS.csv and TOPn_SCORES.csv, where n is the number of top pairs). If not NULL, extentions "-TOPn_CONTACTS.csv" and "_TOPn_SCORES.csv" are added to the root name.

top

A integer indicating the number of top pairs used for this analysis. Default is 25.

entropy

An object created by the entropy or dynamic_entropy function. Default is NULL.

filter

A vector created by the delta_filter function to limit the analysis to elements in the given entropy/dynamic_entropy range. DEfault is NULL.

Details

This function sorts element pairs by correlation/covariation scores and analyzes the top X pairs to determine the number of pairs (contacts) each element of the top X pairs is involved in. If filter is TRUE, only the scores of elements in the delta filter defined entropy range are taken into account. Results are written as .csv files.

Value

returns an object of class 'top_pairs' which is a named list of four elements for subsequent network representation with the network.plot function:

pair_i

a vector containing the name of element i in the ordered top pairs

pair_j

a vector containing the name of element j in the ordered top pairs

positions

a vector containing the positions in the top n pairs

contacts

a vector containing the number of contacts of the positions in the top n pairs

returns also two .csv files containing scores and contacts of the top n pairs for subsequent network representation with Cytoscape.

Author(s)

Antoine GARNIER and Marie CHABBERT

Examples

  #File path for output files
  wd <- tempdir()
  #wd <-getwd() 
  file <- file.path(wd,"test_seq") 

  #Importing MSA file
  msf <- system.file("msa/toy_align.msf", package = "Bios2cor")
  align <- import.msf(msf)

  #Creating entropy object
  entropy <- entropy(align)

  #Creating OMES correlation object
  omes <- omes(align, gap_ratio = 0.2)

  #Selecting correlation matrix
  omes <-omes$Zscore
   
  #Creating top_pairs object and writing scores and contacts to csv files  
  top_pairs <- top_pairs_analysis(omes, file, top = 25, entropy=entropy)

Bios2cor documentation built on July 8, 2022, 5:05 p.m.