News and Announcements » – Merge OTU mapping files


This script merges OTU mapping files generated by and/or

For example, if otu_map1.txt contains:

0 seq1 seq2 seq5
1 seq3 seq4  
2 seq6 seq7 seq8

and otu_map2.txt contains:

110 0 2
221 1  

The resulting OTU map will be:

110 seq1 seq2 seq5 seq6 seq7 seq8
221 seq3 seq4        

Usage: [options]

Input Arguments:



-i, --otu_map_fps
The otu map filepaths, comma-separated and ordered as the OTU pickers were run [REQUIRED]
-o, --output_fp
Path to write output OTU map [REQUIRED]


-f, --failures_fp
Failures filepath, if applicable


The result of this script is an OTU mapping file.

Expand an OTU map:

If the seq_ids in otu_map2.txt are otu_ids in otu_map1.txt, expand the seq_ids in otu_map2.txt to be the full list of associated seq_ids from otu_map1.txt. Write the resulting otu map to otu_map.txt (-o). -i $PWD/otu_map1.txt,$PWD/otu_map2.txt -o $PWD/otu_map_ex1.txt

Expand a failures file:

Some OTU pickers (e.g. uclust_ref) will generate a list of failures for sequences which could not be assigned to OTUs. If this occurs in a chained OTU picking process, the failures file will need to be expanded to include the orignal sequence ids. To do this, pass the failures file via -f, and the otu maps up to, but not including, the step that generated the failures file. -i $PWD/otu_map1.txt,$PWD/otu_map2.txt -f $PWD/fail.txt -o $PWD/all_failures.txt