question: public void write ( Writer w , boolean ensureQIIMECompatible , boolean includeSecret ) throws IOException { final Set < String > attributes = getAttributeSet ( ) ; w . write ( SAMPLE_ID ) ; if ( ensureQIIMECompatible ) { if ( attributes . contains ( "BarcodeSequence" ) ) w . write ( "\tBarcodeSequence" ) ; w . write ( "\tLinkerPrimerSequence" ) ; for ( String name : getAttributeOrder ( ) ) { if ( ! name . equals ( SAMPLE_ID ) && ! name . equals ( "BarcodeSequence" ) && ! name . equals ( "LinkerPrimerSequence" ) && ! name . equals ( "Description" ) && ( includeSecret || ! isSecretAttribute ( name ) ) ) { w . write ( "\t" + name ) ; } } w . write ( "\tDescription" ) ; } else { for ( String name : getAttributeOrder ( ) ) { if ( ! name . equals ( SAMPLE_ID ) && ! name . equals ( "BarcodeSequence" ) && ! name . equals ( "LinkerPrimerSequence" ) && ( includeSecret || ! isSecretAttribute ( name ) ) ) { w . write ( "\t" + name ) ; } } } w . write ( "\n" ) ; if ( description != null && description . length ( ) > 0 ) w . write ( ( description . startsWith ( "#" ) ? description : description ) + "\n" ) ; for ( String sample : getSampleOrder ( ) ) { w . write ( sample ) ; final Map < String , Object > attributes2value = getAttributesToValues ( sample ) ; if ( attributes2value != null ) { if ( ensureQIIMECompatible ) { if ( attributes . contains ( "BarcodeSequence" ) ) { Object barcodeSequence = attributes2value . get ( "BarcodeSequence" ) ; if ( barcodeSequence != null ) w . write ( "\t" + Basic . quoteIfContainsTab ( barcodeSequence ) ) ; else w . write ( "\tAAA" ) ; } Object linkerPrimerSequence = attributes2value . get ( "LinkerPrimerSequence" ) ; if ( linkerPrimerSequence != null ) w . write ( "\t" + Basic . quoteIfContainsTab ( linkerPrimerSequence ) ) ; else w . write ( "\t" ) ; for ( String name : getAttributeOrder ( ) ) { if ( ! name . equals ( SAMPLE_ID ) && ! name . equals ( "BarcodeSequence" ) && ! name . equals ( "LinkerPrimerSequence" ) && ( includeSecret || ! isSecretAttribute ( name ) ) ) { Object value = attributes2value . get ( name ) ; if ( value != null ) w . write ( "\t" + Basic . quoteIfContainsTab ( value ) ) ; else w . write ( "\tNA" ) ; } } Object description = attributes2value . get ( "Description" ) ; if ( description != null ) w . write ( "\t" + Basic . quoteIfContainsTab ( description ) ) ; else w . write ( "\tNA" ) ; } else { for ( String name : getAttributeOrder ( ) ) { if ( ! name . equals ( SAMPLE_ID ) && ! name . equals ( "BarcodeSequence" ) && ! name . equals ( "LinkerPrimerSequence" ) && ( includeSecret || ! isSecretAttribute ( name ) ) ) { Object value = attributes2value . get ( name ) ; if ( value != null ) w . write ( "\t" + Basic . quoteIfContainsTab ( value ) ) ; else w . write ( "\tNA" ) ; } } } } w . write ( "\n" ) ; } w . flush ( ) ; }
target:  write the table to a file in QIIME-based format