\clearpage
\section{simple operation}
\label{sec:simple}
Command-line syntax: \\
%Syntax of \textbf{simple} operation: \\
kmc\_tools [global\_params] simple $<$input1 [input1\_params]$>$ $<$input2 [input2\_params]$>$ $<$oper1 output1 [output\_params1]$>$ [$<$oper2 output2 [output\_params2]$>$ ...] \\


where: 
\begin{itemize}
	\item \textsf{input1, input2} --- paths to the databases generated by \textsf{KMC} (\textsf{KMC} generates 2 files with the same name, but different extensions --- here only name without extension should be given),
	\item \textsf{oper1, oper2, ...} --- set operations to be performed on input1 and input2,
	\item \textsf{output1, output2, ...} --- paths of the output databases.
\end{itemize}

For each \textsf{input} there are additional parameters which can be set:
\begin{itemize}
	\item \textsf{-ci$<$value$>$} --- exclude $k$-mers occurring less than <value> times,
	\item \textsf{-cx$<$value$>$} --- exclude $k$-mers occurring more of than <value> times.
\end{itemize}

If additional parameters are not given they are taken from the appropriate input database. 

For each output there are also additional parameters:
\begin{itemize}
	\item \textsf{-ci$<$value$>$} --- exclude $k$-mers occurring less than <value> times,
	\item \textsf{-cx$<$value$>$} --- exclude $k$-mers occurring more than <value> times,
	\item \textsf{-cs$<$value$>$} --- maximal value of a counter,
	\item \textsf{-oc$<$value$>$} --- redefine counter calculation mode for equal $k$-mers.
	Available values:
	\begin{itemize}
		\item \textsf{min} --- get lower value of a $k$-mer counter,
		\item \textsf{max} --- get upper value of a $k$-mer counter,
		\item \textsf{sum} --- get sum of counters from both databases,
		\item \textsf{diff}  --- get difference between counters,
		\item \textsf{left} --- get counter from first database (input1),
		\item \textsf{right} --- get counter from second database (input2)
	\end{itemize}
\end{itemize}

If parameters are not given they are deduced based on input databases and specified operation.


Valid values for \textsf{oper1, oper2, ...} are:
\begin{itemize}
	\item \textsf{intersect} --- output database will contains only $k$-mers that are present in \textbf{both} input sets,
	\item \textsf{union} --- output database will contains each $k$-mer present in \textbf{any} of input sets,
	\item \textsf{kmers\_subtract} --- difference of input sets based on k-mers. Output database will contains only $k$-mers that are \textbf{present in the first} input set but \textbf{absent in the second} one,
	\item \textsf{counters\_subtract} --- difference of input sets based on k-mers and their counters (weaker version of kmers\_subtract). Output database will contains all $k$-mers that are present in the first input, without those for which counter operation will lead to remove such $k$-mer (i.e. counter equal to 0 or negative number),
	\item \textsf{reverse\_kmers\_subtract} --- same as kmers\_subtract but treat input2 as first and input1 as second,
	\item \textsf{reverse\_counters\_subtract} --- same as counters\_subtract but treat input2 as first and input1 as second.	
\end{itemize}
Each operation may be specified multiple times (which may be useful to produce two output sets with different cutoffs or counter calculation modes).



\begin{table}[H]
\centering
\begin{tabular}{|l|l|}
\hline
\textbf{operation} & \textbf{counter calculation mode} \\
\hline
\textsf{intersect} & \textsf{min} \\
\hline
\textsf{union} & \textsf{sum} \\
\hline
\textsf{kmers\_subtract} & NONE \\
\hline
\textsf{reverse\_kmers\_subtract} & NONE \\
\hline
\textsf{counters\_subtract} & \textsf{diff} \\
\hline
\textsf{reverse\_counters\_subtract} & \textsf{diff} (but input1 and input2 are swapped) \\
\hline
\end{tabular}
\caption{Default values of -oc switch for each operation}
\label{table:defaults_counter_mode}
\end{table}

For \textsf{kmers\_subtract} and \textsf{reverse\_kmers\_subtract} equal $k$-mers will never be present in the output database, which is the reason of NONE values in \cref{table:defaults_counter_mode}.

\subsection*{example 1}
kmc -k28 file1.fastq kmers1 tmp \\
kmc -k28 file2.fastq kmers2 tmp \\
kmc\_tools simple kmers1 -ci10 -cx200 kmers2 -ci4 -cx100 intersect kmers1\_kmers2\_intersect -ci20 -cx150 \\

\subsection*{example 2}
kmc -k28 file1.fastq kmers1 tmp \\
kmc -k28 file2.fastq kmers2 tmp \\
kmc\_tools simple kmers1 kmers2 intersect inter\_k1\_k2\_max -ocmax intersect inter\_k1\_k2\_min union union\_k1\_k2 -ci10 
