Search in sources :

Example 1 with MicroSatImporter

use of dr.evolution.io.MicroSatImporter in project beast-mcmc by beast-dev.

the class BEAUTiImporter method importMicroSatFile.

// micro-sat
private void importMicroSatFile(File file) throws IOException, ImportException {
    try {
        Reader reader = new FileReader(file);
        BufferedReader bufferedReader = new BufferedReader(reader);
        MicroSatImporter importer = new MicroSatImporter(bufferedReader);
        List<Patterns> microsatPatList = importer.importPatterns();
        Taxa unionSetTaxonList = importer.getUnionSetTaxonList();
        Microsatellite microsatellite = importer.getMicrosatellite();
        // options.allowDifferentTaxa = importer.isHasDifferentTaxon();
        bufferedReader.close();
        PartitionSubstitutionModel substModel = new PartitionSubstitutionModel(options, microsatPatList.get(0).getId());
        substModel.setMicrosatellite(microsatellite);
        for (Patterns patterns : microsatPatList) {
            setData(file.getName(), unionSetTaxonList, patterns, substModel, null);
        }
        // has to call after data is imported
        options.microsatelliteOptions.initModelParametersAndOpererators();
    } catch (ImportException e) {
        throw new ImportException(e.getMessage());
    } catch (IOException e) {
        throw new IOException(e.getMessage());
    }
}
Also used : ImportException(dr.evolution.io.Importer.ImportException) Taxa(dr.evolution.util.Taxa) Microsatellite(dr.evolution.datatype.Microsatellite) MicroSatImporter(dr.evolution.io.MicroSatImporter) Patterns(dr.evolution.alignment.Patterns)

Aggregations

Patterns (dr.evolution.alignment.Patterns)1 Microsatellite (dr.evolution.datatype.Microsatellite)1 ImportException (dr.evolution.io.Importer.ImportException)1 MicroSatImporter (dr.evolution.io.MicroSatImporter)1 Taxa (dr.evolution.util.Taxa)1