In this context, ‘local’ means you are running BLAST on your own server, not at NCBI or anyone else’s server. This gives you the flexibility of comparing your query either against precomputed databases (like NR, Swissprot, trEMBL, etc.) or against a customized database, containing a specific set of sequences.
Query Sequence Set: contigs.supercontigs.filtered_012808.fasta
Reference Database: all_gene-CDS-111313.txt
(Hint: choose among: BLASTP, BLASTN, BLASTX, TBLASTN, TBLASTX)
BLAST Reference: http://www.ncbi.nlm.nih.gov/BLAST/blast_program.shtml
Example1.blastn,compares a nucleotide query sequence against a nucleotide sequence database
1.Generate a customized search database
$ makeblastdb -dbtype nucl -in contigs.supercontigs.filtered_012808.fasta
2.BLAST the all_gene-CDS-111313.txt
$ blastn -query all_gene-CDS-111313.txt -db contigs.supercontigs.filtered_012808.fasta-outfmt 6 -out gene.blastn
3.Wait until it finishes then take a look at the output:
$ less gene.blastn
4.BLAST tabular format (as specified in -outfmt 6) has multiple columns, and is the easiest output format to work with. http://www.pangloss.com/wiki/Blast
Cout the column (-f 2):
$ cut -f 2 gene.blastn | sort -u > hits.ids
5.How many unique hits did we get? This equals to the number of lines in the file:
$ wc -l hits.ids
6.It appears we are getting lots of hits. We may need to go back to the BLAST command to add an E-value cutoff to be more stringent. How to add E-value cutoff? Let’s look at the help for tblastn
$ blastn -help
7.Now run BLAST with more stringent settings (E-value cutoff: 1e-20):
$ blastn -query all_gene-CDS-111313.txt -db contigs.supercontigs.filtered_012808.fasta -outfmt 6 -out gene.blastn -evalue 1e-20
$ cut -f 2 gene.blastn| sort -u > hits.ids
8.Extract sequences from contigs.supercontigs.filtered_012808.fasta
The command faSomeRecords can be used to extract multiple sequences, now let’s get all the BLAST hits to retrieve a gene family.
$ faSomeRecords contigs.supercontigs.filtered_012808.fasta hits.ids hits.fasta
Example2:blastp,compares an amino acid query sequence against a protein sequence database
1.makeblastdb -dbtype prot -in rice-target.fasta
2. blastp -query rice-aa.fasta -db rice-target.fasta -outfmt 6 -out rice.blastp
3. less rice.blastp
原文:http://www.cnblogs.com/shelly-family/p/4092735.html