1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
<HTML>
<HEAD>
<TITLE>File and DB access</TITLE>
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
<LINK HREF="style_ini.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<A href="index.html">Home</A> ·
<A href="classes.html">Classes</A> ·
<A href="annotated.html">Annotated Classes</A> ·
<A href="modules.html">Modules</A> ·
<A href="functions_func.html">Members</A> ·
<A href="namespaces.html">Namespaces</A> ·
<A href="pages.html">Related Pages</A>
<HR style="height:1px; border:none; border-top:1px solid #c0c0c0;">
<!-- Generated by Doxygen 1.8.5 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">File and DB access </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>All classes for file and database IO can be found in the <em>FORMAT</em> folder.</p>
<h1><a class="anchor" id="format_file"></a>
File adapter classes</h1>
<p>The interface of most file adapter classes is very similar. They implement a <em>load</em> and a <em>store</em> method, that take a file name and the appropriate data structure.</p>
<p>The following example (Tutorial_FileIO.C) demonstrates the use of <em>MzMLFile</em> and <em>MzXMLFile</em> to convert one format into another using <em>MSExperiment</em> to hold the temporary data: <div class="fragment"><div class="line"><span class="keywordtype">int</span> <a class="code" href="RNPxl_8C.html#a217dbf8b442f20279ea00b898af96f52">main</a>(<span class="keywordtype">int</span> argc, <span class="keyword">const</span> <span class="keywordtype">char</span>** argv)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">if</span> (argc < 2) <span class="keywordflow">return</span> 1;</div>
<div class="line"> <span class="comment">// the path to the data should be given on the command line</span></div>
<div class="line"> String tutorial_data_path(argv[1]);</div>
<div class="line"> </div>
<div class="line"> MzXMLFile mzxml;</div>
<div class="line"> MzMLFile mzml;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// temporary data storage</span></div>
<div class="line"> MSExperiment<Peak1D> map;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// convert MzXML to MzML</span></div>
<div class="line"> mzxml.load(tutorial_data_path + <span class="stringliteral">"/data/Tutorial_FileIO.mzXML"</span>, map);</div>
<div class="line"> mzml.store(<span class="stringliteral">"Tutorial_FileIO.mzML"</span>, map);</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">} <span class="comment">//end of main</span></div>
</div><!-- fragment --></p>
<dl class="section user"><dt>FileHandler</dt><dd>In order to make the handling of different file types easier, the class <em>FileHandler</em> can be used. It loads a file into the appropriate data structure independently of the file type. The file type is determined from the file extension or the file contents: <div class="fragment"><div class="line">MSExperiment<> in;</div>
<div class="line">FileHandler handler();</div>
<div class="line">handler.loadExperiment(<span class="stringliteral">"input.mzML"</span>,in);</div>
</div><!-- fragment --></dd></dl>
<h1><a class="anchor" id="format_db"></a>
DB access</h1>
<p>For database access, the class <em>DBAdapter</em> is used. As its interface is very similar to the interface of the file adapters, no example is shown here.</p>
<h1><a class="anchor" id="format_options"></a>
PeakFileOptions</h1>
<p>In order to have more control over loading data from files or databases, most adapters can be configured using <em>PeakFileOptions</em>. The following options are available:</p>
<ul>
<li>only a specific retention time range is loaded</li>
<li>only a specific mass-to.charge ratio range is loaded</li>
<li>only a specific intensity range is loaded</li>
<li>only spectra with a given MS level are loaded</li>
<li>only meta data of the whole experiment is loaded (<em>ExperimentalSettings</em>) </li>
</ul>
</div></div><!-- contents -->
<HR style="height:1px; border:none; border-top:1px solid #c0c0c0;">
<TABLE width="100%" border="0">
<TR>
<TD><font color="#c0c0c0">OpenMS / TOPP release 1.11.1</font></TD>
<TD align="right"><font color="#c0c0c0">Documentation generated on Thu Nov 14 2013 11:19:24 using doxygen 1.8.5</font></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|