| 728 | } |
| 729 | |
| 730 | void InspectOutfile::generateTrieDB( |
| 731 | const String& source_database_filename, |
| 732 | const String& database_filename, |
| 733 | const String& index_filename, |
| 734 | bool append, |
| 735 | const String& species) |
| 736 | { |
| 737 | ifstream source_database(source_database_filename.c_str()); |
| 738 | if (!source_database) |
| 739 | { |
| 740 | throw Exception::FileNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, source_database_filename); |
| 741 | } |
| 742 | |
| 743 | // get the labels |
| 744 | String ac_label, sequence_start_label, sequence_end_label, comment_label, species_label; |
| 745 | getLabels(source_database_filename, ac_label, sequence_start_label, sequence_end_label, comment_label, species_label); |
| 746 | |
| 747 | ofstream database; |
| 748 | if (append) |
| 749 | { |
| 750 | database.open(database_filename.c_str(), ios::app | ios::out); |
| 751 | } |
| 752 | else |
| 753 | { |
| 754 | database.open(database_filename.c_str()); |
| 755 | } |
| 756 | if (!database) |
| 757 | { |
| 758 | source_database.close(); |
| 759 | source_database.clear(); |
| 760 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, database_filename); |
| 761 | } |
| 762 | ofstream index; |
| 763 | if (append) |
| 764 | { |
| 765 | index.open(index_filename.c_str(), ios::app | ios::out | ios::binary); |
| 766 | } |
| 767 | else |
| 768 | { |
| 769 | index.open(index_filename.c_str(), ios::out | ios::binary); |
| 770 | } |
| 771 | if (!index) |
| 772 | { |
| 773 | source_database.close(); |
| 774 | source_database.clear(); |
| 775 | database.close(); |
| 776 | database.clear(); |
| 777 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, index_filename); |
| 778 | } |
| 779 | |
| 780 | // using flags to mark what has already been read |
| 781 | // the flags |
| 782 | unsigned char ac_flag = 1; |
| 783 | unsigned char species_flag = !species.empty() * 2; // if no species is given, take all proteins |
| 784 | unsigned char sequence_flag = 4; |
| 785 | // the value |
| 786 | unsigned char record_flags = 0; |
| 787 |
no test coverage detected