User Tools

Site Tools


downloading_genomes_from_ncbi_ftp_site

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
downloading_genomes_from_ncbi_ftp_site [2019/03/13 16:51] – [실제 사례] hyjeongdownloading_genomes_from_ncbi_ftp_site [2021/06/09 14:39] – [NCBI FTP 사이트에서 유전체 정보 파일 다운로드하기] hyjeong
Line 1: Line 1:
 ====== NCBI FTP 사이트에서 유전체 정보 파일 다운로드하기 ====== ====== NCBI FTP 사이트에서 유전체 정보 파일 다운로드하기 ======
 +Entrez API를 사용하려면 [[https://ncbiinsights.ncbi.nlm.nih.gov/|NCBI Insights]]에서 제공하는 문서인 [[https://ncbiinsights.ncbi.nlm.nih.gov/2013/02/19/how-to-download-bacterial-genomes-using-the-entrez-api/|How to Download Bacterial Genomes Using the Entrez API]]를 참조하기 바란다.
 +
 +<color #ed1c24>여기서 소개하는 방법은 이제 더 이상 권장하지 않는다.</color> 왜냐하면 [[https://github.com/kblin/ncbi-genome-download|ncbi-genome-download]]라는 탁월한 스크립트가 있기 때문이다.  기관의 내부 전산망을 이용하는 경우 SSL 인증서 문제로 약간 애를 먹을 수는 있을 것이다. --- //[[hyjeong@kribb.re.kr|Haeyoung Jeong]] 2021/06/09 14:37//
 +
 ** [최신 소식] ** 2016년 9월 22일을 기하여 ftp://ftp.ncbi.nlm.nih.gov/genomes/all 하위 구조가 바뀌었다. 한 디렉토리 안에 너무나 많은 서브디렉토리가 존재하는 문제를 피하기 위하여 assembly accession prefix인 9자리 숫자를 3개씩 끊어서 3단계의 디렉토리 구조로 전환한 것이다([[ftp://ftp.ncbi.nlm.nih.gov/genomes/all/README_change_notice.txt|원본 문서]]). ** [최신 소식] ** 2016년 9월 22일을 기하여 ftp://ftp.ncbi.nlm.nih.gov/genomes/all 하위 구조가 바뀌었다. 한 디렉토리 안에 너무나 많은 서브디렉토리가 존재하는 문제를 피하기 위하여 assembly accession prefix인 9자리 숫자를 3개씩 끊어서 3단계의 디렉토리 구조로 전환한 것이다([[ftp://ftp.ncbi.nlm.nih.gov/genomes/all/README_change_notice.txt|원본 문서]]).
  
Line 46: Line 50:
   $ sed -r 's|(ftp://ftp.ncbi.nlm.nih.gov/genomes/all/.+\/)(GCF_.+)|\1\2\/\2_genomic.gbff.gz|' list_all_ftp_path > list_all_files_with_path_gbff   $ sed -r 's|(ftp://ftp.ncbi.nlm.nih.gov/genomes/all/.+\/)(GCF_.+)|\1\2\/\2_genomic.gbff.gz|' list_all_ftp_path > list_all_files_with_path_gbff
   $ sed -r 's|(ftp://ftp.ncbi.nlm.nih.gov/genomes/all/.+\/)(GCF_.+)|\1\2\/\2_protein.faa.gz|' list_all_ftp_path > list_all_files_with_path_faa   $ sed -r 's|(ftp://ftp.ncbi.nlm.nih.gov/genomes/all/.+\/)(GCF_.+)|\1\2\/\2_protein.faa.gz|' list_all_ftp_path > list_all_files_with_path_faa
-  # ~_protein.faa.gz와 ~_translated_cds.faa.gz는 서열 ID와 description의 모양새가 다름에 유의하. locus tag등 월등하게 많은 정보를 수록한 것은 후자이다.+  # ~_protein.faa.gz와 ~_translated_cds.faa.gz는 서열 ID와 description의 모양새가 다름에 유의하. locus tag등 월등하게 많은 정보를 수록한 것은 후자이다.
   $ mkdir 01_fna   $ mkdir 01_fna
   $ cd 01_fna   $ cd 01_fna
Line 61: Line 65:
      
 === id2name에 대한 부연 설명 === === id2name에 대한 부연 설명 ===
-id2name 파일을 매개로 하여 GCF_000469945.2_ASM46994v2_genomic.fna.gz라는 파일이 Paenibacillus_sp._P22_GCF_000469945.2.fna로 바뀌게 된다. 변경 후 파일명의 앞부분을 차지하는 균주 이름은 당연히 assembly summary file의 여덟번째 컬럼에서 유래한다. 하지만 실제 assembly summary 파일을 열어보면 파일명으로 쓰기에 적합하지 않는 문자가 들어있는 경우가 상당히 많다. 예를 들어 공백, 세미콜론, 괄호 등이 그러하다. 이를 되도록 철저하게 밑줄로 바꾸는 것이 중요하다. 이미 파일 이름을 다 바꾼 상태에서 GCF_000469945.2.fna처럼 assembly accession만 남기고 싶다면 [[http://blog.genoglobe.com/2019/03/bash-shell.html|[정해영의 블로그] BASH-shell: 구분자가 포함된 문자열의 조작 기법]]을 참조하라.+id2name 파일을 매개로 하여 GCF_000469945.2_ASM46994v2_genomic.fna.gz라는 파일이 Paenibacillus_sp._P22_GCF_000469945.2.fna로 바뀌게 된다. 변경 후 파일명의 앞부분을 차지하는 균주 이름은 당연히 assembly summary file의 여덟번째 컬럼에서 유래한다. 하지만 실제 assembly summary 파일을 열어보면 파일명으로 쓰기에 적합하지 않는 문자가 들어있는 경우가 상당히 많다. 예를 들어 공백, 세미콜론, 괄호 등이 그러하다. 이를 되도록 철저하게 밑줄로 바꾸는 것이 중요하다. 이미 파일 이름을 다 바꾼 상태에서 GCF_000469945.2.fna처럼 assembly accession만 남기고 싶다면 [[http://blog.genoglobe.com/2019/03/bash-shell.html|[정해영의 블로그] Bash, shell: 구분자가 포함된 문자열의 조작 기법]]을 참조하라.
  
 === while loop 대신 xargs 사용하기 === === while loop 대신 xargs 사용하기 ===
downloading_genomes_from_ncbi_ftp_site.txt · Last modified: 2023/06/22 17:12 by hyjeong