% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/madc2vcf_multi.R
\name{madc2vcf_multi}
\alias{madc2vcf_multi}
\title{Convert MADC file to VCF using polyRAD for multiallelic genotyping}
\usage{
madc2vcf_multi(
  madc_file,
  botloci_file,
  outfile,
  markers_info = NULL,
  ploidy = 2L,
  verbose = TRUE
)
}
\arguments{
\item{madc_file}{character. Path or URL to the input MADC CSV file.}

\item{botloci_file}{character. Path or URL to the botloci file listing target
IDs designed on the bottom strand.}

\item{outfile}{character. Path for the output VCF file.}

\item{markers_info}{character or NULL. Optional path or URL to a CSV file
with marker metadata. Required when CloneIDs do not follow the
\code{Chr_Pos} format; must contain \code{CloneID} (or
\code{BI_markerID}), \code{Chr}, and \code{Pos} columns.}

\item{ploidy}{integer. Ploidy level of the samples passed to \code{taxaPloidy}.
Default is 2.}

\item{verbose}{logical. Whether to print progress messages. Default is TRUE.}
}
\value{
Invisible NULL. Writes a VCF file to \code{outfile}.
}
\description{
This function converts a DArTag fixed allele ID MADC file to a VCF
containing multiallelic markers based on the microhaplotypes using
the polyRAD package's \code{readDArTag}, \code{IterateHWE} population model
and \code{RADdata2VCF} pipeline.
}
\details{
The function performs the following steps:
\enumerate{
\item Reads the MADC file and runs \code{check_madc_sanity}.
\item Validates the botloci file against MADC CloneIDs using
\code{check_botloci}, fixing any padding mismatches automatically.
\item Converts lowercase bases in AlleleSequence to uppercase if detected.
\item Removes all-NA rows and columns if detected.
\item Writes the corrected data to a temporary file and passes it to
\code{polyRAD::readDArTag}.
\item Estimates overdispersion with \code{polyRAD::TestOverdispersion} and
calls \code{polyRAD::IterateHWE}, then exports the result with
\code{polyRAD::RADdata2VCF}.
}

\strong{Sanity check behaviour and requirements}

The function always stops if IUPAC codes, unpaired Ref/Alt sequences, or
unfixed AlleleIDs are detected (see \code{check_madc_sanity}). For the
remaining checks the required inputs are:\tabular{lll}{
   Check \tab Status \tab Required \cr
   \strong{Indels} \tab detected \tab \code{botloci_file} \cr
    \tab not detected \tab \code{botloci_file} \cr
   \strong{ChromPos} \tab valid \tab \code{botloci_file} \cr
    \tab invalid \tab \code{markers_info} with \code{Chr}/\code{Pos} + \code{botloci_file} \cr
}
}
