Commit 74fda16d authored by Björn Brembs's avatar Björn Brembs
Browse files

fixed some issue with plotdata.r

parent 521c8614
No preview for this file type
q()
install.packages(c("adehabitat","XML","lattice","hexbin",
"colorRamps" ,"corrplot","gplots", "rgl", "MASS", "adehabitatLT","corrplot"), dependencies=TRUE)
q()
load("F:/PV-Anlage/.RData")
flyData <- xmlParse(file.choose())
require("XML")
require("data.table")
install.packages(XML)
install.packages("XML")
flyData <- xmlToDataFrame(file.choose())
library("XML").
library("methods")
install.packages("data.table")
library("XML")
library("methods")
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlToDataFrame(file.choose())
flyData <- xmlParse(file.choose())
print(flydata)
print(flyData)
xmltop = xmlRoot(flyData)
class(xmltop)
xmlName(xmltop
)
xmlSize(xmltop)
xmlName(xmltop[[1]])
xmlName(xmltop[[2]])
xmlName(xmltop[[3]])
xmlName(xmltop[[3.1]])
xmlName(xmltop[[4]])
xmlName(xmltop[[3][1]])
xmlName(xmltop[[3]][[1]])
flytest=ldply(xmlToList(file.choose()), data.frame)
require("plyr")
flytest=ldply(xmlToList(file.choose()), data.frame)
flytest=ldply(xmlToList(file.choose()), data.frame)
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData1,"//metadata"))[c("licanse","URIs","experimenter","experiment")
]G
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData1,"//metadata"))[c("licanse","URIs","experimenter","experiment")]
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata"))[c("licanse","URIs","experimenter","experiment")]
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata"))[c("license","URIs","experimenter","experiment")]
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
View(metadata)
metadata <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata"))[c("license","URIs","experimenter","experiment")]
metadata.experimenter <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
View(metadata.experimenter)
metadata[experimenter] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
metadata['experimenter'] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
metadata["experimenter"] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
metadata <- list()
metadata["experimenter"] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
metadata[experimenter] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
metadata[1] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
URIs <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/URIs"))[c("recording","analysis","datamodel")]
experimenter <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))[c("firstname","lastname","orcid")]
View(URIs)
View(experimenter)
metadata<-list(URIs,experimenter)
xmlGetAttr(flyData, "fly")
xmlGetAttr(xmltop, "fly")
xmlGetAttr(xmltop[[1]], "fly")
xmlGetAttr(xmltop[[1]][[4]], "fly")
xmlGetAttr(xmlRoot(xmltop), "fly")
xmlName(xmltop[[1]][[4]])
xmlGetAttr(xmltop[[1]][[4]])
xmlAttrs(xmltop[[1]][[4]])
xmlAttrs(xmltop[[1]][[4]], "type")
xmlAttrs(xmltop[[1]][[4]], [["type"]])
xmlAttrs(xmltop[[1]][[4]], type)
xmlAttrs(xmltop[[1]][[4]], 'type)
""
''
)
;
xmlAttrs(xmltop[[1]][[4]], 'type')
xmlGetAttr(xmltop[[1]][[4]], "type")
xmlGetAttr(xmltop[[metadata']][['fly']], "type")
xmlGetAttr(xmltop[['metadata']][['fly']], "type")
flyDataXMLtop = xmlRoot(flyData)
experiment <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experiment"))[c("description","dateTime", "duration", "sample_rate", "arena_type, "meter_type")]
experiment <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experiment"))[c("description","dateTime", "duration", "sample_rate", "arena_type", "meter_type")]
View(experiment)
print("experiment type not recognized")
print(experiment type not recognized)
NofPeriods=xmlGetAttr(flyDataXMLtop[['sequence']][['experiment']], "periods")
xmlGetAttr(flyDataXMLtop[['sequence']], "periods")
NofPeriods=xmlGetAttr(flyDataXMLtop[['sequence']], "periods")
NofPeriods=as.integer(xmlGetAttr(flyDataXMLtop[['sequence']], "periods"))
is.integer(xmlGetAttr(flyDataXMLtop[['sequence']], "periods"))
is.integer(noquote(xmlGetAttr(flyDataXMLtop[['sequence']], "periods")))
NofPeriods=as.integer(noquote(xmlGetAttr(flyDataXMLtop[['sequence']], "periods")))
is.integer(xmlGetAttr(flyDataXMLtop[['sequence']], "periods"))
is.integer(NofPeriods)
NofPeriods=as.integer(xmlGetAttr(flyDataXMLtop[['sequence']], "periods"))
is.integer(NofPeriods)
xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence"))[c("duration","coup_coeff")]
sequence<-xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence"))[c("duration","coup_coeff")]
sequence<-xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence"))[c("period")]
View(sequence)
sequence<-xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence"))
View(sequence)
print(sequence)
require("methods")
sequence<-xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence"))
print(sequence)
period[3] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//period[@type='3']"))
period[3] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence/period[@type='3']"))
period[3] <- xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence/period[@number='3']"))
View(sequence)
sequence<-xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence/period"))
View(sequence)
experiment <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experiment"))
View(experiment)
View(experiment)
fly <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/fly"))
View(fly)
CSV_descriptor <- xmlToDataFrame(nodes=getNodeSet(flyData,"//timeseries/CSV_descriptor"))
View(CSV_descriptor)
variables <- xmlToDataFrame(nodes=getNodeSet(flyData,"//timeseries/variables"))
View(variables)
variables <- xmlToDataFrame(nodes=getNodeSet(flyData,"//timeseries/variables/variable"))
View(variables)
flyData <- xmlParse(file.choose())
flyData <- xmlParse(file.choose())
flyData <- xmlParse(file.choose())
flyDataXMLtop = xmlRoot(flyData)
##parse the metadata
URIs <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/URIs"))
experimenter <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experimenter"))
fly <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/fly"))
experiment <- xmlToDataFrame(nodes=getNodeSet(flyData,"//metadata/experiment"))
##parse sequence data
NofPeriods = as.integer(xmlGetAttr(flyDataXMLtop[['sequence']], "periods"))
sequence <- xmlToDataFrame(nodes=getNodeSet(flyData,"//sequence/period"))
##parse time series data
CSV_descriptor <- xmlToDataFrame(nodes=getNodeSet(flyData,"//timeseries/CSV_descriptor"))
variables <- xmlToDataFrame(nodes=getNodeSet(flyData,"//timeseries/variables/variable"))
View(CSV_descriptor)
View(experiment)
View(experimenter)
View(fly)
View(sequence)
View(URIs)
View(variables)
rawdata <- xmlToDataFrame(nodes=getNodeSet(flyData,"//csv_data"))
View(rawdata)
rawdata <- xmlToList(nodes=getNodeSet(flyData,"//csv_data"))
View(rawdata)
rawdata <- xmlToList(flyData,"//csv_data")
test <- xmlToList(nodes=getNodeSet(flyData,"//timeseries/variables/variable"))
test <- xmlToList(flyDataXMLtop[['csv_data']]))
test <- xmlToList(flyDataXMLtop[['csv_data']])
test <- xpathSApply(flyData, "//timeseries/csv_data")
xpathSApply(flyData, "//timeseries/csv_data", xmlValue)
test = data.frame(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(test)
View(test)
test = as-list(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
test = as.list(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
data.table
require(data.table)
install(data.table)
install.packages("data.table")
library(data.table)
test = data.table(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(test)
test = as.data.table(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(sequence)
View(test)
test = as.numeric(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
test <- as.numeric(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
test <- as.data.frame(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(test)
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(test)
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue),col.names(a_pos,torque))
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue),col.names=(a_pos,torque))
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue),col.names=[[a_pos]][[torque]]))
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue),col.names=[a_pos;torque]))
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue),col.names=(a_pos;torque))
test <- as.data.table.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
View(rawdata)
View(test)
test <- as.data.frame.character(xpathSApply(flyData, "//timeseries/csv_data", xmlValue))
load("B:/GitHub/DTSevaluations/environment.RData")
getwd()
install.packages("rmarkdown")
install.packages("markdown")
install.packages("knitr")
setwd("B:/GitHub/DTSevaluations")
source('B:/GitHub/DTSevaluations/HTML_DTS_project.R', echo=TRUE)
setwd("B:/GitHub/DTSevaluations")
source('B:/GitHub/DTSevaluations/HTML_DTS_project.R', echo=TRUE)
library################## An R-script to read YAML DTS project files, visualize and statistically evaluate data
################## An R-script to read YAML DTS project files, visualize and statistically evaluate data
library(ggplot2)
library(tidyr)
......@@ -30,7 +30,7 @@ project.file <- file.choose()
project.path = dirname(project.file)
project.data<-yaml.load_file(project.file)
#make sure the data are written in a subfolder of the data folder
#make sure the evaluations are written in a subfolder of the data folder
evaluation.path = paste(project.path,"evaluations", sep = "/")
dir.create(evaluation.path, showWarnings = FALSE)
setwd(evaluation.path)
......
......@@ -54,7 +54,7 @@ if(MultiFlyDataVerification(xml_list)==TRUE) # make sure all flies in a group ha
keeps = c("a_pos","torque")
period.data[[i]] <- temp[keeps] #list only position and torque data by period
if(sequence$type[i]=="fs"||"inv_fs"||"optomotor"||"class_patt"||"class_cola")
if(sequence$type[i]!="optomotor")
{
## plot the torque and position time traces
filename = paste(flyname,"timetraces",i,".png", sep="_")
......@@ -72,7 +72,7 @@ if(MultiFlyDataVerification(xml_list)==TRUE) # make sure all flies in a group ha
ggtitle(paste(flyname, "Period", i))
#position
if(sequence$type[i]=="fs"||"inv_fs"||"optomotor"||"class_patt"||"class_cola")
if(sequence$type[i]!="optomotor")
{
poshistos[[i]] <- ggplot(data=temp, aes_string(temp$a_pos)) +
geom_histogram(binwidth=10, fill = sequence$histocolor[i]) +
......@@ -86,7 +86,7 @@ if(MultiFlyDataVerification(xml_list)==TRUE) # make sure all flies in a group ha
if(!exists("PIprofile")){PIprofile <- data.frame(matrix(ncol = NofPeriods))}
#for position
if(sequence$type[i]=="fs"||"class_patt"||"class_cola")
if(sequence$type[i]!="optomotor")
{
t1 = sum(abs(temp$a_pos) >= 512 & abs(temp$a_pos) <= 1538)
t2 = nrow(temp)-t1
......@@ -185,7 +185,7 @@ if(MultiFlyDataVerification(xml_list)==TRUE) # make sure all flies in a group ha
ggtitle(paste("Period", i))
#position
if(sequence$type[i]=="fs"||"inv_fs"||"optomotor"||"class_patt"||"class_cola")
if(sequence$type[i]!="optomotor")
{
poshistos[[i]] <- ggplot(data=temp, aes_string(temp$a_pos)) +
geom_histogram(binwidth=10, fill = sequence$histocolor[i]) +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment