LoginSignup
0
1

More than 5 years have passed since last update.

Trinityの結果からcompleteだけを抜き出す

Last updated at Posted at 2017-04-16

わざわざ書くほどでも無いけど

備忘録代わりにおいておきます
Trinityの結果ファイルからTransdocodeで予測されたcompleteな配列だけを取り出すスクリプトです

compgene_finder.sh
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from Bio import SeqIO
import csv


fasta_in = sys.argv[1]                            #1番目の引数にfastaファイルを指定する。
for record in SeqIO.parse(fasta_in, 'fasta'): #fastaファイルを開くSeqIOを使ってパースする(1項目づつ読み込む)
        id_part = record.id                       #fastaのID部分を読み込む
        desc_part = record.description                       #fastaのID部分を読み込む
        seq = record.seq                          #fastanの配列部分を読み込む
        if 'type:complete' in desc_part:
                fasta_seq = '>' +  desc_part + '\n' + seq      #fasta形式に整えて
                print(fasta_seq)                  #標準出力にfastaを出力
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