2017年7月21日金曜日

エンコーディングの問題

たまたま入手したファイルが開けず苦労した。
mi で調べると、エンコーディングが Windows-1252 だった。

これを R で解決する方法。
readLines() で encoding を指定して読み込み、write() で書き出す。

gff <- readLines("XXX.gff3", encoding = "windows-1252")
write(gff, file = "XXX_UTF8.gff3")

これでとりあえず問題回避できる。

2017年7月6日木曜日

homebrew: tbl2asn installation failed

homebrew で tbl2asn をインストールできないときの対処法。
When installation of tbl2asn through homobrew failed.


Error: SHA256 mismatch
Expected: 429d63ee3c36d1f2f6322c62c6089d5ee8a8b089e5cc9373e298e017bcbbb9ec
Actual: bfaff2308fd58b94730639b9c6b520ca1884ede9979389cfc9bc4902ae75702c
Archive: /Users/XXX/Library/Caches/Homebrew/tbl2asn-25.3.gz
To retry an incomplete download, remove the file above.


下のファイルをテキストで開いて、変更を加える。
Open the .rb file as a text and change the sha256 as bellow.

File location:
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/tbl2asn.rb

### original
#   if OS.mac?
#     url "ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/converters/by_program/tbl2asn/mac.tbl2asn.gz"
#     sha256 "429d63ee3c36d1f2f6322c62c6089d5ee8a8b089e5cc9373e298e017bcbbb9ec"

### fixed
#   if OS.mac?
#     url "ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/converters/by_program/tbl2asn/mac.tbl2asn.gz"
#     sha256 "bfaff2308fd58b94730639b9c6b520ca1884ede9979389cfc9bc4902ae75702c"