001package org.biopax.paxtools.pattern.miner;
002
003/**
004 * Used for customizing the columns in the SIF text output.
005 * @author Ozgun Babur
006 */
007public class CustomFormat implements SIFToText
008{
009        /**
010         * Value generators for custom columns.
011         */
012        private OutputColumn[] columns;
013
014        public CustomFormat(String... cols)
015        {
016                columns = new OutputColumn[cols.length];
017
018                for (int i = 0; i < cols.length; i++)
019                {
020                        columns[i] = new OutputColumn(cols[i]);
021                }
022        }
023
024        /**
025         * Prepares the line in the output file for the given interaction.
026         * @param inter the interaction
027         * @return output line.
028         */
029        @Override
030        public String convert(SIFInteraction inter)
031        {
032                String s = inter.toString();
033
034                for (OutputColumn column : columns)
035                {
036                        s += "\t" + column.getColumnValue(inter);
037                }
038
039                return s;
040        }
041}