Skip to content

Commit

Permalink
Merge pull request #1076 from smehringer/manual_alignment_io
Browse files Browse the repository at this point in the history
[FIX] fix snippet temp file paths.
  • Loading branch information
h-2 authored Jun 6, 2019
2 parents 1eab2ab + 81514e5 commit cfed640
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/tutorial/alignment_file/alignment_file_snippets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ int main()

{
//![writing]
alignment_file_output fout{"/tmp/my.sam", fields<field::FLAG, field::MAPQ>{}};
auto filename = std::filesystem::temp_directory_path()/"out.sam";

alignment_file_output fout{filename, fields<field::FLAG, field::MAPQ>{}};

size_t mymapq{60};
uint8_t flag{0};
Expand Down Expand Up @@ -72,7 +74,9 @@ int main()

{
//![read_custom_fields]
alignment_file_input fin{"/tmp/my.sam", fields<field::ID, field::SEQ, field::FLAG>{}};
auto filename = std::filesystem::temp_directory_path()/"example.sam";

alignment_file_input fin{filename, fields<field::ID, field::SEQ, field::FLAG>{}};

for (auto & [id, seq, flag /*order!*/] : fin)
{
Expand All @@ -85,7 +89,9 @@ int main()

{
//![alignments_without_ref]
alignment_file_input fin{"/tmp/my.sam", fields<field::ID, field::ALIGNMENT>{}};
auto filename = std::filesystem::temp_directory_path()/"example.sam";

alignment_file_input fin{filename, fields<field::ID, field::ALIGNMENT>{}};

for (auto & [ id, alignment ] : fin)
{
Expand All @@ -96,10 +102,12 @@ int main()

{
//![alignments_with_ref]
auto filename = std::filesystem::temp_directory_path()/"example.sam";

std::vector<std::string> ref_ids{"ref"}; // list of one reference name
std::vector<dna5_vector> ref_sequences{"AGAGTTCGAGATCGAGGACTAGCGACGAGGCAGCGAGCGATCGAT"_dna5};

alignment_file_input fin{"/tmp/example.sam", ref_ids, ref_sequences, fields<field::ALIGNMENT>{}};
alignment_file_input fin{filename, ref_ids, ref_sequences, fields<field::ALIGNMENT>{}};

for (auto & [ alignment ] : fin)
{
Expand Down

0 comments on commit cfed640

Please sign in to comment.