@SuppressWarnings({"BroadCatchBlock", "TooBroadCatch"})
    public ReferenceSequence(   String filename,
                                ReferenceSequenceFormat format,
                                String sequenceName,
                                FMIndexCountFrame parent        ) throws ReportedException {

        parentFrame = parent;
        sdf = new SimpleDateFormat("HH:mm:ss.SSS");
        startTimeBuffer = sdf.format(Calendar.getInstance().getTime());
        System.out.println("Start time: " + startTimeBuffer);

        /* initialize memory occupation fields */
        maximalPreprocessingMemoryConsumption = 0;
        currentPreprocessingMemoryConsumption = 0;

        if (format == ReferenceSequenceFormat.FASTA) {
            try {
                preprocessFastaReferenceSequence(filename, sequenceName);
            } catch (ReportedException ex) {
                throw ex;
            } catch (Exception ex) {
                reportError(    "Neočekivana pogreška tijekom predprocesiranja referentnog slijeda u fasta formatu ("
                                + getExceptionType(ex)
                                + "):\n\n    "
                                + ex.getMessage()                                                                       );
                throw new ReportedException();
            }
        } else if (format == ReferenceSequenceFormat.TEXT) {
            try {
                preprocessTextReferenceSequence(filename);
            } catch (ReportedException ex) {
                throw ex;
            } catch (Exception ex) {
                reportError(    "Neočekivana pogreška tijekom predprocesiranja referentnog slijeda u tekst formatu ("
                                + getExceptionType(ex)
                                + "):\n\n    "
                                + ex.getMessage()                                                                       );
                throw new ReportedException();
            }
        } else {
            try {
                readPreprocessedReferenceSequence(filename);
            } catch (ReportedException ex) {
                throw ex;
            } catch (Exception ex) {
                reportError(    "Neočekivana pogreška tijekom učitavanja predprocesiranog referentnog slijeda ("
                                + getExceptionType(ex)
                                + "):\n\n    "
                                + ex.getMessage()                                                                       );
                throw new ReportedException();
            }
        }

        /* report statistics */
        reportStatistics();

        /* update maximal memory consumption field */
        maximalPreprocessingMemoryConsumption = currentPreprocessingMemoryConsumption;
    }