owned this note
owned this note
Published
Linked with GitHub
### Enriquecimento funcional
- Preparo do arquivo das associações
O primeiro arquivo será o goatools/association, que irá conter todas as relações entre os IDs possíveis de estarem no conjunto que será avaliado o enriquecimento dos termos.
O preparo do arquivo goatools/association começa a partir do resultado de anotação com eggNOG-mapper vamos selecionar a primeira (ID) e a sétima coluna (GOs):
```
cut -f 1,7 Pala.emapper.annotations > emapper_gos.txt
cut -f 1,7 Pedu.emapper.annotations > emapper_gos.txt
```
Devemos formatar o arquivo resultante (emapper_gos.txt) para conter um único ID associado a um único GO por linha:
```
splitteR.R x="./emapper_gos.txt" --by.x="," col.x="GO" colnames.x="ID,GO" --noh.x --out=./emapper_go.txt
```
Então, agregar novamente por ID, porém, separando com “;” os GOs:
- Para isoformas:
```
aggregatoR.R --x="emapper_go.txt" --sep=";" --by.x="ID" --out=./emapper_gos_ok.txt
```
Remover os cabeçalhos:
```
grep -P -v '^ID\tGO' ./emapper_gos_ok.txt > association
#Para gerar association sem o p:
perl -F"\t" -lane ' next if ($_=~/^#|(?:ID\tGO$)/);
$F[0]=~s/\.p\d+//; print join("\t", @F);' emapper_gos_ok.txt > association
```
- Para genes:
`((echo -e "ID\tGO") & (perl -F"\t" -lane 'next if ($_=~/^#|(?:^ID\tGO)/); $F[0]=~s/_i\d.*$//; print join("\t",@F);' emapper_go.txt | nsort -u )) > ./emapper_genes_go.txt`
`aggregatoR.R --x="emapper_genes_go.txt" --sep=";" --by.x="ID" --out=./emapper_genes_gos_ok.txt`
`grep -P -v '^ID\tGO' ./emapper_genes_gos_ok.txt > genes_association`
#### Preparo do arquivo da população
O segundo arquivo será o goatools/population, que irá conter todos os IDs possíveis de estarem no conjunto que será avaliado o enriquecimento dos termos. Neste caso serão todas as proteínas (proteoma), ou seja, de toda a população de proteínas que possivelmente podem estar no arquivo de estudo (goatools/study).
`grep '^>' ../trinity_assemble/Trinity.fasta | sed 's/ .*$//' | sed 's/^>//' > population`
```
grep '^>' ../Transrate_default/Trinity/good.Trinity.fasta | sed 's/ .*$//' | sed 's/^>//' > population
```
- para o population de genes:
`grep '^>' ../trinity_assemble/Trinity.fasta | sed 's/>//' | sed 's/_i[0-9].*//' | nsort -u > gene_population`
` grep '^>' ../Transrate_default/Trinity/good.Trinity.fasta | sed 's/>//' | sed 's/_i[0-9].*//' | nsort -u > gene_population`
Download go-basic.obo:
`wget --timestamping http://geneontology.org/ontology/go-basic.obo 2> /dev/null`
#### Preparo do arquivo do estudo
O arquivo goatools/study deve conter os IDs das proteínas em que se deseja investigar se há enriquecimento de termos do GO.
É importante que todo ID presente no arquivo de estudo (goatools/study) também esteja presente no arquivo com a população (goatools/population).
- Em vez de usar o R, tem o script DEfilteR.R:
- Pode-se filtrar pelo logFC e pelo e-value.
- Em um primeiro momento não foi filtrado pelo logFC
`### Exemplo:
DEfilteR.R --x="PER-PEA.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PER_B2,PER_B3,PER_B4" --smB.col="PEA_B2,PEA_B3,PEA_B5" --lfc="1" --pve="0.05" --regulation="down" --out="./DEI_1/IPER-PEA.1.down.txt`
#### Filtrando o arquivo:
- Pedu:
-- Isoformas:
```
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="down" --out="IPeduC-PeduT.down.txt"
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="up" --out="./IPeduC-PeduT.up.txt"
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="both" --out="./IPeduC-PeduT.both.txt"
```
--Genes:
```
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="down" --out="GPeduC-PeduT.down.txt"
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="up" --out="GPeduC-PeduT.up.txt"
DEfilteR.R --x="PeduC-PeduT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PeduC_B1,PeduC_B2,PeduC_B3" --smB.col="PeduT_B1,PeduT_B2,PeduT_B3" --pve="0.05" --regulation="both" --out="GPeduC-PeduT.both.txt"
```
- Pala:
-- Isoformas:
```
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="down" --out="IPalaC-PalaT.down.txt"
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="up" --out="IPalaC-PalaT.up.txt"
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="both" --out="IPalaC-PalaT.both.txt"
```
-- Genes:
```
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="down" --out="GPalaC-PalaT.down.txt"
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="up" --out="GPalaC-PalaT.up.txt"
DEfilteR.R --x="PalaC-PalaT.txt" --lfc.col="logFC" --pve.col="FDR" --smA.col="PalaC_B1,PalaC_B2,PalaC_B3" --smB.col="PalaT_B1,PalaT_B2,PalaT_B3" --pve="0.05" --regulation="both" --out="GPalaC-PalaT.both.txt"
```
#### Extrair apenas os IDs para o enriquecimento - study
- Pala:
```
cut -f 1 GPalaC-PalaT.both.txt > ./study/GPalaC-PalaT.both.txt
cut -f 1 GPalaC-PalaT.up.txt > ./study/GPalaC-PalaT.up.txt
cut -f 1 GPalaC-PalaT.down.txt > ./study/GPalaC-PalaT.down.txt
cut -f 1 IPalaC-PalaT.both.txt > ./study/IPalaC-PalaT.both.txt
cut -f 1 IPalaC-PalaT.up.txt > ./study/IPalaC-PalaT.up.txt
cut -f 1 IPalaC-PalaT.down.txt > ./study/IPalaC-PalaT.down.txt
```
- Pedu:
```
cut -f 1 GPeduC-PeduT.both.txt > ./study/GPeduC-PeduT.both.txt
cut -f 1 GPeduC-PeduT.up.txt > ./study/GPeduC-PeduT.up.txt
cut -f 1 GPeduC-PeduT.down.txt > ./study/GPeduC-PeduT.down.txt
cut -f 1 IPeduC-PeduT.both.txt > ./study/IPeduC-PeduT.both.txt
cut -f 1 IPeduC-PeduT.up.txt > ./study/IPeduC-PeduT.up.txt
cut -f 1 IPeduC-PeduT.down.txt > ./study/IPeduC-PeduT.down.txt
```
#### Enriquecimento funcional
- Pedu:
-- Isoformas:
```
find_enrichment.py ./abundance_good/abundance/DEI/study/IPeduC-PeduT.both.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPeduC.PeduT.both.xlsx,./GOATOOLS/goea.IPeduC.PeduT.both.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEI/study/IPeduC-PeduT.up.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPeduC.PeduT.up.xlsx,./GOATOOLS/goea.IPeduC.PeduT.up.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEI/study/IPeduC-PeduT.down.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPeduC.PeduT.down.xlsx,./GOATOOLS/goea.IPeduC.PeduT.down.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
```
-- Genes:
```
find_enrichment.py ./abundance_good/abundance/DEG/study/GPeduC-PeduT.both.txt ./GOATOOLS/gene_population ./GOATOOLS/genes_association --outfile=./GOATOOLS/goea.GPeduC.PeduT.both.xlsx,./GOATOOLS/goea.GPeduC.PeduT.both.tsv --pvalcalc=fisher_scipy_stats --obo=./GOATOOLS/go-basic.obo --pval=1 --alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEG/study/GPeduC-PeduT.up.txt \
./GOATOOLS/gene_population \
./GOATOOLS/genes_association \
--outfile=./GOATOOLS/goea.GPeduC.PeduT.up.xlsx,./GOATOOLS/goea.GPeduC.PeduT.up.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEG/study/GPeduC-PeduT.down.txt \
./GOATOOLS/gene_population \
./GOATOOLS/genes_association \
--outfile=./GOATOOLS/goea.GPeduC.PeduT.down.xlsx,./GOATOOLS/goea.GPeduC.PeduT.down.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
```
- Pala
-- Isoformas
```
find_enrichment.py ./abundance_good/abundance/DEI/study/IPalaC-PalaT.both.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPalaC.PalaT.both.xlsx,./GOATOOLS/goea.IPalaC.PalaT.both.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEI/study/IPalaC-PalaT.up.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPalaC.PalaT.up.xlsx,./GOATOOLS/goea.IPalaC.PalaT.up.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEI/study/IPalaC-PalaT.down.txt \
./GOATOOLS/population \
./GOATOOLS/association \
--outfile=./GOATOOLS/goea.IPalaC.PalaT.down.xlsx,./GOATOOLS/goea.IPalaC.PalaT.down.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
-- Genes:
find_enrichment.py ./abundance_good/abundance/DEG/study/GPalaC-PalaT.both.txt \
./GOATOOLS/gene_population \
./GOATOOLS/genes_association \
--outfile=./GOATOOLS/goea.GPalaC.PalaT.both.xlsx,./GOATOOLS/goea.GPalaC.PalaT.both.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEG/study/GPalaC-PalaT.up.txt \
./GOATOOLS/gene_population \
./GOATOOLS/genes_association \
--outfile=./GOATOOLS/goea.GPalaC.PalaT.up.xlsx,./GOATOOLS/goea.GPalaC.PalaT.up.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
find_enrichment.py ./abundance_good/abundance/DEG/study/GPalaC-PalaT.down.txt \
./GOATOOLS/gene_population \
./GOATOOLS/genes_association \
--outfile=./GOATOOLS/goea.GPalaC.PalaT.down.xlsx,./GOATOOLS/goea.GPalaC.PalaT.down.tsv \
--pvalcalc=fisher_scipy_stats \
--obo=./GOATOOLS/go-basic.obo \
--pval=1 \
--alpha=0.05
```
#### Geração dos gráficos:
```
mkGOplot.R --deseq2="./abundance_good/abundance/DEI/IPalaC-PalaT.both.txt" --goea="./GOATOOLS/goea.IPalaC.PalaT.both.tsv" --shrinkage=0.5 gene2go="./GOATOOLS/association" --out="GOEA_IPalac.Palat.both.svg"
mkGOplot.R --deseq2="./abundance_good/abundance/DEI/IPalaC-PalaT.up.txt" --goea="./GOATOOLS/goea.IPalaC.PalaT.up.tsv" --shrinkage=0.5 gene2go="./GOATOOLS/association" --out="GOEA_IPalac.Palat.up.svg"
mkGOplot.R --deseq2="./abundance_good/abundance/DEI/IPalaC-PalaT.down.txt" --goea="./GOATOOLS/goea.IPalaC.PalaT.down.tsv" --shrinkage=0.5 gene2go="./GOATOOLS/association" --out="GOEA_IPalac.Palat.down.svg"
```