In [27]:
cd ~/Desktop/SSUsearch/
In [28]:
### set up directory
!mkdir -p ./workdir/copy_correction
In [29]:
Prefix='SS' # name for the analysis run
Script_dir='./scripts'
Wkdir='./workdir'
Design='./data/test/SS.design'
Otu_dist_cutoff='0.05'
Copy_db='./data/SSUsearch_db/Copy_db.copyrighter.txt'
In [30]:
import os
Script_dir=os.path.abspath(Script_dir)
Wkdir=os.path.abspath(Wkdir)
Design=os.path.abspath(Design)
Copy_db=os.path.abspath(Copy_db)
New_path = '{}:{}'.format('~/Desktop/SSUsearch/external_tools/bin/', os.environ['PATH'])
print New_path
os.environ.update(
{'PATH':New_path,
'Prefix':Prefix,
'Script_dir': Script_dir,
'Wkdir': Wkdir,
'Otu_dist_cutoff':Otu_dist_cutoff,
'Design': Design,
'Copy_db': Copy_db})
In [31]:
cd ./workdir/copy_correction
In [32]:
# get input files from '/usr/local/notebooks/workdir/clust'
!ln -sf $Wkdir/clust/$Prefix.biom
!ln -sf $Wkdir/clust/$Prefix.list
In [40]:
%%bash
# get Greengene taxonomy
cat $Wkdir/*.ssu.out/*.gg.taxonomy > $Prefix.taxonomy
mothur "#classify.otu(list=$Prefix.list, taxonomy=$Prefix.taxonomy, label=$Otu_dist_cutoff)"
mv SS.$Otu_dist_cutoff.cons.taxonomy SS.cons.taxonomy
mv SS.$Otu_dist_cutoff.cons.tax.summary SS.cons.tax.summary
In [36]:
%%bash
Label=userLabel
#Label=dummy
mothur "#make.shared(biom=$Prefix.biom)"
# do copy correction and even sampling
python $Script_dir/copyrighter-otutable.py $Copy_db \
$Prefix.cons.taxonomy \
$Prefix.shared $Prefix.cc.shared
mv $Prefix.cc.shared $Prefix.shared
mothur "#make.biom(shared=$Prefix.shared, constaxonomy=$Prefix.cons.taxonomy);"
mv $Prefix.$Label.biom $Prefix.biom
rm -f mothur.*.logfile
In [39]:
%%bash
Label=userLabel
#Label=dummy
mothur "#make.shared(biom=$Prefix.biom); sub.sample(shared=$Prefix.shared); summary.single(calc=nseqs-coverage-sobs-chao-shannon-invsimpson); dist.shared(calc=braycurtis); pcoa(phylip=$Prefix.$Label.subsample.braycurtis.$Label.lt.dist); nmds(phylip=$Prefix.$Label.subsample.braycurtis.$Label.lt.dist); amova(phylip=$Prefix.$Label.subsample.braycurtis.$Label.lt.dist, design=$Design); tree.shared(calc=braycurtis); unifrac.weighted(tree=$Prefix.$Label.subsample.braycurtis.$Label.tre, group=$Design, random=T)"
rm -f mothur.*.logfile;
rm -f *.rabund
In [ ]: