add scripts for preparing nt and wgs databases.

update blastdb location file, wgs is available now.
This commit is contained in:
Wen-Yu Chung
2008-03-27 17:41:40 +00:00
parent 254077c4e3
commit 78802fa73b
6 changed files with 68 additions and 4126 deletions
+39
View File
@@ -0,0 +1,39 @@
#! /usr/bin/python
"""
convert nt and wgs data (fasta format) to giNumber_seqLen
run formatdb in the command line: gunzip -c nt.gz |formatdb -i stdin -p F -n "nt.chunk" -v 2000
"""
import os, sys, math
if __name__ == '__main__':
seq = []
len_seq = 0
invalid_lines = 0
for i, line in enumerate(sys.stdin):
line = line.rstrip('\r\n')
if line.startswith('>'):
if len_seq > 0:
print ">%s_%d" %(gi, len_seq)
print "\n".join(seq)
title = line
fields = title.split('|')
if len(fields) >= 2 and fields[0] == '>gi':
gi = fields[1]
else:
gi = 'giunknown'
invalid_lines += 1
len_seq = 0
seq = []
else:
seq.append(line)
len_seq += len(line)
if len_seq > 0:
print ">%s_%d" %(gi, len_seq)
print "\n".join(seq)
print >> sys.stderr, "Unable to find gi number for %d sequences, the title is replaced as giunknown" %(invalid_lines)
+18
View File
@@ -0,0 +1,18 @@
echo "This will take several hours to finish due to the size of the databases (about 30GB)..."
echo "Getting nt database from NCBI..."
wget ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/nt.gz
echo "Changing fasta title lines to >ginumber_seqlength..."
echo "Formatting nt database to chunks of 2GB each..."
gunzip -c nt.gz | python convert_title.py | formatdb -i stdin -p F -n "nt.chunk" -v 2000
echo "Remove the zip file, keep the formatted files."
rm nt.gz
echo "Getting wgs database from NCBI..."
wget ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/wgs.gz
echo "Changing fasta title lines to >ginumber_seqlength..."
echo "Formatting wgs database to chunks of 2GB each..."
gunzip -c wgs.gz | python convert_title.py | formatdb -i stdin -p F -n "wgs.chunk" -v 2000
echo "Remove the zip file, keep the formatted files."
rm wgs.gz
echo "Job finished"
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -4,6 +4,7 @@
#
#TODO: fill in this format
#
nt /depot/data2/galaxy/blastdb/nt/nt.chunk
nt /depot/data2/galaxy/blastdb/nt/nt.chunk
wgs /depot/data2/galaxy/blastdb/wgs/wgs.chunk
nr /depot/data2/galaxy/blastdb/nr/nr.chunk.0 /depot/data2/galaxy/blastdb/nr/nr.chunk.1 /depot/data2/galaxy/blastdb/nr/nr.chunk.2
test /depot/data2/galaxy/blastdb/test/test.fa
+8 -8
View File
@@ -58,14 +58,14 @@
- The report showed overall coverage of reads on each chromosome location::
##title location ref. cov. A T C G
chr 614777 A 1 A(100) T(0) C(0) G(0)
chr 614778 A 1 A(100) T(0) C(0) G(0)
chr 614779 A 1 A(100) T(0) C(0) G(0)
chr 614780 A 1 A(100) T(0) C(0) G(0)
chr 614781 C 1 A(0) T(0) C(100) G(0)
chr 614782 A 1 A(100) T(0) C(0) G(0)
chr 614783 C 1 A(0) T(0) C(100) G(0)
chr 614784 C 1 A(0) T(0) C(100) G(0)
chr 614777 A 1 A(100) T(0) C(0) G(0)
chr 614778 A 1 A(100) T(0) C(0) G(0)
chr 614779 A 1 A(100) T(0) C(0) G(0)
chr 614780 A 1 A(100) T(0) C(0) G(0)
chr 614781 C 1 A(0) T(0) C(100) G(0)
chr 614782 A 1 A(100) T(0) C(0) G(0)
chr 614783 C 1 A(0) T(0) C(100) G(0)
chr 614784 C 1 A(0) T(0) C(100) G(0)
Only show part of the result.
+1
View File
@@ -6,6 +6,7 @@
<param name="source_select" type="select" display="radio" label="Target database">
<option value="test">Ecoli_K12</option>
<option value="nt">nt</option>
<option value="wgs">wgs</option>
</param>
<param name="word_size" type="select" label="Word size (-W)" help="Size of best perfect match">
<option value="28">28</option>