0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Biopython]scaffoldをcontigに分割する

Posted at

動機

これを

scaffolds.fa
>scaffold1
ACTGTGCATNNNNNNACGCTGCANnnNNCTGCAnnnCTGCAnnNNNNCTGCA
>scaffold2
ACGACGACGCGATAGAGnnnnnnAGACGAGAGNNNnnACGACGACG

こうしたいことがある。

contigs.fa
>scaffold1_001
ACTGTGCAT
>scaffold1_002
ACGCTGCA
>scaffold1_003
CTGCA
>scaffold1_004
CTGCA
>scaffold1_005
CTGCA
>scaffold2_001
ACGACGACGCGATAGAG
>scaffold2_002
AGACGAGAG
>scaffold2_003
ACGACGACG

Python2PerlSeqKitを使った方法がネットにあったが、Python3で動作するものは見当たらなかった。Python2の実装をベースに書きなおした。元コードは最初のコンティグをアウトプットしないバグ(?)があったのでそれも修正。

scaffold2contigs.py

Usage

$ ./scaffold2contigs.py
usage: scaffold2contigs.py [-h] --input INPUT [--output OUTPUT] [-d DIGIT]

Split scaffolds into contigs

optional arguments:
  -h, --help            show this help message and exit
  --input INPUT, -i INPUT, --in INPUT
                        Input FASTA file
  --output OUTPUT, -o OUTPUT, --out OUTPUT
                        output FASTA file (default: stdout)
  -d DIGIT, --digit DIGIT
                        number of digits for zero-padding (default:3)

References

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?