LinearFold / LinearTurboFold

An end-to-end linear-time algorithm for structural alignment and conserved structure prediction of RNA homologs
Other
11 stars 5 forks source link

Run Error using the compiled binary #4

Closed Zjianglin closed 2 years ago

Zjianglin commented 2 years ago

Hi developer, I compile the LinearTurboFold by make in the repo directory. The make can succeed wth many warning. When I try to use the compiled binary by ./bin/linearturbofold -h, It crashed. However, I can run the original binary file in repo usually. Could you please tell me why? Or should I just use your compiled binary ? Here is some info:

$make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu

$ make -j 10
chmod +x linearturbofold
mkdir -p bin
g++ src/LinearTurboFold.cpp src/SeqFold.cpp src/LinearPartition/src/LinearPartition.cpp src/LinearAlignment/src/LinearAlign.cpp src/probknot.cpp \
    src/ConfigParser.cpp src/utils/common_utils.cpp src/utils/structure_object.cpp \
    src/utils/ansi_string.cpp src/utils/utils.cpp src/utils/TProgressDialog.cpp src/utils/MultiSequence.cpp src/utils/Sequence.cpp \
    src/utils/structure.cpp src/utils/rna_library.cpp \
    src/utils/phmm_aln.cpp src/utils/phmm.cpp src/utils/p_alignment.cpp \
    src/utils/math/matrix.cpp src/utils/random.cpp \
    src/ProbabilisticModel.cpp src/Alignment.cpp src/utils/GuideTree.cpp \
    -std=c++11 -O3 -Dlv -o bin/linearturbofold
src/utils/structure_object.cpp: In static member function ‘static std::vector<t_structure*>* t_structure::read_multi_seq(const char*, bool)’:
src/utils/structure_object.cpp:246:10: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
     fgets(cur_label, MAX_HEADER_LENGTH, f_multi_seq);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp: In member function ‘void t_structure::openct(const char*)’:
src/utils/structure_object.cpp:615:8: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  fscanf(ct_file, "%d", &this->numofbases);
  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:618:7: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  fgets(this->ctlabel, MAX_HEADER_LENGTH, ct_file); // Read remaining of the line.
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:657:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   fscanf(ct_file, "%d %c %d %d %d %d", &index, &raw_nuc, &dangles[i], &stacks[i], &this->basepr[i], &some_val1);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp: In member function ‘void t_structure::openseq(const char*)’:
src/utils/structure_object.cpp:849:7: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  fgets(line_buffer, MAX_HEADER_LENGTH, seq_file);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:852:8: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(line_buffer, MAX_HEADER_LENGTH, seq_file);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:903:7: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  fgets(line_buffer, MAX_HEADER_LENGTH, seq_file);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:906:8: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
   fgets(line_buffer, MAX_HEADER_LENGTH, seq_file);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp: In member function ‘void t_structure::openfasta(const char*)’:
src/utils/structure_object.cpp:975:7: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  fgets(line_buffer, MAX_HEADER_LENGTH, fasta_file);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/structure_object.cpp:1026:7: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  fgets(line_buffer, MAX_HEADER_LENGTH, fasta_file);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/phmm.cpp: In constructor ‘t_phmm::t_phmm(const char*)’:
src/utils/phmm.cpp:53:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   fscanf(fam_par_file, "%lf", &fam_hmm_pars[cnt]);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/phmm.cpp:61:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   fscanf(fam_par_file, "%lf", &fam_thresholds[cnt]);
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

$./bin/linearturbofold -h
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

# your compiled binary can run as usually.
./linearturbofold -h
Error: Unknown command line flag 'h'
Usage: ./linearturbofold [flags]

./linearturbofold:
  --th,--Threshold: set Threshold for ThreshKnot, (DEFAULT=0.3)
    (default: '0.3')        (a number)
  --tkit,--TnIterations: set the number of iteration of ThreshKnot, (DEFAULT=1)
    (default: '1')      (an integer)
  --tkhl,--TnMinHelixLength: set the min. length of helix in predicted
    structures in ThreshKnot, (DEFAULT=3)
    (default: '3')      (an integer)
  --b2,--ckyBeam: set beam size for LinearPartition, (DEFAULT=100)
    (default: '100')        (an integer)
  --b1,--hmmBeam: set beam size for LinearAlignment, (DEFAULT=-1, infinite beam
    size)
    (default: '-1')     (an integer)
  -i,--input: input file must in the fasta format
    (default: '')
  --it,--iter: set the number of iteration, (DEFAULT=3)
    (default: '3')      (an integer)
  -o,--outDir: output directory for predicted MSA and structures
    (default: '')
  --pf,--[no]saveBFs: save Partition Function after the last iteraction,
    (DEFAULT=False)
    (default: 'false')
  --bpp,--[no]saveBPPs: save base pair probabilities after the last iteraction,
    (DEFAULT=False)
    (default: 'false')
  -v,--[no]verbose: print more alignment, folding and runtime information,
    (DEFAULT=FALSE)
    (default: 'false')

gflags:
sizhen commented 2 years ago

Hello,

Thanks for trying to use LinearTurboFold project.

LinearTurboFold can be run by: ./linearturbofold -i input.fasta -o output_dir [OPTIONS] You can check README for OPTIONS. The Python file ./linearturbofold calls the binary file under ./bin. You can check line 52 in ./linearturbofold file.

If you want to call the binary file under ./bin instead, you need to call ./bin/linearturbofold with several required inputs in the following order (same as line 52 in ./linearturbofold file): bin/linearturbofold input_file output_dir hmm_beam cky_beam iteration is_save_bpps is_save_pfs is_verbose TkMinHelixLength TkIterations Threshold These inputs include all OPTIONS in ./linearturbofold:

For example, with specific input values, the command line can be: bin/linearturbofold LinearTurboFold_path/input.fasta LinearTurboFold_path/ltf_results 100 100 3 0 0 0 1 1 0.3 Make sure you create the directory ltf_results under LinearTurboFold repo before running the command.

We recommend you to call ./linearturbofoldinstead of the binary file if it can meet your requirements because you can call./linearturbofold with default values without providing all of them and it can also help to check the inputs.

BTW, thanks for reporting all the warnings. I will fix them. Please let me know if you have other questions.

Best, Sizhen

Zjianglin commented 2 years ago

Thanks for your timely and detailed reply. Now I can normally run the lineaturbofold under the repo directory. Thank you.