R import XML from Graphpad Prism



I am trying to import raw data from Graphpad Prism .pzfx files, which in principle are .xml files. I took out most of the prism specific stuff and left just the part I am interested in.:



<?xml version="1.0" encoding="UTF-8"?>
<GraphPadPrismFile xmlns="http://ift.tt/1AQDJWT" PrismXMLVersion="5.00">
<TableSequence Selected="1">
<Ref ID="Table0" Selected="1"/>
</TableSequence>
<Table ID="Table0" XFormat="error" YFormat="replicates" Replicates="1" TableType="XY" EVFormat="AsteriskAfterNumber">
<Title>Data 1</Title>
<XColumn Width="162" Decimals="0" Subcolumns="1">
<Title>X</Title>
<Subcolumn>
<d>1</d>
<d>2</d>
<d>3</d>
<d>4</d>
</Subcolumn>
</XColumn>
<YColumn Width="81" Decimals="4" Subcolumns="1">
<Title>ML</Title>
<Subcolumn>
<d>120</d>
<d>100</d>
<d>5</d>
<d>0</d>
<d>1.5</d>
</Subcolumn>
</YColumn>
<YColumn Width="81" Decimals="4" Subcolumns="1">
<Title>MH</Title>
<Subcolumn>
<d>10</d>
<d>560</d>
<d>665</d>
<d>40</d>
<d>31.5</d>
</Subcolumn>
</YColumn>
<YColumn Width="81" Decimals="6" Subcolumns="1">
<Title>MH2</Title>
<Subcolumn>
<d>1.20</d>
<d>100</d>
<d>5</d>
<d>0</d>
<d>1.5</d>
</Subcolumn>
</YColumn>
<YColumn Width="81" Decimals="6" Subcolumns="1">
<Title>MH1</Title>
<Subcolumn>
<d>120</d>
<d>100</d>
<d>5</d>
<d>0</d>
<d>1.5</d>
</Subcolumn>
</YColumn>
</Table>
</GraphPadPrismFile>


To my understanding I have a Node Table which again has XColumn, YColumn nodes, which have Title and then have Subcolumn nodes. Those contain my raw data I would like to convert into a R-data.frame.


So far I have managed to import one YColumn: (file is the path to the one above)



xData <- xmlParse(file)
xData.rt <- xmlRoot(xData)
xmlToDataFrame(xData.rt[["Table"]][["YColumn"]][["Subcolumn"]])


This gives me the first YColumn as a data.frame:



text
1 120
2 100
3 5
4 0
5 1.5


Is there a (maybe also simpler?) way to import all X and Y Colums into one data.frame?


No comments:

Post a Comment