Differences between revisions 11 and 12
Revision 11 as of 2014-03-19 08:57:18
Size: 4034
Editor: 61
Comment:
Revision 12 as of 2014-03-19 08:57:29
Size: 4036
Editor: 61
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
로컬로 컴퓨터에 설치되어서 돌아가는 [BLAST]. WwwBlast와 다른 점이라면, 모든 명령을 쉘에서 실행한다는 것과, 결과물이 [[HTML]]이 아닌 FlatFile로 출력된다는 것. 로컬로 컴퓨터에 설치되어서 돌아가는 [[BLAST]]. WwwBlast와 다른 점이라면, 모든 명령을 쉘에서 실행한다는 것과, 결과물이 [[HTML]]이 아닌 FlatFile로 출력된다는 것.

로컬로 컴퓨터에 설치되어서 돌아가는 BLAST. WwwBlast와 다른 점이라면, 모든 명령을 쉘에서 실행한다는 것과, 결과물이 HTML이 아닌 FlatFile로 출력된다는 것.

NCBI에서는 Public FTP를 통하여, 거의 모든 OperatingSystem의 바이너리 실행화일 및 소스를 제공한다.

다운로드 : ftp://ftp.ncbi.nih.gov/blast

설치방법

Linux용으로 다운받았을 경우 다음과 같이 설치한다.

blast 디렉토리를 만들고, 그 안으로 복사한후, 다운받은 화일의 압축을 푼다.

$ mkdir blast
$ cd blast
$ tar zxvf blast.linux.tar.Z

.ncbirc 화일을 만든다.

$ vi .ncbirc
[NCBI]
Data=/path/blast/data

blastdb를 취한다. ftp://ftp.ncbi.nih.gov/blast/db 에서 예제로 ecoli.nt.Z 를 받는다. 동일 디렉토리, 혹은 특정 디렉토리에 복사, 압축해제한 후 다음과 같이 formatdb명령을 수행한다.

$ ./formatdb -i ecoli.nt -p F -o T

여기서, -p옵션은 protein이냐를 묻는것이며, 위 DB는 nucleotide이므로 F (false)를 선택한다.

위 formatdb는 압축해제과정 없이 다음처럼 진행될 수 있다.

$ uncompress -c ecoli.nt.Z | ./formatdb -i stdin -p F -o T -n ecoli

기본적인 BLAST검색을 위해서는 다음의 명령을 수행한다.

$ ./blastall -p blastn -d ecoli.nt -i test.txt -o test.out

유용한 스크립트

standalone blast의 많은 결과 레코드를 보기 불편할때가 많다. 다중 쿼리의 결과를 1등 hit 만 뽑아서, 이를 Excel로 변환해주는 스크립트

   1 import sys, os
   2 from Bio.Blast import NCBIStandalone
   3 
   4 sys.stdout.write('\t'.join(map(str,[
   5     "Query", "DB", "ACC", "DESC", "Expect", "Identities", "Positives", "Gaps", "ORF"
   6     ]))+'\n')
   7 for b in NCBIStandalone.Iterator(sys.stdin, NCBIStandalone.BlastParser()):
   8     db = ""; acc = ""; desc = ""; expect = "" 
   9     identities = ""; positives = ""; gaps=""; orf=""
  10     if b.alignments:
  11         alignment = b.alignments[0]
  12         words = alignment.title.replace('\n','').split('|')
  13         db = words[0]
  14         acc = words[1]
  15         desc = words[2]
  16         hsp = alignment.hsps[0]
  17         expect = hsp.expect
  18         identities = '/'.join(map(str,hsp.identities))
  19         positives = '/'.join(map(str,hsp.positives))
  20         gaps = '/'.join(map(str,hsp.gaps))
  21         if hsp.sbjct_start == 1 and hsp.sbjct[0] == 'M':
  22             orf="orf"
  23     sys.stdout.write('\t'.join(map(str,[
  24         b.query, db, acc, desc, expect, identities, positives, gaps, orf
  25         ]))+'\n')

위 스크립트를 bl2xls.py로 저장한 후, 아래와 같이 실행한다.

$ python bl2xls.py < some.blast > some.xls

QnA

I just get only first element of blast result. I can't figure out what I have missed. Could anyone suggest to fix this? -- cyppi 2005-09-12 09:40:57

  • I did various experiments but it has no problem. pls let me know error message or your input blast result. -- yong27 2005-09-12 10:58:29

I use Input as like this and get result like this. And I use blast option like

$ blastall  -d ../blast/nt -p blastn -o result -i input

and I get result like

$ python bl2xls.py < result 
Query   DB      ACC     DESC    Expect  Identities      Positives       Gaps    ORF
for test        >ref    XM_466291.1      Oryza sativa (japonica cultivar-group),  mRNA  0.2423/24    None/None       None/None1 

pls let me know what's wrong w/ these things.. -- cyppi 2005-09-12 11:46:07

  • This script is for multi-query blast output and first hit parsing, It has no problem --yong27

    • Ah~~ now I can understand!! I misunderstood that all the alignments in the result should showed. :) Thanks for useful scripts :) -- cyppi 2005-09-12 12:55:07

StandAloneBlast (last edited 2014-03-19 08:57:29 by 61)

web biohackers.net