Function
save
This functions saves an index to disk.
save(index, fileName [, mode])
Include Headers
seqan/index.h
Parameters

index | The index to be saved to disk. Types: Index
fileName | C-style character string containing the file name.
mode | The combination of flags defining how the file should be opened. Default: OPEN_RDWR | OPEN_CREATE | OPEN_APPEND Remarks: To open a file read-only, write-only or to read and write use OPEN_RDONLY, OPEN_WRONLY, or OPEN_RDWR. To create or overwrite a file add OPEN_CREATE. To append a file if existing add OPEN_APPEND. To circumvent problems, files are always opened in binary mode.

Return Values
A bool which is true on success.
Member of
Index
Examples
The following code shows how the function open is used with indices.
File "index_open_save.cpp"

1 | #include <seqan/index.h>
2 |
3 | using namespace seqan;
4 |
5 | int main ()
6 | {
7 | typedef StringSet<String<char> > TText;
8 | typedef Index<TText> TIndex;
9 | typedef SAValue<TIndex>::Type TSAValue;
10 |
11 | TText text;
12 | appendValue(text, "MISSISSIPPI");
13 | appendValue(text, "MYMISSISAHAPPY");
14 |
15 | TIndex saveIndex(text);
16 |
17 | // Because indices are build on demand we fore the index creation here.
18 | indexCreate(saveIndex, FibreSA());
19 |
20 | const char * tempFileName = SEQAN_TEMP_FILENAME();
21 | std::cout << save(saveIndex, tempFileName) << std::endl;
22 |
23 | // In a different program
24 | TIndex openIndex;
25 | std::cout << open(openIndex, tempFileName) << std::endl;
26 |
27 | return 0;
28 | }

1
1
SeqAn - Sequence Analysis Library - www.seqan.de

Page built @2014/10/13 16:12:57