Package stallone.util

Examples of stallone.util.Arguments


                    + "-submatrix <C> <states>\n\n"
                    + "-populousSet <C> <minCount> <minIn> <minOut>"
                    );
            System.exit(0);
        }
        Arguments arg = new Arguments(args);

        if (arg.hasCommand("estimate"))
        {
            List<String> inputfiles = io.listFileNames(arg.getArgument("estimate"));
            List<IIntArray> dtrajs = intseq.loadIntSequences(inputfiles);

            int lag = 1;
            if (arg.hasCommand("lag"))
            {
                lag = arg.getIntArgument("lag");
            }
           
            IDoubleArray C = null;
            if (arg.hasCommand("sampleLag"))
            {
                C = msm.estimateCstepping(dtrajs, lag);
            }
            else
            {
                C = msm.estimateC(dtrajs, lag);
            }
           
            if (arg.hasCommand("countrev"))
            {
                C = alg.addWeightedToNew(0.5, C, 0.5, alg.transposeToNew(C));
            }

            if (arg.hasCommand("subset"))
            {
                IIntArray S = intseq.loadIntSequence(arg.getArgument("subset"));
                C = C.view(S.getArray(), S.getArray());
            }

            doubles.writeMatrixSparse(C, System.out);
        }
        if (arg.hasCommand("submatrix"))
        {
            IDoubleArray C = doublesNew.fromFile(arg.getArgument("submatrix", 0));
            IIntArray S = intseq.loadIntSequence(arg.getArgument("submatrix", 1));
            C = C.view(S.getArray(), S.getArray());
            doubles.writeMatrixSparse(C, System.out);
        }
        if (arg.hasCommand("populousSet"))
        {
            IDoubleArray C = doublesNew.fromFile(arg.getArgument("populousSet", 0));
            int n = C.rows();
            double minCount = arg.getIntArgument("populousSet",1);
            double minIn = arg.getIntArgument("populousSet",2);
            double minOut = arg.getIntArgument("populousSet",3);

            IDoubleArray counts = alg.rowSums(C);
            IDoubleArray ins = alg.columnSums(C);
            IDoubleArray outs = alg.rowSums(C);
            for (int i=0; i<n; i++)
View Full Code Here


            System.out.println();
            System.out.println("MSM_Flux -pathways <flux> <q+> <A> <B>");
            System.out.println("Pathway decomposition");
            System.exit(0);
        }
        Arguments arg = new Arguments(args);

        if (arg.hasCommand("cg"))
        {
            IDoubleArray f = doublesNew.fromFile(arg.getArgument("i", 0));
            int[][] I = io.readIntMatrix(arg.getArgument("i", 1));
            IDoubleArray F = doublesNew.matrix(I.length, I.length);

            // sum up fluxes
            for (int I1 = 0; I1 < I.length; I1++)
            {
                for (int I2 = 0; I2 < I.length; I2++)
                {
                    for (int i = 0; i < I[I1].length; i++)
                    {
                        for (int j = 0; j < I[I2].length; j++)
                        {
                            F.set(I1, I2, F.get(I1, I2) + f.get(I[I1][i], I[I2][j]));
                        }
                    }
                }
            }

            // net flux
            IDoubleArray Fnet = doublesNew.matrix(I.length, I.length);
            for (int i = 0; i < Fnet.rows(); i++)
            {
                Fnet.set(i, i, 0);
                for (int j = i + 1; j < Fnet.columns(); j++)
                {
                    if (F.get(i, j) > F.get(j, i))
                    {
                        Fnet.set(i, j, F.get(i, j) - F.get(j, i));
                    }
                    else
                    {
                        Fnet.set(j, i, F.get(j, i) - F.get(i, j));
                    }
                }
            }

            if (arg.hasCommand("oflux"))
            {
                doubles.writeMatrixSparse(F, new PrintStream(arg.getArgument("oflux")));
            }
            if (arg.hasCommand("onetflux"))
            {
                doubles.writeMatrixSparse(Fnet, new PrintStream(arg.getArgument("onetflux")));
            }
        }
        if (arg.hasCommand("pathways"))
        {
            IDoubleArray F = doublesNew.fromFile(arg.getArgument("pathways", 0));
            double[] Q = io.readDoubleColumn(arg.getArgument("pathways", 1), 0);
            int[] A = str.toIntArray(arg.getArgument("pathways", 2));
            int[] B = str.toIntArray(arg.getArgument("pathways", 3));

            PathwayDecomposition decomp = new PathwayDecomposition(F, Q, A, B);
            List<int[]> allPaths = new ArrayList<int[]>();
            List<Double> allFluxes = new ArrayList<Double>();
            int[] path = null;
View Full Code Here

            System.out.println();
            System.out.println("Calculates the connectivity (strong components) of the specified count matrix. -oGiant writes out the giant component");
            System.exit(0);
        }

        Arguments arg = new Arguments(args);

        IDoubleArray C = doublesNew.fromFile(arg.getArgument("iC"));
        List<IIntArray> components = graph.connectedComponents(C);
        int[] I = intArrays.sortedIndexes(intseq.lengths(components));

        System.out.println("Strong Components: "+I.length);
        System.out.println("Lengths: "+intArrays.toString(I,", "));
        System.out.println("members: ");
        for (int i=0; i<I.length; i++)
        {
            IIntArray c = components.get(I[i]);
            System.out.println(ints.toString(c)+" ");
        }
       
        if (arg.hasCommand("oGiant"))
        {
            io.writeString(arg.getArgument("oGiant"), ints.toString(components.get(I[0]),"\n"));
        }
    }
View Full Code Here

                    + "-eigenvalues <M> [-norm | -complex]\n"
                    + "-eigenvectors <M> <neig> [-left]\n"
                    + "");
            System.exit(0);
        }
        Arguments arg = new Arguments(args);

        if (arg.hasCommand("sparse2dense"))
        {
            IDoubleArray T = doublesNew.fromFile(arg.getArgument("sparse2dense"));
            doubles.writeMatrixDense(T, System.out);
        }
        if (arg.hasCommand("dense2sparse"))
        {
            IDoubleArray T = doublesNew.fromFile(arg.getArgument("dense2sparse"));
            doubles.writeMatrixSparse(T, System.out);
        }
        if (arg.hasCommand("eigenvalues"))
        {
            IDoubleArray T = doublesNew.fromFile(arg.getArgument("eigenvalues"));
            IEigenvalueDecomposition evd = alg.evd(T);

            if (arg.hasCommand("norm"))
            {
                doubles.print(evd.getEvalNorm(), "\n");
            }
            else if (arg.hasCommand("complex"))
            {
                IComplexArray eval = evd.getEval();
                for (int i=0; i<eval.size(); i++)
                    System.out.println(eval.getRe(i)+" + "+eval.getIm(i)+"i");
            }
            else
            {
                doubles.print(evd.getEvalRe(), "\n");
            }
        }
        if (arg.hasCommand("eigenvectors"))
        {
            IDoubleArray T = doublesNew.fromFile(arg.getArgument("eigenvectors"));
            if (arg.hasCommand("left"))
                alg.transpose(T);
            int n = arg.getIntArgument("eigenvectors", 1);

            IDoubleArray EV = alg.evd(T).R();
            EV = EV.viewBlock(0, EV.rows(), 0, n);
            doubles.print(EV, " ", "\n");
        }
View Full Code Here

                    + "          -largestEVanalysis (-ibin <matrix-bin> | -itxt <matrix-bin>) (-o <evecOut> <evalOut>)\n"
                    + "          -powerMethod <matrix>");
            System.out.println("          -eigenvalues <matrix>");
            System.exit(0);
        }
        Arguments arg = new Arguments(args);

        if (arg.hasCommand("subspaceOverlap"))
        {
            double[][] V1 = doubleArrays.loadMatrix(arg.getArgument("subspaceOverlap", 0));
            double[][] V2 = doubleArrays.loadMatrix(arg.getArgument("subspaceOverlap", 1));
            System.out.println(CoordinateUtilities3D.subspaceOverlap(V1, V2));
        }
        if (arg.hasCommand("superspaceOverlap"))
        {
            double[][] V1 = doubleArrays.loadMatrix(arg.getArgument("superspaceOverlap", 0));
            double[][] V2 = doubleArrays.loadMatrix(arg.getArgument("superspaceOverlap", 1));
            System.out.println(CoordinateUtilities3D.superspaceOverlap(V1, V2));
        }


    }
View Full Code Here

TOP

Related Classes of stallone.util.Arguments

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.