mrkn / pycall.rb

Calling Python functions from the Ruby language
MIT License
1.06k stars 75 forks source link

string tail is unexpectedly destroyed #32

Closed ngoto closed 7 years ago

ngoto commented 7 years ago

When running https://gist.github.com/ngoto/50fd9216686d9f98f3adb25c7b325122 (with data file downloaded from http://togows.org/entry/ncbi-nucleotide/J00231.fasta) in most cases, the tail of the seq string is unexpectedly destroyed by binary characters. The length of the seq string is the same as expected (1089), but the content is destroyed.

For example,

$ ruby try01-seqio.rb
id:  "J00231.1"
description:  "J00231.1 Human Ig gamma3 heavy chain disease OMM protein mRNA"
seq:  "CCTGGACCTCCTGTGCAAGAACATGAAACANCTGTGGTTCTTCCTTCTCCTGGTGGCAGCTCCCAGATGGGTCCTGTCCCAGGTGCACCTGCAGGAGTCGGGCCCAGGACTGGGGAAGCCTCCAGAGCTCAAAACCCCACTTGGTGACACAACTCACACATGCCCACGGTGCCCAGAGCCCAAATCTTGTGACACACCTCCCCCGTGCCCACGGTGCCCAGAGCCCAAATCTTGTGACACACCTCCCCCATGCCCACGGTGCCCAGAGCCCAAATCTTGTGACACACCTCCCCCGTGCCCNNNGTGCCCAGCACCTGAACTCTTGGGAGGACCGTCAGTCTTCCTCTTCCCCCCAAAACCCAAGGATACCCTTATGATTTCCCGGACCCCTGAGGTCACGTGCGTGGTGGTGGACGTGAGCCACGAAGACCCNNNNGTCCAGTTCAAGTGGTACGTGGACGGCGTGGAGGTGCATAATGCCAAGACAAAGCTGCGGGAGGAGCAGTACAACAGCACGTTCCGTGTGGTCAGCGTCCTCACCGTCCTGCACCAGGACTGGCTGAACGGCAAGGAGTACAAGTGCAAGGTCTCCAACAAAGCCCTCCCAGCCCCCATCGAGAAAACCATCTCCAAAGCCAAAGGACAGCCCNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNGAGGAGATGACCAAGAACCAAGTCAGCCTGACCTGCCTGGTCAAAGGCTTCTACCCCAGCGACATCGCCGTGGAGTGGGAGAGCAATGGGCAGCCGGAGAACAACTACAACACCACGCCTCCCATGCTGGACTCCGACGGCTCCTTCTTCCTCTACAGCAAGCTCACCGTGGACAAGAGCAGGTGGCAGCAGGGGAACATCTTCTCATGCTCCGTGATGCATGAGGCTCTGCACAACCGCTACACGCAGAAGAGCCTCTCCCTGTCTCCGGGTAAATGAGTGCCATGGCCGGCAAGCCCCCGCTCCCCGGGCTCTCGGGGTCGCGCGAGGATGCTTGGCACGTACCCCGTGTACATACTTCCCAGGCACCCAGCATGGA\xB1\x05\x00\x00\x00\x00\x00\x00X\x8B\xAC\x8C\x92\x7F\x00\x00X\x8B\xAC\x8C\x92\x7F\x00\x00\x00"
mrkn commented 7 years ago

@ngoto Please tell me your platform, Ruby version, and Python version.

ngoto commented 7 years ago

I'm running this on: OS: Debian GNU/Linux 9.1 on VMware Workstation 12 (on Windows 8.1) Architecture: x86_64 Python: 3.6.1 (installed via miniconda) Ruby: 2.4.1p111 (installed via rbenv + ruby-build)

$ python --version
Python 3.6.1 :: Continuum Analytics, Inc.
$ conda list python
# packages in environment at /home/ngoto/miniconda3:
#
biopython                 1.70                     py36_1    conda-forge
mmtf-python               1.0.7                    py36_0    conda-forge
msgpack-python            0.4.8                    py36_0    conda-forge
python                    3.6.1                         2  
python-dateutil           2.6.1                    py36_0    conda-forge
$ which python
/home/ngoto/miniconda3/bin/python
ngoto@debian9-sx4:~/works/bpbr$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ which ruby
/home/ngoto/.rbenv/shims/ruby
$ cat .ruby-version 
2.4.1
$ echo $PATH
/home/ngoto/.rbenv/shims:/home/ngoto/.rbenv/bin:/home/ngoto/miniconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
mrkn commented 7 years ago

@ngoto Would you please confirm this issue is fixed at the commit 4b1307b?

ngoto commented 7 years ago

I got correct string by using d414efb3de18e7065ed3f14fe651098b94992c5a thank you!