21
Network (constellation) diagram of Ecosystem food web using SAS/GRAPH® software VANSUG – 7 th Oct, 2009 Rajeev Kumar University of British Columbia

Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

  • Upload
    vukhue

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Network (constellation) diagram of Ecosystem food web

using SAS/GRAPH® software

VANSUG – 7th Oct, 2009

Rajeev Kumar

University of British Columbia

Page 2: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

� Introduction

� Aim� Interactive description of Diagram� Ecosystem food web� Biomass� Ecopath� Trophic level

� Methods� Methods

� Requirements� Program description

� Interactive description of a Complex food web

� Pros and Cons

� Questions

Page 3: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Aim:Create an interactive ecosystem food-web diagram

Page 4: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

IntroductionInteractive description of diagram:

�Simple food web interactions

Page 5: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Ecosystem Food Web:

�Ecosystem: Ecological system – consists of plants and animals living together in a system.

�Food web: predator and prey interactions

@ h

ttp://m

ac122.icu.ac.jp

/gen

�Food web: predator and prey interactions between species in the ecosystem

�Describes the flow of energy and material among different components of an ecosystem

�Food chain : a simplified single pathway of energy

transfer

Biomass:

@ h

ttp://m

ac122.icu.ac.jp

/gen-ed

/ecosystem

-jpgs/fo

od

-web

.jpg

Page 6: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

IntroductionTrophic Level:Position of species based on what they

eat (a simple example)

Plants: TL=1Herbivores/vegetarians: TL=2Carnivores: TL=3 or more

Lindeman (1942): integers

Odum and Heald (1975): fractional

Ecopath: 1 + [the weighted average of the

preys' trophic level] to consumersConsumer eating 40% plants (with TL = 1) and 60% herbivores (with TL = 2)

Trophic level of= 1 + [0.4 · 1 + 0.6 · 2] = 2.6

• Lindeman, R.L., 1942. The trophic-dynamic aspect of ecology. Ecology 23:399-418.• Odum, W.E. and Heald, E.J., 1975. The detritus-based food web of an estuarine mangrove community, p. 265-286. In L.E. Cronin (ed.) Estuarine research, Vol. 1. Academic Press, New York.

•Pauly, Daniel (2003). Ecosystem impacts of the world's marine fisheries. Global Change Newsletter, 55, page 21

@ Pauly (2003)

Page 7: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Methods

Requirements:

1. Software

� SAS/GRAPH ®®� Java

2. Data

Page 8: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsData for Nodes

SrN GROUP_NAME BIOMASS TL

1 WALLEYE 3 4.12

2 PERCH 10 3.5

3 PIKE 0.5 4.3

4 MUSKELLUNGE 0.1 4.3

Data for links

SrN PREY PD1 PD2 PD3 PD4 PD5

1 WALLEYE

2 PERCH 0.65 0.25 0.30

3 PIKE

4 MUSKELLUNGE

5 TULLIBEE 0.15 0.10 0.08

4 MUSKELLUNGE 0.1 4.3

5 TULLIBEE 1.5 3

Page 9: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsStructure of SAS Program

Import the data for NODES and

LINKS

Playing with nodes

Positions of nodes

Algorithm for horizontal position

Algorithm of Vertical position

Node pop-up

1

2

Node pop-up

Playing with links

Creation of link lines

Popup for link lines

Ds2const macroDs2const macro

arguments

3

4

Page 10: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsProgram descriptions:

PROC IMPORT OUT= WORK.rawnode

DATAFILE= "C:\Documents and Settings\r.kumar\My

Documents\SAS PAPER_diet\DIET MATRIX.xls"

DBMS=EXCEL REPLACE;

SHEET="BMASS$";

GETNAMES=YES;

MIXED=NO;

SCANTEXT=YES;

USEDATE=YES;

SCANTIME=YES;SCANTIME=YES;

RUN;

PROC IMPORT OUT= WORK.dietmatrix

DATAFILE= "C:\Documents and Settings\r.kumar\My

Documents\SAS PAPER_diet\DIET MATRIX.xls"

DBMS=EXCEL REPLACE;

SHEET="DMATRIX$";

GETNAMES=YES;

MIXED=NO;

SCANTEXT=YES;

USEDATE=YES;

SCANTIME=YES;

RUN;

Page 11: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsPlaying with nodes: Creation of data set for nodes

proc sort data=rawnode;

by descending tl;

run;

data z (keep= xl);

set rawnode;

xl=uniform(150847);

run;

proc transpose data =z out=z;

run;run;

data z (drop=i);

set z ;

array divya (*) _numeric_;

do i= 3 to dim (divya) by 2;

divya (i-1)= divya(i);

end;

run;

proc transpose data=z out=z;

run;

data rawnode (drop = _name_);

set rawnode;

set z;

run;

Page 12: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsPlaying with nodes contd..

data nodedata (drop=width text text1 xl xll);

set rawnode;

text= 'BIOMASS';

text1='TL';

node_popup = trim(group_name) !! ': '!!trim(text)!! '='

!! put(biomass, 6.2)!! 'tons/sq.km'!! ',‘

!!trim(text1)!! '= ' !!put(tl, 4.2);

Node_size= log(biomass*10**5)*3;

yloc=700-(TL*140); /*700 is the max height of graph and

140 is 700/5. 5 is max TL to be

plotted */

width=800; /* width is the desired width of

graph in macro argument*/

xll=(int(xl*width/2))-20;

if mod(_n_ , 2)=0 then xloc = width/2+xll;

if mod(_n_ , 2)=1 then xloc = width/2-xll;

if _n_ =1 then xloc=width/2;

run;

Page 13: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsPlaying with links:

data dmr (keep= SrN Prey predator amount);

set dietmatrix ;

array P {*} PD1-PD16;

do predator=1 to dim(p);

Amount=P{predator};

output;

end;

run;run;

proc sort data=dmr out=dmrs;

by predator;

where amount gt 0;

run;

data linkdata (drop= text);

set dmrs;

Text= 'FEEDS ON';

amount=amount*100;

Link_popup = trim (put(predator, nick.)) !! ' ' !!

trim(text)!! ' ' !! trim(Prey) !! ' BY ' !! put(amount,

4.)!! '%';

RUN;

Page 14: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsNodedata set

Obs SrN GROUP_NAME BIOMASS TL node_popup Node_size yloc xloc

1 10 BIRDS 0.08 4.5 BIRDS: BIOMASS= 0.08tons/sq.km, TL= 4.50 26.9616 70 400

2 3 PIKE 0.5 4.3 PIKE: BIOMASS= 0.50tons/sq.km, TL= 4.30 32.4593 98 498

3 4 MUSKELLUNGE 0.1 4.3 MUSKELLUNGE: BIOMASS= 0.10tons/sq.km, TL= 4.30 27.631 98 302

4 1 WALLEYE 3 4.12 WALLEYE: BIOMASS= 3.00tons/sq.km, TL= 4.12 37.8346 123.2 773

5 2 PERCH 10 3.5 PERCH: BIOMASS= 10.00tons/sq.km, TL= 3.50 41.4465 210 27

Linkdata set

5 2 PERCH 10 3.5 PERCH: BIOMASS= 10.00tons/sq.km, TL= 3.50 41.4465 210 27

Obs SrN PREY predator Amount Link_popup

1 2 PERCH 1 65 FEEDS ON PERCH BY 65%

2 5 TULLIBEE 1 15 FEEDS ON TULLIBEE BY 15%

3 8 DARTERS 1 10 FEEDS ON DARTERS BY 10%

4 9 OTHER FISHES 1 10 FEEDS ON OTHER FISHES BY 10%

5 5 TULLIBEE 2 10 FEEDS ON TULLIBEE BY 10%

Page 15: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsDs2const Macro:

1. Configuration of the HTML output file

2. Location of the data that is used to generate the diagram

3. Configuration of the applet's interactive features

Syntax:

%DS2CONST(argument1=value1, argument2=value2, ...);

@ sas help and documentation

Page 16: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsDs2const Macro contd...

ods listing;

Title1'PNWSUG';

%ds2const(ndata=nodedata,

ldata=linkdata,

datatype=assoc,/* arcs(by default),assoc,hier*/

codebase=C:\Program Files\SAS\SASGraphJavaApplets\9.2,

htmlfile=C:\Program Files\SAS\SASGraphJavaApplets\

9.2\test_POPUP.html,9.2\test_POPUP.html,

archive=constapp.jar,

height=700, /* applet height*/

width=850, /* applet width*/

border= n, /* for border around background area. default=N */

align=left,/* alignment of the applet window in the browser

window(left,right,top,bottom,middle */

ibackloc=file:///C:/Documents%20and%20Settings/r.kumar/My%20Docu

ments/My%20Pictures/fish.jpg,

ibackpos=tile,

@ sas help and documentation

Page 17: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsDs2const Macro contd..

colormap=y, /* for colour of node and link.*/

nsize=node_size

ncolval=node_size, /* color of node */

minlnkwt=5,

SCLNKWT=N, /*for scroll bar, variable value

range should be ge =2*/

nid=srn,

nlabel=Group_Name,

labels=y,

fntsize=12, /* Node label font size */

fntstyl=bold, /* Node label font style(Plain, italic,)*/

catext=blue, /* Node label text color) */

nodeshap=circle,/*node(circle,square,diamond,triangle,no

ne etc) */

@ sas help and documentation

Page 18: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

MethodsDs2const Macro contd...

layout=user, /*nx=xloc and ny=yloc, position are based

on user value,(auto,user)*/

nx=xloc,

ny=yloc,

lfrom=predator,

lto=SrN,

lcolval=amount, /* variable determine the color of link lcolval=amount, /* variable determine the color of link

(linkdata)*/

lvalue=amount, /* width of link (linkdata)*/

ltip=link_popup, /* popup value for link*/

ntip=node_popup, /* popup value for node*/

linktype=arrow); /*type of link- line, arrow*/

@ sas help and documentation

Page 19: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Interactive description of a complex food web

� Complex food web

Page 20: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web

Pros and Cons of the program

Pros Cons

� Easy and fast to build graph

� Automatic creation of links

� Horizontal spacing of nodes is based on

� Automatic creation of links and pop-ups

� Can be used in other types of networks

is based on random number generation—few iteration may be required with different seeds

Page 21: Network (constellation) diagram of Ecosystem food web ... Group Presentation… · Network (constellation) diagram of Ecosystem food web ... Create an interactive ecosystem food-web