bamtosam.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. biobambam
  3. Copyright (C) 2009-2014 German Tischler
  4. Copyright (C) 2011-2014 Genome Research Limited
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. **/
  16. #include <libmaus2/util/ArgInfo.hpp>
  17. #include <libmaus2/bambam/BamDecoder.hpp>
  18. int main(int argc, char * argv[])
  19. {
  20. try
  21. {
  22. libmaus2::util::ArgInfo const arginfo(argc,argv);
  23. libmaus2::bambam::BamDecoder bamdec1(std::cin);
  24. libmaus2::bambam::BamHeader const & header1(bamdec1.getHeader());
  25. libmaus2::bambam::BamAlignment const & al1 = bamdec1.getAlignment();
  26. std::cout << header1.text;
  27. while ( bamdec1.readAlignment() )
  28. std::cout << al1.formatAlignment(header1) << "\n";
  29. std::cout.flush();
  30. return EXIT_SUCCESS;
  31. }
  32. catch(std::exception const & ex)
  33. {
  34. std::cerr << ex.what() << std::endl;
  35. return EXIT_FAILURE;
  36. }
  37. }