src/PuExperimentSimulation.java
// the population of replicating molecules with a given set of parameters
the population of replicating molecules with a given set of parameters
the population of replicating molecules with a given set of parameters
public static void main(String[] args) throws IOException {
        ParameterSetListMaker maker = new ParameterSetListMaker(DefaultParameterRecipes.getDEFAULT_PARAMETER_RECIPES());
        List<ParameterSet> psList = maker.getParameterSetList();
        Path p1 = Paths.get(ParameterSet.FA_SEQ_FILE);
        seq = new SequenceDNA(p1, new SeqInterval(ParameterSet.SEQUENCE_START, ParameterSet.SEQUENCE_END));
        Path p = Paths.get(ParameterSet.BIN_COUNT_FILE);
        pu = new PuExperiment(p, new SeqBin(ParameterSet.PU_BIN_SIZE,0));  
        Path p2 = Paths.get(ParameterSet.CHROMOSOME_II_GENBANK);
        annotation = new SequenceDNAAnnotationGenbank(p2);
        transcriptList = annotation.getTranscriptsByType(type-> type == Transcript.TRANSCRIPT_TYPE.MRNA || type == Transcript.TRANSCRIPT_TYPE.SNRNA ||
                type == Transcript.TRANSCRIPT_TYPE.RRNA || type == Transcript.TRANSCRIPT_TYPE.SNORNA || type == Transcript.TRANSCRIPT_TYPE.TRNA);
        Path rif1p = Paths.get(ParameterSet.RIF1_INTERVAL_FILE);
        rif1List = new Rif1Sites(rif1p).getRif1IntervalList();
        for (ParameterSet paramSet : psList) {                        
            probDistribution = new ProbabilityDistribution2(seq.atFunction(paramSet.getInitiatorSiteLength()), paramSet, 
                    annotation.getTranscriptBlocks(transcriptList));
            population = new ReplicatingMoleculePopulation(probDistribution, paramSet, rif1List);
            modelComparator = new AtModelComparator(pu, ParameterSet.SEQUENCE_START / ParameterSet.PU_BIN_SIZE, population.getPopulationAveRtForkFreqInBins());
                /*System.out.println("index\tstart\tend\tAT Content\tRif1 index\tprob");    
                InterTranscriptSites sites = new InterTranscriptSites(seq, annotation.getTranscriptBlocks(transcriptList), rif1List, probDistribution);
                sites.getInterTranscriptList().forEach(System.out::println);
                System.out.println("");*/
            switch (task) {
                case PRINT_PARAMETER_SET:
                    System.out.println(paramSet); 
                    break;
                case PRINT_SEQUENCE:
                    System.out.println(seq.intervalToString(new SeqInterval(0, seq.getLength() - 1)));
                    break;
                case PRINT_CDF:
                    System.out.println(paramSet); 
                    System.out.println("MIDPOINT\tCDF");
                    probDistribution.printCDf(ParameterSet.PU_BIN_SIZE);
                    break;
                case PRINT_MEAN_SQUARED_DEVIATION_RIGHT_FORK_FREQUENCY:
                    System.out.println("MSD\tNumPreRCs\tExpConst\tAttenuator\tInitLength\tMaxRate\tStdDevPredicted\tStdDevObserved");
                    System.out.println(modelComparator.getMeanSquaredDifference() + "\t" + paramSet.getNumberInitiators() + "\t" + paramSet.getExponentialPowerFactor() + "\t" + 
                    paramSet.getAttenuationFactor() + "\t" + paramSet.getInitiatorSiteLength() 
                    + "\t" + paramSet.getMaxFiringProbabilityPerMin() + "\t" + modelComparator.getPredictedStdDeviation() + "\t" + modelComparator.getObservedStdDeviation());
                    break;
                case PRINT_PREDICTED_AND_OBSERVED_RIGHT_FORK_FREQUENCIES:
                    printPredictedAndObservedRtForkFrequencies(paramSet);
                    break;
                case PRINT_INITIATION_FREQUENCIES:
                    printInitiationFrequencies(paramSet);
                    break;
                case PRINT_TERMINATION_FREQUENCIES:
                    printTerminationFrequencies(paramSet);
                    break;
                case PRINT_MEDIAN_REPLICATION_TIMES_FOR_BINS_IN_GENOME:
                    System.out.println(paramSet);
                    System.out.println("Position\tMedianTime");
                    List<Double> replicationTimes = population.getPopulationMedianTimeOfReplicationInBins(ParameterSet.PU_BIN_SIZE, ParameterSet.NUMBER_BINS);
                    for (int i = 0; i < replicationTimes.size(); i++) {
                        System.out.println(i * ParameterSet.PU_BIN_SIZE + ParameterSet.PU_BIN_SIZE / 2 + "\t" + replicationTimes.get(i));
                    }
                    break;
                case PRINT_SPHASE_DURATION_FOR_MOLECULES_IN_POPULATION:
                    System.out.println(paramSet);
                    population.getElapsedTimeList().stream().forEach(f-> System.out.println(f));
                    break;
                case PRINT_FRACTION_REPLICATED_OF_BINS_AT_GIVEN_TIME:
                    System.out.println(paramSet);
                    System.out.println("ELAPSED TIME: " + timeOfReplication + " min");
                    System.out.println("Position\tFxReplicated");
                    List<Double> fxReplicated = population.getPopulationAveFxReplicatedInBins(timeOfReplication, ParameterSet.PU_BIN_SIZE, ParameterSet.NUMBER_BINS, paramSet.getMinPerCycle());
                    for (int i = 0; i < fxReplicated.size(); i++) {
                        System.out.println(i * ParameterSet.PU_BIN_SIZE + ParameterSet.PU_BIN_SIZE / 2 + "\t" + fxReplicated.get(i));
                    }
                    break;
                case PRINT_REPLICATION_TIME_OF_BIN_FOR_MOLECULES_IN_POPULATION:
                    System.out.println(paramSet);
                    System.out.println("BIN NUMBER: " + binNumber);
                    for (int i = 0; i < paramSet.getNumberCells(); i++) {
                        System.out.println(population.getPopulationTimesOfReplicationOfBin(binNumber)[i]);
                    }
                    break;
                case PRINT_RF_DELTA_LIST:
                    PrintDeltaAtContentAndNumberTranscribedPositionsOfBins();
            }
        }    
    }
public static void main ( String [ ] args ) throws IOException { ParameterSetListMaker maker = new ParameterSetListMaker ( DefaultParameterRecipes . getDEFAULT_PARAMETER_RECIPES ( ) ) ; List < ParameterSet > psList = maker . getParameterSetList ( ) ; Path p1 = Paths . get ( ParameterSet . FA_SEQ_FILE ) ; seq = new SequenceDNA ( p1 , new SeqInterval ( ParameterSet . SEQUENCE_START , ParameterSet . SEQUENCE_END ) ) ; Path p = Paths . get ( ParameterSet . BIN_COUNT_FILE ) ; pu = new PuExperiment ( p , new SeqBin ( ParameterSet . PU_BIN_SIZE , 0 ) ) ; Path p2 = Paths . get ( ParameterSet . CHROMOSOME_II_GENBANK ) ; annotation = new SequenceDNAAnnotationGenbank ( p2 ) ; transcriptList = annotation . getTranscriptsByType ( type -> type == Transcript . TRANSCRIPT_TYPE . MRNA || type == Transcript . TRANSCRIPT_TYPE . SNRNA || type == Transcript . TRANSCRIPT_TYPE . RRNA || type == Transcript . TRANSCRIPT_TYPE . SNORNA || type == Transcript . TRANSCRIPT_TYPE . TRNA ) ; Path rif1p = Paths . get ( ParameterSet . RIF1_INTERVAL_FILE ) ; rif1List = new Rif1Sites ( rif1p ) . getRif1IntervalList ( ) ; for ( ParameterSet paramSet : psList ) { probDistribution = new ProbabilityDistribution2 ( seq . atFunction ( paramSet . getInitiatorSiteLength ( ) ) , paramSet , annotation . getTranscriptBlocks ( transcriptList ) ) ; population = new ReplicatingMoleculePopulation ( probDistribution , paramSet , rif1List ) ; modelComparator = new AtModelComparator ( pu , ParameterSet . SEQUENCE_START / ParameterSet . PU_BIN_SIZE , population . getPopulationAveRtForkFreqInBins ( ) ) ; /*System.out.println("index\tstart\tend\tAT Content\tRif1 index\tprob");    
                InterTranscriptSites sites = new InterTranscriptSites(seq, annotation.getTranscriptBlocks(transcriptList), rif1List, probDistribution);
                sites.getInterTranscriptList().forEach(System.out::println);
                System.out.println("");*/ switch ( task ) { case PRINT_PARAMETER_SET : System . out . println ( paramSet ) ; break ; case PRINT_SEQUENCE : System . out . println ( seq . intervalToString ( new SeqInterval ( 0 , seq . getLength ( ) - 1 ) ) ) ; break ; case PRINT_CDF : System . out . println ( paramSet ) ; System . out . println ( "MIDPOINT\tCDF" ) ; probDistribution . printCDf ( ParameterSet . PU_BIN_SIZE ) ; break ; case PRINT_MEAN_SQUARED_DEVIATION_RIGHT_FORK_FREQUENCY : System . out . println ( "MSD\tNumPreRCs\tExpConst\tAttenuator\tInitLength\tMaxRate\tStdDevPredicted\tStdDevObserved" ) ; System . out . println ( modelComparator . getMeanSquaredDifference ( ) + "\t" + paramSet . getNumberInitiators ( ) + "\t" + paramSet . getExponentialPowerFactor ( ) + "\t" + paramSet . getAttenuationFactor ( ) + "\t" + paramSet . getInitiatorSiteLength ( ) + "\t" + paramSet . getMaxFiringProbabilityPerMin ( ) + "\t" + modelComparator . getPredictedStdDeviation ( ) + "\t" + modelComparator . getObservedStdDeviation ( ) ) ; break ; case PRINT_PREDICTED_AND_OBSERVED_RIGHT_FORK_FREQUENCIES : printPredictedAndObservedRtForkFrequencies ( paramSet ) ; break ; case PRINT_INITIATION_FREQUENCIES : printInitiationFrequencies ( paramSet ) ; break ; case PRINT_TERMINATION_FREQUENCIES : printTerminationFrequencies ( paramSet ) ; break ; case PRINT_MEDIAN_REPLICATION_TIMES_FOR_BINS_IN_GENOME : System . out . println ( paramSet ) ; System . out . println ( "Position\tMedianTime" ) ; List < Double > replicationTimes = population . getPopulationMedianTimeOfReplicationInBins ( ParameterSet . PU_BIN_SIZE , ParameterSet . NUMBER_BINS ) ; for ( int i = 0 ; i < replicationTimes . size ( ) ; i ++ ) { System . out . println ( i * ParameterSet . PU_BIN_SIZE + ParameterSet . PU_BIN_SIZE / 2 + "\t" + replicationTimes . get ( i ) ) ; } break ; case PRINT_SPHASE_DURATION_FOR_MOLECULES_IN_POPULATION : System . out . println ( paramSet ) ; population . getElapsedTimeList ( ) . stream ( ) . forEach ( f -> System . out . println ( f ) ) ; break ; case PRINT_FRACTION_REPLICATED_OF_BINS_AT_GIVEN_TIME : System . out . println ( paramSet ) ; System . out . println ( "ELAPSED TIME: " + timeOfReplication + " min" ) ; System . out . println ( "Position\tFxReplicated" ) ; List < Double > fxReplicated = population . getPopulationAveFxReplicatedInBins ( timeOfReplication , ParameterSet . PU_BIN_SIZE , ParameterSet . NUMBER_BINS , paramSet . getMinPerCycle ( ) ) ; for ( int i = 0 ; i < fxReplicated . size ( ) ; i ++ ) { System . out . println ( i * ParameterSet . PU_BIN_SIZE + ParameterSet . PU_BIN_SIZE / 2 + "\t" + fxReplicated . get ( i ) ) ; } break ; case PRINT_REPLICATION_TIME_OF_BIN_FOR_MOLECULES_IN_POPULATION : System . out . println ( paramSet ) ; System . out . println ( "BIN NUMBER: " + binNumber ) ; for ( int i = 0 ; i < paramSet . getNumberCells ( ) ; i ++ ) { System . out . println ( population . getPopulationTimesOfReplicationOfBin ( binNumber ) [ i ] ) ; } break ; case PRINT_RF_DELTA_LIST : PrintDeltaAtContentAndNumberTranscribedPositionsOfBins ( ) ; } } }
the population of replicating molecules with a given set of parameters
the population of replicating molecules with a given set of parameters
// set parameter set list //Get sequenceDNA a singleton chromsomome II currently //Get PUExpt chromosome II - a singleton //the pu experiment under study - also sets bin size for analysis //Get genbank annotation file of chromosome II - a singleton //get transcript list - a singleton //get Rif1 list //RUN PARAMETER SETS FOR DYNAMIC SIMULATION //Iterate over all parameter sets //Create probability distribution based on transcript exclusion and AT content //Replicate molecules //Create new model comparator to compare pu data with predicted right fork frequency distribution from population of replicating molecules //print list of interTranscripts with probabilities