Last active
June 27, 2016 20:00
-
-
Save rmflight/e623302819b470ce46779206811f83fe to your computer and use it in GitHub Desktop.
testing xpaths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > library(xml2) | |
| > mzml_file <- "test_mzml.mzML" | |
| > doc <- read_xml(mzml_file) | |
| > xml_find_all(doc, "//cvParam") | |
| {xml_nodeset (0)} | |
| > ns <- xml_ns(doc) | |
| > xml_find_all(doc, "//cvParam", ns = ns["d1"]) | |
| {xml_nodeset (0)} | |
| > xml_find_all(doc, "//cvParam", ns = ns["xsi"]) | |
| {xml_nodeset (0)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # upgrade to xml2 v1.0.0 | |
| # then use namespace specification | |
| # thanks @hadley | |
| # https://twitter.com/hadleywickham/status/747515633835769857 | |
| library(xml2) | |
| mzml_file <- "test_mzml.mzML" | |
| doc <- read_xml(mzml_file) | |
| xml_find_all(doc, "//d1:cvParam") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <indexedmzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.2_idx.xsd"> | |
| <mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd" id="SBC110871exopos" version="1.1.0"> | |
| <cvList count="2"> | |
| <cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" version="3.79.0" URI="http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo"/> | |
| <cv id="UO" fullName="Unit Ontology" version="12:10:2011" URI="http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/phenotype/unit.obo"/> | |
| </cvList> | |
| <fileDescription> | |
| <fileContent> | |
| <cvParam cvRef="MS" accession="MS:1000579" name="MS1 spectrum" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000580" name="MSn spectrum" value=""/> | |
| </fileContent> | |
| <sourceFileList count="1"> | |
| <sourceFile id="RAW1" name="SBC110871exopos.raw" location="file:///"> | |
| <cvParam cvRef="MS" accession="MS:1000768" name="Thermo nativeID format" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000563" name="Thermo RAW format" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000569" name="SHA-1" value="b2ca9b83d6752f533dd7d964613c29d44f0c5753"/> | |
| </sourceFile> | |
| </sourceFileList> | |
| </fileDescription> | |
| <referenceableParamGroupList count="1"> | |
| <referenceableParamGroup id="CommonInstrumentParams"> | |
| <cvParam cvRef="MS" accession="MS:1002416" name="Orbitrap Fusion" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000529" name="instrument serial number" value="FSN10352"/> | |
| </referenceableParamGroup> | |
| </referenceableParamGroupList> | |
| <softwareList count="2"> | |
| <software id="Xcalibur" version="1.1.982"> | |
| <cvParam cvRef="MS" accession="MS:1000532" name="Xcalibur" value=""/> | |
| </software> | |
| <software id="pwiz" version="3.0.9205"> | |
| <cvParam cvRef="MS" accession="MS:1000615" name="ProteoWizard software" value=""/> | |
| </software> | |
| </softwareList> | |
| <instrumentConfigurationList count="2"> | |
| <instrumentConfiguration id="IC1"> | |
| <referenceableParamGroupRef ref="CommonInstrumentParams"/> | |
| <componentList count="4"> | |
| <source order="1"> | |
| <cvParam cvRef="MS" accession="MS:1000398" name="nanoelectrospray" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000485" name="nanospray inlet" value=""/> | |
| </source> | |
| <analyzer order="2"> | |
| <cvParam cvRef="MS" accession="MS:1000081" name="quadrupole" value=""/> | |
| </analyzer> | |
| <analyzer order="3"> | |
| <cvParam cvRef="MS" accession="MS:1000484" name="orbitrap" value=""/> | |
| </analyzer> | |
| <detector order="4"> | |
| <cvParam cvRef="MS" accession="MS:1000624" name="inductive detector" value=""/> | |
| </detector> | |
| </componentList> | |
| <softwareRef ref="Xcalibur"/> | |
| </instrumentConfiguration> | |
| <instrumentConfiguration id="IC2"> | |
| <referenceableParamGroupRef ref="CommonInstrumentParams"/> | |
| <componentList count="4"> | |
| <source order="1"> | |
| <cvParam cvRef="MS" accession="MS:1000398" name="nanoelectrospray" value=""/> | |
| <cvParam cvRef="MS" accession="MS:1000485" name="nanospray inlet" value=""/> | |
| </source> | |
| <analyzer order="2"> | |
| <cvParam cvRef="MS" accession="MS:1000081" name="quadrupole" value=""/> | |
| </analyzer> | |
| <analyzer order="3"> | |
| <cvParam cvRef="MS" accession="MS:1000083" name="radial ejection linear ion trap" value=""/> | |
| </analyzer> | |
| <detector order="4"> | |
| <cvParam cvRef="MS" accession="MS:1000253" name="electron multiplier" value=""/> | |
| </detector> | |
| </componentList> | |
| <softwareRef ref="Xcalibur"/> | |
| </instrumentConfiguration> | |
| </instrumentConfigurationList> | |
| <dataProcessingList count="1"> | |
| <dataProcessing id="pwiz_Reader_Thermo_conversion"> | |
| <processingMethod order="0" softwareRef="pwiz"> | |
| <cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" value=""/> | |
| </processingMethod> | |
| </dataProcessing> | |
| </dataProcessingList> | |
| </mzML> | |
| </indexedmzML> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(xml2) | |
| mzml_file <- "test_mzml.mzML" | |
| doc <- read_xml(mzml_file) | |
| xml_find_all(doc, "//cvParam") | |
| ns <- xml_ns(doc) | |
| xml_find_all(doc, "//cvParam", ns = ns["d1"]) | |
| xml_find_all(doc, "//cvParam", ns = ns["xsi"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment