References: Bacteria - AndreaRP/METAGENOMICS GitHub Wiki
Bacteria
Create a directory named BACTERIA_GENOME_REFERENCES/ and go inside it.
[16S] (http://greengenes.secondgenome.com/downloads/database/13_5)
-
Create a new directory BACTERIA_GENOME_REFERENCES/16S/ and go inside it.
-
Download the multifasta:
`curl 'https://s3.amazonaws.com/gg_sg_web/gg_13_5.fasta.gz' > bact_16S.fasta.gz`
-
Decompress:
tar xvzf bact_16S.fasta.gz -
Create bowtie index files.
bowtie2-build --offrate 3 REFERENCES/BACTERIA_GENOME_REFERENCE/16S/bact_16S.fasta REFERENCES/BACTERIA_GENOME_REFERENCE/16S/bwt2/16S
The offrate option will make the index building a little slower, but will provide faster mapping later. -
Get length of each 16S sequence
samtools faidx BACTERIA_GENOME_REFERENCE/16/bact_16S.fasta
(generates index: bact_16S.fasta.fai)cut -f1-2 BACTERIA_GENOME_REFERENCE/16S/bact_16S.fasta.fai > BACTERIA_GENOME_REFERENCE/16S/16S_seq_length.txt
[Whole Genome] (ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/)
-
Create a directory BACTERIA_GENOME_REFERENCES/WG/ and go inside it.
-
Download the assembly summary file, with a list of all the bacterias included.
curl 'ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/assembly_summary.txt' > assembly_summary_bacteria.txt -
Get a list of complete and latest sequences.
awk -F "\t" '$12=="Complete Genome" && $11=="latest"{print $1,$20}' assembly_summary_bacteria.txt > ftpdirpaths_complete_latest.txt -
Download the fasta sequences.
cat ftpdirpaths_complete_latest.txt | while read line; do dir=`echo $line | cut -d " " -f 1 `;mkdir -p $dir;url=`echo $line | cut -d " " -f 2`;echo "wget -P $dir $url/*" ; done >> wget_all_bacteria_complete_latest.sh(creates download script)bash wget_all_bacteria_complete_latest.sh(executes download script)WARNING! This step will create a folder per genome and download several files into it, including nucleotide and protein sequences. Before executing this command please make sure you have sufficient storage space. We advise you create a new directory and execute this command from inside it, that will keep your working space well organized. In this example we have created the folder all_genomes for the download.
-
Create the multifasta file with the genomic data.
find BACTERIA_GENOME_REFERENCE/WG/all_genomes/ ! -name '*from_genomic.fna.gz' -name '*_genomic.fna.gz' -exec zcat {} \; > BACTERIA_GENOME_REFERENCE/WG/bacteria_genome_all.fna -
Create multifasta file with proteomic data.
find BACTERIA_GENOME_REFERENCE/WG/all_genomes/ -name '*_protein.faa.gz' -exec zcat {} \; > BACTERIA_GENOME_REFERENCE/WG/bacteria_protein_all.faa -
Get length of each sequence
samtools faidx BACTERIA_GENOME_REFERENCE/WG/bacteria_genome_all.fna(generates index: bacteria_genome_all.fna.fai)cut -f1-2 BACTERIA_GENOME_REFERENCE/WG/bacteria_genome_all.fna.fai > BACTERIA_GENOME_REFERENCE/WG/genome_length.txt -
Create Bowtie2 genome index
`bowtie2-build REFERENCES/BACTERIA_GENOME_REFERENCE/WG/bacteria_genome_all.fna REFERENCES/BACTERIA_GENOME_REFERENCE/WG/bwt2/WG`
- Create BLAST files
`makeblastdb -in REFERENCES/BACTERIA_GENOME_REFERENCE/WG/bacteria_genome_all.fna -parse_seqids -dbtype nucl -out /REFERENCES/BACTERIA_GENOME_REFERENCE/BLAST/blastn/BACTERIA_blastn`