#include "applications/ExportExample.hh" /** * Project : CASAVA * Module : $RCSfile: ExportExample.cpp,v $ * @author : Lukasz Szajkowski * Copyright : Copyright (c) Illumina 2008, 2009. All rights reserved. * ** This software is covered by the "Illumina Genome Analyzer Software ** License Agreement" and the "Illumina Source Code License Agreement", ** and certain third party copyright/licenses, and any user of this ** source file is bound by the terms therein (see accompanying files ** Illumina_Genome_Analyzer_Software_License_Agreement.pdf and ** Illumina_Source_Code_License_Agreement.pdf and third party ** copyright/license notices). * */ #include #include #include #include "common/Alignment.hh" namespace ca { namespace applications { using namespace std; using namespace casava::common; int ExportExample::run() { std::ostringstream os; cout << "[" << "Start" << "]\n"; const casava::common::Compression &noCompression = casava::common::CompressionFactory::none(); //casava::common::SequenceWriter sequenceWriter(qseqFilePath.string() + saveSuffix_, noCompression); const casava::common::Alignment defaultAlignment; const casava::common::Tile customTile("a name", 11, 12, 13); const casava::common::Spot customSpot(customTile, 24, 25); const casava::common::Sequence customSequence(customSpot, "ACG", 37, "asdf", "qwerty", true); const casava::common::Match match1("chr.X", "contig1", 10, casava::common::Match::Forward); const casava::common::Match match2("chr.Y", "contig2", 20, casava::common::Match::Reverse); const casava::common::Alignment customAlignment(customSequence, match1, "descr.1", 1, match2, 2); std::string exportFilePath1 = "./s_1_1_export.txt"; std::string exportFilePath2 = "./s_1_2_export.txt"; std::string exportFilePath3 = "./s_1_2_export_final.txt"; casava::common::Ofstream stream(exportFilePath1, noCompression); //stream.open(exportFilePath); if (stream.is_open() && stream.good()) { cout << "Writing " << exportFilePath1 << "\n"; } else { cout << "Error: failed to open. Qval files will not be produced." << exportFilePath1 << "\n"; exit(1); } stream << customAlignment; casava::common::AlignmentWriter alignmentWriter(exportFilePath2, noCompression); //alignmentWriter.open(exportFilePath2); if (alignmentWriter.is_open() && alignmentWriter.good()) { cout << "Writing " << exportFilePath2 << "\n"; } else { cout << "Error: failed to open. Qval files will not be produced." << exportFilePath2 << "\n"; exit(1); } alignmentWriter << customAlignment; alignmentWriter.put(customAlignment); alignmentWriter.close(); casava::common::AlignmentReader alignmentReader(exportFilePath2, noCompression); if (alignmentReader && alignmentReader.good()) { cout << "Reading from " << exportFilePath2 << "\n"; } else { cout << "Error: failed to open. Qval files will not be produced." << exportFilePath2 << "\n"; exit(1); } casava::common::AlignmentWriter alignmentWriterFinal(exportFilePath3, noCompression); casava::common::Alignment newAlignment; while (alignmentReader.get(newAlignment) && alignmentReader.good()) { cout << "Line\n"; alignmentWriterFinal << newAlignment; } //alignmentWriterFinal.put(newAlignment); //count << newAlignment; cout << "[" << "End" << "]\n"; return 0; } } } // end namespace casava{ namespace { applications