Conversions to Pajek format

Malaria

Two mode network genes X substrings (297 x 806).

The var genes of the human malaria parasite Plasmodium falciparum from

Rask, T. S., Hansen, D. A., Theander, T. G., Gorm Pedersen, A., & Lavstsen, T. (2010). Plasmodium falciparum Erythrocyte Membrane Protein 1 Diversity in Seven Genomes – Divide and Conquer. PLoS Computational Biology, 6(9), e1000933. doi:10.1371/journal.pcbi.1000933

and available as MATLAB 5.0 MAT-file, Platform: MACI64, Created on: Fri Jun 27 09:17:09 2014 at http://danlarremore.com/bipartiteSBM . See also

Converted into Pajek format by Vladimir Batagelj, March 15, 2018. See mlab.

> library(R.matlab) 
> setwd("C:/Users/batagelj/Downloads/data/FB100/larremore/malariaData")
> A <- readMat("malaria.mat")
> N1 <- unlist(A$geneSequenceHeaders,use.names=FALSE)
> N2 <- unlist(A$geneSequences,use.names=FALSE)
> N3 <- unlist(A$substrings,use.names=FALSE)
> nam <- file("names.txt","w")
> n1 <- length(N1); n3 <- length(N3)
> cat("*vertices",n1,"\n ",file=nam)
> cat(paste(1:n1,' "',N1,'"\n',sep=''),file=nam)
> cat("*vertices",n1,"\n ",file=nam)
> cat(paste(1:n1,' "',N2,'"\n',sep=''),file=nam)
> cat("*vertices",n3,"\n ",file=nam)
> cat(paste(n1+(1:n3),' "',N3,'"\n',sep=''),file=nam)
> close(nam)
> tit <- attr(A,"header")$description

malaria.zip

Barents

A Barents Sea food web described in http://www.oikosjournal.org/appendix/oik-04138. Converted into Pajek format by Vladimir Batagelj, March 17, 2018 from the original (2014) and revised (2015) version of the data set (Ecological Archives E095-124-D1) http://www.esapubs.org/archive/ecol/E095/124/ .

A food web is an ecological network and its topological description consists of the list of nodes, i.e., trophospecies, the list of links, i.e., trophic interactions, and the direction of interactions (who is the prey and who is the predator). Food web topologies are widely used in ecology to describe structural properties of communities or ecosystems. The selection of trophospecies and trophic interactions can be realized in different manners so that many different food webs may be constructed for the same community. In the Barents Sea, many simple food webs have been constructed. We present a comprehensive food web topology for the Barents Sea ecosystem, from plankton to marine mammals. The protocol used to compile the data set includes rules for the selection of taxa and for the selection and documentation of the trophic links. The resulting topology, which includes 244 taxa and 1589 trophic links, can serve as a basis for topological analyses, comparison with other marine ecosystems, or as a basis to build simulation models of the Barents Sea ecosystem. The data set consists of three related tables: (1) the list of taxa, (2) the list of pairwise interactions, and (3) the list of bibliographical references.

The weights/codes on arcs:

  1. Link documented by quantitative data and published in peer-reviewed literature
  2. Link documented by quantitative data available in databases or published in gray literature
  3. Link reported from other sources of information (personal observations, fishermen's report, etc.)
  4. Plausible link. It has not been observed but it can be inferred from other observations on related species or other geographic areas

See also: http://www.oikosjournal.org/sites/oikosjournal.org/files/appendix/oik-04138.pdf

Related data set: http://dx.doi.org/10.5061/dryad.73r6j

Conversion

In the original TXT data files I replaced “\t” with ”;” and saved the obtained files as CSV.

> VV <- read.table("SpeciesList2015.csv",sep=";",header=TRUE)
> head(VV)
          TROPHOSPECIES ABBREVIATION         PHYLUM_SUBPYLUM                   CLASS
1              DETRITUS      DET_IND                Detritus                Detritus
2  AUTOTHROPH_FLAGELLAT      AUT_FLA   Autotroph flagellates   Autotroph flagellates
3        BACTERIA_INDET      BAC_IND            Picoplankton            Picoplankton
4                DIATOM       DIATOM           Microplankton           Microplankton
5 HETEROTROPH_FLAGELLAT      HET_FLA Heterotroph flagellates Heterotroph flagellates
6             ICE_ALGAE      ICE_ALG               Ice algae               Ice algae
                    ORDER                  FAMILY      GROUP
1                Detritus                Detritus 1_Plankton
2   Autotroph flagellates   Autotroph flagellates 1_Plankton
3            Picoplankton            Picoplankton 1_Plankton
4           Microplankton           Microplankton 1_Plankton
5 Heterotroph flagellates Heterotroph flagellates 1_Plankton
6               Ice algae               Ice algae 1_Plankton
> typeof(VV)
[1] "list"
> nam <- file("namesLong.nam","w")
> n <- nrow(VV)
> n
[1] 233
> cat("*vertices",n,"\n ",file=nam)
> cat(paste(1:n,' "',VV[,1],'"\n',sep=''),file=nam)
> close(nam)
> 
> net <- file("Barents.net","w")
> cat("*vertices",n,"\n ",file=net)
> cat(paste(1:n,' "',VV[,2],'"\n',sep=''),file=net)
> Names <- as.character(VV[,1])
> head(Names)
[1] "DETRITUS"              "AUTOTHROPH_FLAGELLAT"  "BACTERIA_INDET"       
[4] "DIATOM"                "HETEROTROPH_FLAGELLAT" "ICE_ALGAE"            
> V <- factor(Names,levels=Names,ordered=TRUE)
> head(V)
[1] DETRITUS              AUTOTHROPH_FLAGELLAT  BACTERIA_INDET        DIATOM               
[5] HETEROTROPH_FLAGELLAT ICE_ALGAE            
233 Levels: DETRITUS < AUTOTHROPH_FLAGELLAT < BACTERIA_INDET < ... < URSUS_MARITIMUS
> AA <- read.table("PairWiseList2015.csv",sep=";",header=TRUE)
> head(AA)
            PWKEY    PREDATOR                  PREY CODE
1 ACA_SPP-ACA_SPP ACARTIA_SPP           ACARTIA_SPP    2
2 ACA_SPP-AUT_FLA ACARTIA_SPP  AUTOTHROPH_FLAGELLAT    1
3  ACA_SPP-DIATOM ACARTIA_SPP                DIATOM    1
4 ACA_SPP-HET_FLA ACARTIA_SPP HETEROTROPH_FLAGELLAT    1
5 ACA_SPP-MIX_FLA ACARTIA_SPP MIXOTROPH_FLAGELLATES    4
6  ACA_SPP-PROZOO ACARTIA_SPP      PROTOZOOPLANKTON    1
> pred <- factor(as.character(AA$PREDATOR),levels=Names,ordered=TRUE)
> prey <- factor(as.character(AA$PREY),levels=Names,ordered=TRUE)
> cat("*arcs\n ",file=net)
> cat(paste(as.integer(pred),as.integer(prey),AA$CODE,"\n"),file=net)
> close(net)
> 
> clu <- file("phylum.clu","w")
> lev <- levels(VV[,3])
> head(lev)
[1] "Annelida"              "Arthropoda"            "Autotroph flagellates"
[4] "Bryozoa"               "Chaetognatha"          "Chordata"             
> cat("%",paste(1:length(lev),' "',lev,'"  ',sep=''),'\n',file=clu)
> cat("*vertices",n,"\n ",file=clu)
> cat(paste(as.integer(VV[,3]),'\n',sep=''),file=clu)
> close(clu)
> clu <- file("class.clu","w")
> lev <- levels(VV[,4])
> head(lev)
[1] "Actinopterygii"        "Anthozoa"              "Appendicularia"       
[4] "Ascidiacea"            "Asteroidea"            "Autotroph flagellates"
> cat("%",paste(1:length(lev),' "',lev,'"  ',sep=''),'\n',file=clu)
> cat("*vertices",n,"\n ",file=clu)
> cat(paste(as.integer(VV[,4]),'\n',sep=''),file=clu)
> close(clu)
> clu <- file("order.clu","w")
> lev <- levels(VV[,5])
> head(lev)
[1] "Actiniaria"          "Actinopterygii"      "Alcyonacea"          "Amphinomida"        
[5] "Amphipoda"           "Amphipoda/Gammarida"
> cat("%",paste(1:length(lev),' "',lev,'"  ',sep=''),'\n',file=clu)
> cat("*vertices",n,"\n ",file=clu)
> cat(paste(as.integer(VV[,5]),'\n',sep=''),file=clu)
> close(clu)
> clu <- file("family.clu","w")
> lev <- levels(VV[,6])
> head(lev)
[1] "Acartiidae"     "Actinopterygii" "Agonidae"       "Alcidae"        "Ammodytidae"   
[6] "Amphinomidae"  
> cat("%",paste(1:length(lev),' "',lev,'"  ',sep=''),'\n',file=clu)
> cat("*vertices",n,"\n ",file=clu)
> cat(paste(as.integer(VV[,6]),'\n',sep=''),file=clu)
> close(clu)
> clu <- file("group.clu","w")
> lev <- levels(VV[,7])
> head(lev)
[1] "1_Plankton" "2_Benthos"  "3_Fish"     "4_Birds"    "5_Mammals" 
> cat("%",paste(1:length(lev),' "',lev,'"  ',sep=''),'\n',file=clu)
> cat("*vertices",n,"\n ",file=clu)
> cat(paste(as.integer(VV[,7]),'\n',sep=''),file=clu)
> close(clu)

Some editing of the obtained Pajek files:

  • formating and additional comments
  • NA replaced with 0

The same procedure was applied also to original (2014) data with 244 species.

Original 2014, Revised 2015

pajek/data/conv.txt · Last modified: 2018/05/12 15:31 by vlado
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki