Compare commits

...

4 commits

Author SHA1 Message Date
c1b7df1172 add: README 2024-05-07 12:52:23 +08:00
6989dc4459 add: compile project 2024-05-07 12:39:45 +08:00
81ffd07220 polish: same style 2024-05-07 12:39:13 +08:00
713742d668 fix: -Wsign-compare 2024-05-07 12:38:56 +08:00
4 changed files with 38 additions and 2 deletions

12
CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.0)
project(tnt_script)
SET( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set(CMAKE_CXX_STANDARD 11)
add_executable(gene_marker gene_marker.cpp)
add_executable(trim_marker trim_marker.cpp)
target_compile_options(gene_marker PRIVATE -Wall -Wextra -pedantic -O3)
target_compile_options(trim_marker PRIVATE -Wall -Wextra -pedantic -O3)

24
README.md Normal file
View file

@ -0,0 +1,24 @@
- Author: Guoyi Zhang
- License: GPLv2
## gene_marker
Generate fasta file which `m` means selected position by Gblocks from Gblocks html report file.
Usage:
```
gene_marker <input_file> <output_file>
```
## trim_marker
Trim the multi-sequence-alignment based on the marker which `m` indicates selected position.
Usage:
```
trim_marker <marker_fasta_file> <input_fasta_file> <output_file>
```

View file

@ -15,7 +15,7 @@
bool checkArguments(int argc, char* argv[]) {
if (argc != 3) {
std::cerr << "Usage: " << argv[0]
<< " input_file output_file\n";
<< " <input_file> <output_file>\n";
return false;
}
return true;

View file

@ -58,7 +58,7 @@ void extract_characters(const std::string& line, const std::string& file,
const std::vector<int> positions) {
std::ofstream outfile(file, std::ios::app);
std::string new_line;
for (int pos : positions) {
for (unsigned long pos : positions) {
if (pos <= line.length()) {
new_line += line[pos - 1]; // start from 0
}