draw.targetNet.TWO: Target Ntwork Structure Plot for Two Drivers

View source: R/pipeline_functions.R

draw.targetNet.TWOR Documentation

Target Ntwork Structure Plot for Two Drivers

Description

draw.targetNet.TWO draws a network structure to display the target genes of two selected drivers. Edges of positively-regulated target genes are orange, edges of negatively-regulated target genes are green. The width of the edges shows the strength of regulation. It will also print out the number of shared and unique targe genes for each driver, with P-value and odds ratio.

Usage

draw.targetNet.TWO(
  source1_label = "",
  source2_label = "",
  source1_z = NULL,
  source2_z = NULL,
  edge_score1 = NULL,
  edge_score2 = NULL,
  arrow_direction1 = "out",
  arrow_direction2 = "out",
  label_cex = 0.7,
  source_cex = 1,
  pdf_file = NULL,
  total_possible_target = NULL,
  show_test = FALSE,
  n_layer = 1,
  alphabetical_order = FALSE
)

Arguments

source1_label

character, the label of the first selected driver (to be displayed on the left).

source2_label

character, the label of the second selected driver (to be displayed on the right).

source1_z

numeric, the Z-statistic of the first driver. The color shade of driver’s node in the network is decided by this Z-statistic. If NULL, the driver will be colored grey. Default is NULL.

source2_z

numeric, the Z-statistic of the second driver.The color shade of driver’s node in the network is decided by this Z-statistic. If NULL, the driver will be colored grey. Default is NULL.

edge_score1

a named vector of numerics, indicating the correlation between the first driver and its target genes. The range of the numeric value is from -1 to 1. Positive value means it is positively-regulated by driver and vice versa. The names of the vector are gene names.

edge_score2

a named vector of numerics, indicating the correlation between the seconde driver and its target genes. The range of the numeric value is from -1 to 1. Positive value means it is positively-regulated by driver and vice versa. The names of the vector are gene names.

arrow_direction1

character, the arrow direction for first driver. Users can choose between "in" and "out". Default is "out".

arrow_direction2

character, the arrow direction for second driver. Users can choose between "in" and "out". Default is "out".

label_cex

numeric, giving the amount by which the text of target gene names should be magnified relative to the default. Default is 0.7.

source_cex

numeric, giving the amount by which the text of driver name should be magnified relative to the default. Default is 1.

pdf_file

character, the file path to save as PDF file. If NULL, no PDF file will be saved. Default is NULL.

total_possible_target

numeric or a vector of characters. If input is numeric, it is the total number of possible target genes. If input is a vector of characters, it is the background list of all possible target genes. This parameter will be passed to function test.targetNet.overlap to test whether the target genes of the two drivers are significantly intersected. If NULL, will do not perform this test. Default is NULL.

show_test

logical, if TRUE, the test result will be printed and returned. Default is FALSE.

n_layer

integer, number of circle layers to display. Default is 1.

alphabetical_order

logical, if TRUE, the targe gene names will be sorted alphabetically. If FALSE, will be sorted by statistics. Default is FALSE.

Value

If show_test==FALSE, will return a logical value indicating whether the plot has been successfully generated, otherwise will return the statistics of testing when total_possible_target is not NULL.

Examples

source1_label <- 'test1'
source1_z <- 1.96
edge_score1 <- (sample(1:160,size=80,replace=TRUE)-80)/80
names(edge_score1) <- sample(paste0('G',1:1000),size=80)
source2_label <- 'test2'
source2_z <- -2.36
edge_score2 <- (sample(1:240,size=120,replace=TRUE)-120)/120
names(edge_score2) <- sample(paste0('G',1:1000),size=120)
draw.targetNet.TWO(source1_label=source1_label,
               source2_label=source2_label,
               source1_z=source1_z,source2_z=source2_z,
               edge_score1=edge_score1,edge_score2=edge_score2,
               total_possible_target=paste0('G',1:1000),
               show_test=TRUE,label_cex=0.6)
draw.targetNet.TWO(source1_label=source1_label,
               source2_label=source2_label,
               source1_z=source1_z,source2_z=source2_z,
               edge_score1=edge_score1,edge_score2=edge_score2,
               total_possible_target=paste0('G',1:1000),
               show_test=TRUE,label_cex=0.6,n_layer=2)

## Not run: 
source1_label <- 'test1'
source1_z <- 1.96
edge_score1 <- (sample(1:160,size=100,replace=TRUE)-80)/80
names(edge_score1) <- sample(paste0('G',1:1000),size=100)
source2_label <- 'test2'
source2_z <- -2.36
edge_score2 <- (sample(1:240,size=100,replace=TRUE)-120)/120
names(edge_score2) <- sample(paste0('G',1:1000),size=100)
analysis.par <- list()
analysis.par$out.dir.PLOT <- getwd()
draw.targetNet.TWO(source1_label=source1_label,
               source2_label=source2_label,
               source1_z=source1_z,source2_z=source2_z,
               edge_score1=edge_score1,edge_score2=edge_score2,
               total_possible_target=paste0('G',1:1000),show_test=TRUE,
               pdf_file=sprintf('%s/targetNetTWO.pdf',
               analysis.par$out.dir.PLOT))

## End(Not run)

jyyulab/NetBID documentation built on Dec. 23, 2024, 6:34 a.m.