QIIME: split OTU table

Create two OTU .biom tables with selected subset of samples

# create two new OTU tables, containing samples only of diet_A or only of diet_B (Treatment column)

filter_samples_from_otu_table.py -i otu_table_mc2_w_tax_no_pynast_failures.biom -o otu_A.biom -m metadata.txt -s 'Treatment:diet_A'

filter_samples_from_otu_table.py -i otu_table_mc2_w_tax_no_pynast_failures.biom -o otu_B.biom -m metadata.txt -s 'Treatment:diet_B'

# create related subset metadata mapfiles for A and B (Treatment column 4)

awk -F"\t" '$4=="diet_A"||NR==1{print}' metadata.txt > metadata_A.txt

awk -F"\t" '$4=="diet_B"||NR==1{print}' metadata.txt > metadata_B.txt

Remove control samples from OTU .biom table

# remove all control samples: keep all '*' , but not '!' Control samples (Treatment column)

filter_samples_from_otu_table.py -i otu_table_mc2_w_tax_no_pynast_failures.biom -o otu_Control_removed.biom -m metadata.txt -s 'Treatment:*,!Control'

# metadata mapfiles without "Control" samples (take all lines with Treatment column 4 not equal != "Control")

awk -F"\t" '$4!="Control"||NR==1{print}' metadata.txt > metadata_without_Control.txt

http://qiime.org/scripts/filter_samples_from_otu_table.html