macでインフォマティクス

macでインフォマティクス

HTS (NGS) 関連のインフォマティクス情報についてまとめています。

ABRIDGE

 

 技術の進歩により、シークエンシングマシンは膨大な量の遺伝子データを生成するようになり、ストレージの需要が増加している。多くのゲノム解析ソフトウエアは、リードアライメントをトランスクリプトームアセンブリや遺伝子数推定などの目的で利用している。本発表では、可逆圧縮非可逆圧縮の両方のオプションを提供するSAMアライメントファイルのための最新圧縮器ABRIDGEを紹介する。このリファレンスベースのファイル圧縮器は、あらゆる圧縮ソフトウェアの中で最高の圧縮率を達成し、より少ない容量とより速いファイル転送を保証する。このソフトウェアの中心は、冗長でない情報を保持する新しいアルゴリズムにある。この新しいアプローチにより、ABRIDGEはRNA-Seqリードで2番目に優れた圧縮器よりも16%高い圧縮率を、DNA-Seqリードでは35%以上の圧縮率を達成することができた。また、ABRIDGEは、ファイル全体を解凍することなく、ランダムにアクセスする場所を指定するオプションも提供している。ABRIDGEはMITライセンスのもとで配布されており、GitHub ( https://github.com/sagnikbanerjee15/Abridge ) およびDocker hubから入手することができる。ユーザーコミュニティが既存のパイプラインにABRIDGEを採用し、この分野での更なる研究を促進することを期待している。

 

インストール

v1.0.0をダウンロードしてテストした。

Github

wget https://github.com/sagnikbanerjee15/Abridge/archive/refs/tags/ABRIDGE_v1.0.0.tar.gz
tar -xvzf ABRIDGE_v1.0.0.tar.gz
cd Abridge-ABRIDGE_v1.0.0/
echo "export PATH=\$PATH:$(pwd)" >> ~/.bashrc
source ~/.bashrc

>  ./abridge -h

usage: run_abridge [-h] [--container_name CONTAINER_NAME] [-o OUTPUT_DIRECTORY] (-isam INPUTSAMFILENAMES | -iabr INPUTABRFILENAMES) -g GENOME [-cmp] [-dcmp] [-r] [-H] [-l LEVEL] [-ss] [-igqual]

                   [-qual QUALITY] [-gsc] [-gm] [-gs] [-gu] [-sq] [-aq] [-q] [-n CPU] [-run_diagnostics] [-p POSITIONS] [-rp READ_PREFIX] [--keep_intermediate_error_files]

                   [--error_directory ERROR_DIRECTORY]

 

Compress alignments for storage, decompress from compressed file, view alignments from random locations and generate coverages

 

optional arguments:

  -h, --help            show this help message and exit

  -isam INPUTSAMFILENAMES, --inputsamfilenames INPUTSAMFILENAMES

                        Enter the name of the alignment file you wish to compress. Alignments in SAM format only is expected. Ensure that the file is sorted by coordinate. Also, files must have the header section with the reference information available. You can compress only one file at a time.

  -iabr INPUTABRFILENAMES, --inputabrfilenames INPUTABRFILENAMES

                        Enter the name of the compressed alignment files you wish to merge. These files must be compressed using abridge. You can decompress only one file at a time.

  -cmp, --compress      Set this option if you wish to compress the alignment file

  -dcmp, --decompress   Set this option if you wish to decompress the alignment file

  -r, --random          Retrieve alignments from random locations

  -H, --header          Print only the header of reference sequences during decompression

 

Required arguments:

  --container_name CONTAINER_NAME, -cn CONTAINER_NAME

                        Enter the name of the container. You can choose any string. Please ensure that parallel runs of the software should not have the same container name

  -o OUTPUT_DIRECTORY, --output_directory OUTPUT_DIRECTORY

                        Enter the name of the output directory. If nothing is specified then the compressed file will be put in the same location as the input samfile

  -g GENOME, --genome GENOME

                        Enter a single fasta file for the reference

 

Optional arguments:

  -l LEVEL, --level LEVEL

                        This can accept an integer from the set (1,2,3). If level is set to 1 then abridge will perform the fastest but low compression. abridge will use brotli to compress. Decompression will be fast. Setting level to 2 will prompt abridge to perform the medium level compression using 7z. Compression will take time but decompression will be fast. If level is set to 3 then abridge will perform the best compression using 7paq. Both compression and decompression will take average time to complete

  -ss, --ignore_scores  Request abrigde to store the quality scores and the alignment score

  -igqual, --ignore_quality_scores

                        Ignore all quality scores

  -qual QUALITY, --quality QUALITY

                        Enter dummy quality scores while decompressing

  -gsc, --ignore_soft_clippings

                        No soft clippings will be stored. Read will be trimmed down to only the portion which matched to nucleotides in the reference

  -gm, --ignore_mismatches

                        All mismatches will be ignored

  -gs, --ignore_sequence

                        No nucleotide sequence will be produced during decompression

  -gu, --ignore_unmapped_reads

                        Request abridge to discard all reads that are unmapped

  -sq, --save_all_quality_scores

                        Request abridge to save all quality scores

  -aq, --save_exact_quality_scores

                        Adjust quality scores for matched bases to achieve better encoding. For more details please check ...

  -q, --quiet           Prevent abridge from printing any log information. By default logging is enables

  -n CPU, --cpu CPU     Enter the number of CPU cores to be used. This option will be used during compression or decompression.

  -run_diagnostics, --run_diagnostics

                        abridge will run diagnostics on the cigar compression and decompression. It will exit on discovery of any discrepancies

  -p POSITIONS, --positions POSITIONS

                        Enter the position as chromosome:start-end from which reads will be retrieved

  -rp READ_PREFIX, --read_prefix READ_PREFIX

                        Enter a read prefix for decompression - valid only for random access

  --keep_intermediate_error_files, -kief

                        Set this argument if you wish to preserve the intermediate error files to assess time and memory usage. Default behaviour is to delete those

  --error_directory ERROR_DIRECTORY, -edir ERROR_DIRECTORY

                        Enter a directory where all error files will be stored. If nothing is specified then error files will be stored in the output directory

 

 

 

 

テストラン

すべての可能なパラメータと2つの異なる入力ファイルを使ったテスト。実行されるコマンドは2000以上あるため、十分な時間と余裕のあるコア数で実行する。

cd Abridge-ABRIDGE_v1.0.0/
CPU=96 # Enter the number of CPUs
run_abridge --test --output_directory $PWD/abridge_tests --cpu $CPU

試した時は失敗した。

 

 

実行方法

abridgeはシングルCPUで動作するように開発されているが、1つのCPUコアをそれぞれに提供することで、複数のサンプルをまとめて実行することができる。

ロスレス圧縮

abridge \
--compress \
--output_directory $PWD/abridge_compressed \
--inputsamfilenames <Name of input SAM file> \
--genome <Name of the genome file> \
--level 2 \
--save_all_quality_scores \
--save_exact_quality_scores \
--container_name compress \
1> $PWD/abridge_compressed.output \
2> $PWD/abridge_compressed.error 

abridgeは圧縮時にパラメータを保存する。このパラメータは伸長時に再利用される。

 

Lossy compressionも可能。

run_abridge \
--compress \
--output_directory $PWD/abridge_compressed \
--inputsamfilenames <Name of input SAM file> \
--genome <Name of the genome file> \
--level 2 \
--ignore_soft_clippings \
--ignore_mismatches \
--ignore_scores \
--ignore_quality_scores \
--container_name compress \
1> $PWD/abridge_compressed.output \
2> $PWD/abridge_compressed.error 

 

マニュアル通り進めるとエラーになります。修正できたら追記します。

引用

ABRIDGE: An ultra-compression software for SAM alignment files
Banerjee S, Andorf C
bioRxiv, 05 Jan 2022