Fastcornet2: Draw Network plot of D3 style

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/base_Fastcornet2.R

Description

Draw Network plot of D3 style

Usage

1
2
3
4
5
6
7
Fastcornet2(data, source.col = NULL, target.col = NULL, value = NULL,
  color.group = list(), control.group = NULL, ratio = 1,
  legend = T, size = 15, linkColour = NULL,
  linkColour.type = list(name = "Blues", select.lower = 1, select.upper =
  9), control.linkColour = NULL, colourScale.type = NULL,
  nodeColour = list(), linkDistance = 300, linkWidth = 6,
  opacity = 1, arrows = F, opacityNoHover = 0, zoom = T)

Arguments

data

a data frame with source,target and value cols

source.col

the colnames of source

target.col

the colnames of target

value

the colnames of value

color.group

a list of elements goup.

control.group

Default is NULL.The group you want highlight.

ratio

The portion of data you select

legend

Whether show lengend

size

a numeric to adjust the size of nodes

linkColour

the link color.If it's NULL,the link color would be provided by linkColour.type parameter.

linkColour.type

a list of link color for value mapping.

control.linkColour

the color of highlight group.It only works when control.group exists.

colourScale.type

d3-scale-chromatic style object.
1="d3.schemeCategory20",
2="d3.schemeCategory20b",
3="d3.schemeCategory20c",
4="d3.schemeCategory10".
Default is 1

nodeColour

the named list of group color.It is unavailable when colourScale.type exists

linkDistance

link distance

linkWidth

the width of link.If it is not a numeric,the default "JS(function(d) { return Math.sqrt(d.value); })" would be used.

opacity

numeric value of the proportion opaque you would like the graph elements to be

arrows

Whether show direction between two nodes

opacityNoHover

the legend intensity.From 0-1.Default is 0

zoom

logical value to enable (TRUE) or disable (FALSE)

Details

linkColour.type make full use of RColorBrewer and would be a good color strategy provider.The parameters of linkColour.type is including:
1.names: One of "Blues","BuGn","BuPu","GnBu","Greens","Greys","Oranges","OrRd","PuBu","PuBuGn","PuRd","Purples","RdPu","Reds" ,"YlGn","YlGnBu","YlOrBr" and "YlOrRd";
2.select.lower: the lower color order;
3.select.upper: the upper color order.

Value

a list contain a network plot information and edge/node data.

Author(s)

Weibin Huang<654751191@qq.com>

See Also

forceNetwork

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
library(lucky)
data=state.x77;colnames(data)
## get MIC cormatrix
result1 <- FastMINE(data,
                    transposition = F,
                    method = "all.pairs",
                    control.markers="Income",
                    target.markers=NULL)

## long data frame network
data <- result1[["MINE.result"]][,1:3]
colnames(data) #[1] "X var"  "Y var" "MIC (strength)"
source.col="X var";target.col="Y var";value="MIC (strength)"

## parameters of Fastcornet2
color.group = list(
  love = c("Murder","Frost","Area","HS Grad"),
  hate = c("Life Exp","Illiteracy"),
  control = c("Population","Income"))
control.group = "control"
linkColour.type = list(
  name =  "Blues",
  select.lower = 1,
  select.upper = 3
)

# control.linkColour = "red"
control.linkColour = NULL
colourScale.type = NULL
nodeColour=list(
  love = mycolor[6],
  hate = mycolor[8],
  control = mycolor[35])

## Quick Start
nw2 <- Fastcornet2(data,
                   source.col,
                   target.col,
                   value,
                   color.group,
                   control.group,
                   ratio=0.8,
                   legend=T,
                   size = 15,
                   linkColour=NULL,
                   linkColour.type,
                   control.linkColour,
                   colourScale.type = NULL,
                   nodeColour);nw2$netplot

shijianasdf/BasicBioinformaticsAnalysisFromZhongShan documentation built on Jan. 3, 2020, 10:08 p.m.