bioinfo:유전체_주석화_genome_annotation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
bioinfo:유전체_주석화_genome_annotation [2023/06/29 10:59] – [개별 사용을 위하여 PGAP을 실행하기] hyjeong | bioinfo:유전체_주석화_genome_annotation [2024/08/05 15:12] (current) – [PGAP 사용하기] hyjeong | ||
---|---|---|---|
Line 10: | Line 10: | ||
===== PGAP 사용하기 ===== | ===== PGAP 사용하기 ===== | ||
- | Prokaryotic Genome Annotation System(PGAP, | + | Prokaryotic Genome Annotation System(PGAP, |
# 현재 배포 중인 PGAP의 최신 버전 확인하기 | # 현재 배포 중인 PGAP의 최신 버전 확인하기 | ||
$ curl --silent " | $ curl --silent " | ||
$ cat VERSION | $ cat VERSION | ||
- | | + | |
PGAP은 docker 환경을 사용하므로, | PGAP은 docker 환경을 사용하므로, | ||
Line 242: | Line 242: | ||
all 7 | all 7 | ||
+ | 이제부터의 작업은 R에서 실시한다. 모든 *.tsv.txt 파일을 모아서 하나로 병합한 뒤 results.txt 파일에 저장한다. | ||
+ | |||
+ | rm(list=ls()) | ||
+ | list.filenames = list.files(pattern=" | ||
+ | # create an empty list | ||
+ | list.data=list() | ||
+ | length(list.filenames) | ||
+ | # create a loop to read in your data | ||
+ | for (i in 1: | ||
+ | { | ||
+ | list.data[[i]] = read.table(list.filenames[i], | ||
+ | colnames(list.data[[i]]) = c(" | ||
+ | } | ||
+ | | ||
+ | # full outer join | ||
+ | for (i in 1: | ||
+ | { | ||
+ | df = merge(x=list.data[[i]], | ||
+ | list.data[[i+1]] = df | ||
+ | } | ||
+ | df = list.data[[length(list.filenames)]] | ||
+ | df[is.na(df)] = 0 | ||
+ | rownames(df) = df[,1] | ||
+ | df = df[,-1] | ||
+ | colnames(df) = gsub(" | ||
+ | | ||
+ | # 최종 확인 | ||
+ | dim(df) | ||
+ | View(df) | ||
+ | | ||
+ | # accession을 species로 치환 | ||
+ | data = read.table(" | ||
+ | key = data[,1] | ||
+ | names(key) = data[,2] | ||
+ | | ||
+ | x = c() | ||
+ | for (i in names(df)){ | ||
+ | temp = names(key)[key==i] | ||
+ | x = append(x, temp) | ||
+ | } | ||
+ | | ||
+ | df = rbind(df, x) | ||
+ | rownames(df)[7] = " | ||
+ | View(df) | ||
+ | | ||
+ | # row를 정렬하고 transpose | ||
+ | sorted = c(" | ||
+ | df = df[sorted,] | ||
+ | df.2 = as.data.frame(t(df)) | ||
+ | df.2[,2:7] = sapply(df.2[, | ||
+ | str(df.2) | ||
+ | write.table(df.2," | ||
+ | |||
+ | results.txt 파일을 이용하여 다양한 변형 및 탐색을 실시해 보자. 이때 dplyr 패키지가 매우 유용하게 쓰인다. 각 species에 대하여 family에 정의된 InterPro entry에 해당하는 유전자의 최댓값은 얼마인가? | ||
+ | |||
+ | # R 세션을 끝내고 다시 시작한다고 가정함 | ||
+ | # 혹은 rm(list=ls())를 실행하여 변수를 초기화한다. | ||
+ | # reading from pre-existing file | ||
+ | df = read.table(" | ||
+ | # accession을 추출하여 첫번째 컬럼으로 삽입한다. | ||
+ | accession = rownames(df) | ||
+ | df = cbind(accession, | ||
+ | write.table(df," | ||
+ | | ||
+ | # 각 species에 대하여 family에 해당하는 유전자가 가장 많이 검출된 균주(assembly accession; row)를 찾는다. | ||
+ | # all 대신 IPR039697 등 다른 컬럼을 선택할 수 있다. | ||
+ | # [1] 단순한 방법 | ||
+ | df.agg = aggregate(all ~ species, df, max) | ||
+ | df.max = merge(df.agg, | ||
+ | | ||
+ | # [2] 또는 dplyr을 사용한 방법 | ||
+ | library(dplyr) | ||
+ | x = df %>% group_by(species) %>% filter(all==max(all)) %>% arrange(species) | ||
+ | x # 필요하면 파일로 저장한다. | ||
+ | | ||
+ | # quick descriptive information | ||
+ | with(df, | ||
+ | with(df, | ||
+ | with(df, | ||
+ | df[df$species==" | ||
+ | df[df$species==" | ||
+ | summary(df[df$species==" | ||
+ | | ||
+ | # dplyr을 사용하면 데이터 프레임에 대한 탐색적 분석을 쉽게 할 수 있다. | ||
+ | # 데이터 프레임을 tbl_df(‘tibble’) 형태로 변환하면 좀 더 쉽게 다룰 수 있다. | ||
+ | df_df = tbl_df(df) | ||
+ | select(df_df, | ||
+ | filter(df_df, | ||
+ | df_df %>% group_by(species) %>% summarise(number_of_strains=n()) %>% arrange(species) | ||
+ | df_df %>% group_by(species) %>% summarise(max(all)) %>% arrange(species) | ||
+ | |||
+ | 마지막으로 각 species에 대하여 family에 정의된 InterPro entry 검출 결과를 집계하여 error bar(표준편차)를 포함한 막대그래프를 그려 보자. ggplot2 라이브러리를 로드해야 한다. | ||
+ | |||
+ | library(" | ||
+ | rm(list=ls()) | ||
+ | # https:// | ||
+ | # reading from pre-existing file | ||
+ | data = read.table(" | ||
+ | nrow(data) | ||
+ | species_list = levels(data$species) | ||
+ | ipr_entries = colnames(data) | ||
+ | ipr_entries = ipr_entries[-1] | ||
+ | | ||
+ | myData = aggregate(data[, | ||
+ | | ||
+ | df = data.frame() | ||
+ | j=1 | ||
+ | for (i in species_list) { | ||
+ | x = matrix(data=as.vector(unlist(myData[j, | ||
+ | df.tmp = data.frame(species=rep(i, | ||
+ | df = rbind(df, | ||
+ | | ||
+ | j = j + 1 | ||
+ | } | ||
+ | | ||
+ | write.table(df," | ||
+ | | ||
+ | # https:// | ||
+ | # https:// | ||
+ | | ||
+ | # geom_bar(color=" | ||
+ | plot1 = ggplot(df, | ||
+ | # axis label을 세로로 세우기. | ||
+ | plot1 = plot1 + theme(axis.text.x=element_text(angle=90, | ||
+ | plot1 | ||
+ | plot2 = plot1 + geom_errorbar(aes(ymin=mean-sd, | ||
+ | plot2 | ||
+ | plot3 = plot2 + xlab(" | ||
+ | | ||
+ | pdf(" | ||
+ | plot3 | ||
+ | dev.off() | ||
===== eggNOG-mapper를 사용한 orthology assignment 기반의 기능 주석화(functional annotation) ===== | ===== eggNOG-mapper를 사용한 orthology assignment 기반의 기능 주석화(functional annotation) ===== | ||
eggNOG ([[https:// | eggNOG ([[https:// | ||
+ | |||
+ | eggNOG-mapper의 기본적인 사용법은 다음과 같다. CPU 수를 지정하지 않으면 2개를 사용한다. | ||
+ | |||
+ | $ python / | ||
+ | … | ||
+ | Done | ||
+ | | ||
+ | | ||
+ | Total time: 1551.87 secs | ||
+ | |||
+ | Query 서열에 대한 주석 정보는 22개의 컬럼으로 이루어진 .annotations 파일에 기록된다. 각 컬럼에 대한 설명은 다음과 같다. | ||
+ | |||
+ | - query_name | ||
+ | - seed eggNOG ortholog | ||
+ | - seed ortholog evalue | ||
+ | - seed ortholog score | ||
+ | - Predicted taxonomic group | ||
+ | - Predicted protein name | ||
+ | - Gene Ontology terms | ||
+ | - EC numberKEGG_ko | ||
+ | - KEGG_Pathway | ||
+ | - KEGG_Module | ||
+ | - KEGG_ReactionKEGG_rclass | ||
+ | - BRITE | ||
+ | - KEGG_TC | ||
+ | - CAZy | ||
+ | - BiGG Reaction | ||
+ | - tax_scope: eggNOG taxonomic level used for annotation | ||
+ | - eggNOG OGs | ||
+ | - bestOG (deprecated, | ||
+ | - COG Functional Category | ||
+ | - eggNOG free text description | ||
+ | |||
+ | eggNOG mapper에서 출력한 annotation 파일에서 KEGG ko 번호(KEGG orthology)를 추출하면 [[https:// | ||
+ | |||
+ | $ awk -F" | ||
===== Genomic island 예측 ===== | ===== Genomic island 예측 ===== | ||
[[https:// | [[https:// | ||
===== 항생제 내성 유전자(AMR determinant)의 예측 ===== | ===== 항생제 내성 유전자(AMR determinant)의 예측 ===== | ||
+ | ===== ResFinder 사용하기 ===== | ||
+ | 항생제 내성 유전자 DB 및 분석 툴로서 대표적인 것은 맥마스터 대학교의 [[https:// | ||
+ | $ mkdir out_all out | ||
+ | $ resfinder.py -i test.fsa -p / | ||
+ | $ resfinder.py -i test.fsa -p / | ||
+ | | ||
+ | CGE 웹사이트에서 서비스하는 것은 resfinder.pl 스크립트이다. 이것은 실행 옵션이 다르고(예: | ||
====ABRicate를 이용한 항생제 내성 병원성 인자(virulence factor) 유전자 예측 ==== | ====ABRicate를 이용한 항생제 내성 병원성 인자(virulence factor) 유전자 예측 ==== | ||
+ | [[https:// | ||
- | ===== 이차대사물 생합성 유전자(biosynthetic gene cluster, BGC) 예측 | + | $ abricate --list |
+ | DATABASE SEQUENCES DBTYPE DATE | ||
+ | ecoh 597 nucl 2018-Oct-20 | ||
+ | card 2237 nucl 2018-Oct-20 | ||
+ | ncbi 4579 nucl 2018-Oct-20 | ||
+ | vfdb 2597 nucl 2018-Oct-20 | ||
+ | plasmidfinder 263 nucl 2018-Oct-20 | ||
+ | resfinder 3021 nucl 2018-Oct-20 | ||
+ | ecoli_vf 2701 nucl 2018-Oct-20 | ||
+ | argannot 1749 nucl 2018-Oct-20 | ||
+ | $ abricate -db card contigs.fa | ||
+ | Using nucl database card: 2237 sequences - 2018-Oct-20 | ||
+ | # | ||
+ | Processing: contigs.fa | ||
+ | Found 5 genes in contigs.fa | ||
+ | contigs.fa Enterococcus 514111 515397 efmA 1-1287/ | ||
+ | contigs.fa Enterococcus 1922156 1923199 efrB 45-1086/ | ||
+ | contigs.fa Enterococcus 1923857 1925292 efrA 1-1434/ | ||
+ | contigs.fa Enterococcus 2040199 2040747 AAC(6')-Ii 1-549/ | ||
+ | contigs.fa Enterococcus 2426678 2428156 msrC 1-1479/ | ||
+ | 여러 샘플에 대하여 ABRicate를 실행하였다면 abricate --summary 옵션을 이용하여 gene presence/ | ||
+ | ===== 이차대사물 생합성 유전자(biosynthetic gene cluster, BGC) 예측 ===== | ||
+ | [[https:// | ||
bioinfo/유전체_주석화_genome_annotation.1688003994.txt.gz · Last modified: 2023/06/29 10:59 by hyjeong