#variables to set fa="../data/fa/Ahyacinthus_v1.fasta" db="/Applications/BLAST/ncbi-blast-2.2.29\+/db/uniprot_sprot_r2013_12" sqls="/Users/sr320/sqlshare-pythonclient/tools/" usr="sr320@washington.edu" sp="Ahyacinthus" !head -2 {fa} !fgrep -c ">" {fa} !/Applications/BLAST/ncbi-blast-2.2.29\+/bin/blastx \ -query {fa} \ -db {db} \ -max_target_seqs 1 \ -max_hsps 1 \ -outfmt 6 \ -evalue 1E-05 \ -num_threads 3 \ -out ../analyses/{sp}_sprot.tab !ls ../analyses/A* !wc -l ../analyses/{sp}_sprot.tab !tr '|' "\t" <../analyses/{sp}_sprot.tab> ../analyses/{sp}_sprot_sql.tab !head -1 ../analyses/{sp}_sprot.tab !echo SQLShare ready version has Pipes converted to Tabs .... !head -1 ../analyses/{sp}_sprot_sql.tab !python {sqls}singleupload.py \ -d _blast_sprot \ ../analyses/{sp}_sprot_sql.tab !python {sqls}fetchdata.py \ -s "SELECT Column1 as ContigID, term, GOSlim_bin, aspect, ProteinName \ FROM [{usr}].[_blast_sprot]md \ left join \ [samwhite@washington.edu].[UniprotProtNamesReviewed_yes20130610]sp \ on md.Column3=sp.SPID \ left join \ [sr320@washington.edu].[SPID and GO Numbers]go \ on md.Column3=go.SPID \ left join \ [sr320@washington.edu].[GO_to_GOslim]slim on go.GOID=slim.GO_id \ where aspect like 'P'" \ -f tsv \ -o ../analyses/{sp}_sprot_GOdescriptions.tab !head ../analyses/{sp}_sprot_GOdescriptions.tab !grep -c "stress response" ../analyses/{sp}_sprot_GOdescriptions.tab !grep "stress response" ../analyses/{sp}_sprot_GOdescriptions.tab \ > ../analyses/{sp}_sprot_GOdescriptions-stress.tab !cut -f2 ../analyses/{sp}_sprot_GOdescriptions-stress.tab | sort | uniq -c pylab inline #FIXME - below I added '[Haliotis_kam]' from pandas import * gs = read_table('../analyses/Ahyacinthus_sprot_GOdescriptions.tab') gs gs.groupby('GOSlim_bin').ContigID.count().plot(kind='barh', color=list('y')) savefig('../analyses/Ahyacinthus_GOSlim.png', bbox_inches='tight') !python {sqls}fetchdata.py \ -s "SELECT Distinct \ Column1 as ContigID, GOSlim_bin \ FROM [{usr}].[_blast_sprot]md \ left join \ [sr320@washington.edu].[SPID and GO Numbers]go \ on md.Column3=go.SPID \ left join \ [sr320@washington.edu].[GO_to_GOslim]slim on go.GOID=slim.GO_id \ where aspect like 'P'" \ -f tsv \ -o ../analyses/{sp}_GOslim.tab !head ../analyses/{sp}_GOslim.tab from pandas import * slim = read_table('../analyses/Ahyacinthus_GOslim.tab') slim.groupby('GOSlim_bin').ContigID.count().plot(kind='barh', color=list('y')) savefig('../analyses/Ahyacinthus_GOSlim-distinct.png', bbox_inches='tight')