1 |
gpertea |
23 |
#!/bin/tcsh -f |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
set cdb=refseq.mammalian_np.CDS.fa.cidx |
5 |
|
|
|
6 |
|
|
if ($1"x" == "x") then |
7 |
|
|
echo "Usage: prep_sim4.csh fasta_files.." |
8 |
|
|
echo "" |
9 |
|
|
echo "Must be run from the sim4search subdirectory" |
10 |
|
|
echo "and expects a gblat_*.gff and/or gmap_*.gff3 file with gblat scanning results" |
11 |
|
|
echo "and $cdb in the current directory to pull RefSeqs for sim4cc" |
12 |
|
|
echo "" |
13 |
|
|
echo "Example: prep_sim4.csh ../ga_??.fa" |
14 |
|
|
exit 1 |
15 |
|
|
endif |
16 |
|
|
|
17 |
|
|
# prepare the name translation table |
18 |
|
|
|
19 |
|
|
set f=$1; |
20 |
|
|
|
21 |
|
|
if (! -f $cdb ) then |
22 |
|
|
echo "Error: missing file in current directory: $cdb" |
23 |
|
|
exit 1 |
24 |
|
|
endif |
25 |
|
|
|
26 |
|
|
set cdir=`pwd` |
27 |
|
|
set pdir=$cdir:h |
28 |
|
|
set gblat_gff=`ls gblat*.gf{f,f3}` |
29 |
|
|
|
30 |
|
|
if (! -f $gblat_gff ) then |
31 |
|
|
echo "Error: no single gblat*.gf{f,f3} file found in current directory" |
32 |
|
|
echo "make sure you're in <organism>/sim4search and the gblat results are there" |
33 |
|
|
exit 1 |
34 |
|
|
endif |
35 |
|
|
set infiles=$gblat_gff |
36 |
|
|
|
37 |
|
|
set gmap_gff=`ls gmap*.gf{f,f3}` |
38 |
|
|
if ( -f $gmap_gff ) then |
39 |
|
|
#echo "Error: no single gmap*.gf{f,f3} file found in current directory" |
40 |
|
|
#echo "make sure you're in <organism>/sim4search and the gblat/gmap results are there" |
41 |
|
|
#exit 1 |
42 |
|
|
set infiles="$infiles $gmap_gff" |
43 |
|
|
endif |
44 |
|
|
|
45 |
|
|
set fp=$f:h |
46 |
|
|
set ftx="$fp/seqn2fname.lst" |
47 |
|
|
set dlst="" |
48 |
|
|
set flst="" |
49 |
|
|
/bin/rm -f $ftx |
50 |
|
|
foreach f ( $* ) |
51 |
|
|
set fn=$f:t |
52 |
|
|
set bd=$fn:r |
53 |
|
|
set sn=`head -1 $f | cut -f1 -d ' ' | cut -b2-` |
54 |
|
|
#if (! -d $bd) mkdir $bd |
55 |
|
|
echo "$sn\t$bd" >> $ftx |
56 |
|
|
#/bin/rm -f $bd/$bd.refseq.gmap.gff3 |
57 |
|
|
#/bin/rm -f $bd/$bd.unipr.pmap.gff3 |
58 |
|
|
set flst = "$flst $fn" |
59 |
|
|
end |
60 |
|
|
echo "$fp/seqn2fname.lst created." |
61 |
|
|
cat $infiles | trcol.pl -G $ftx | sort -u > anchored.lst |
62 |
|
|
set simbat=sim4_grid.cmds |
63 |
|
|
/bin/rm -f $simbat |
64 |
|
|
gawk '{ print "qsim4cc -p75 -c75 -o wrk_sim4cc.gff3 -q \047"$2"\047"" '$cdir/$cdb' '$pdir/'"$1".fa"}' \ |
65 |
|
|
anchored.lst > $simbat |
66 |
|
|
|
67 |
|
|
echo "$simbat file created, use gridx with it, e.g.:" |
68 |
|
|
echo "gridx -q -N -O grdsim4logs -f sim4_grid.cmds -p40 -m gpertea" |