Found 268151 results in 41171 files, showing top 450 files (show more).
enhancerHomologSearch:src/ClustalW/substitutionMatrix/SubMatrix.h: [ ]
39: typedef vector<short> Matrix;
41: class SubMatrix
114:         int matrixNum;
119:         string* matrixName;
142:         Matrix QTscoreUserMatrix;
143:         Matrix QTscoreUserDNAMatrix;
144:         Matrix QTsegmentDNAMatrix;
145:         Matrix QTsegmentAAMatrix;
148:         const int sizenAAMatrix; 
149:         const int sizeDNAMatrix; 
169:         int matrixAvgScore; // NOTE Needed by other classes.
24: #define SUBMATRIX_H
115:         int DNAMatrixNum;
116:         int pwMatrixNum;
117:         int pwDNAMatrixNum;
120:         string* DNAMatrixName;
121:         string* pwMatrixName;
122:         string* pwDNAMatrixName;
9:  * It is also used to store the user defined matrix. This will be used mainly as an interface
11:  * The way this class will work is the user can read in matrix series or a single matrix, 
12:  * or they can select one of the matrix series (e.g Blosum). This will then be used in the
17:  * A single matrix is choosen for pairwise and for DNA alignments.
63:         int getPairwiseMatrix(int matrix[NUMRES][NUMRES], PairScaleValues& scale, 
65:         int getProfileAlignMatrix(int matrix[NUMRES][NUMRES], double pcid, int minLen, 
67:         int getAlnScoreMatrix(int matrix[NUMRES][NUMRES]);
73:         void getQTMatrixForHistogram(int matrix[NUMRES][NUMRES]); 
80:         void getQTMatrixForLowScoreSeg(int matrix[NUMRES][NUMRES]);
93:         int getMatrix(Matrix* matPtr, Xref* xref, int matrix[NUMRES][NUMRES],
95:         int readMatrixSeriesFromR(const Rcpp::NumericMatrix substitutionmatrix, Matrix& userMat, Xref& xref);
96:         int readUserMatrixFromR(const Rcpp::NumericMatrix substitutionMatrix, Matrix& userMat, Xref& xref);
97:         int readMatrixSeries(const char *fileName, Matrix& userMat, Xref& xref);
98:         int readUserMatrix(const char *fileName, Matrix& userMat, Xref& xref);
108:         Matrix* getUserMatAddress(int alignResidueType, int alignType);
124:         // Matrix cross references.
137:         vector<Matrix> userMatSeries;
138:         Matrix userMat;
139:         Matrix pwUserMat;
140:         Matrix userDNAMat;
141:         Matrix pwUserDNAMat;
150:         Matrix* blosum30mtVec; 
151:         Matrix* blosum40mtVec;
152:         Matrix* blosum45mtVec;
153:         Matrix* blosum62mt2Vec;
154:         Matrix* blosum80mtVec;
155:         Matrix* pam20mtVec;
156:         Matrix* pam60mtVec;
157:         Matrix* pam120mtVec;
158:         Matrix* pam350mtVec;
159:         Matrix* idmatVec;
160:         Matrix* gon40mtVec;
161:         Matrix* gon80mtVec;
162:         Matrix* gon120mtVec;
163:         Matrix* gon160mtVec;
164:         Matrix* gon250mtVec;
165:         Matrix* gon350mtVec;
166:         Matrix* clustalvdnamtVec;
167:         Matrix* swgapdnamtVec;
179:         Matrix* mat;
181:         Matrix* _matPtr;
23: #ifndef SUBMATRIX_H
45:         SubMatrix();
46:         ~SubMatrix();
48:         bool getUserMatFromR(Rcpp::NumericMatrix substitutionMatrix, int alignResidueType, int alignType);
49:         bool getAAScoreMatFromR(Rcpp::NumericMatrix substitutionMatrix);
50:         bool getDNAScoreMatFromR(Rcpp::NumericMatrix substitutionMatrix);
51:         bool getQTLowScoreMatFromR(Rcpp::NumericMatrix substitutionMatrix, bool dna);
52:         bool getUserMatSeriesFromR(Rcpp::NumericMatrix substitutionMatrix);
60:         void setCurrentNameAndNum(string _matrixName, int _matrixNum, int alignResidueType,
62:         int getMatrixNumForMenu(int alignResidueType, int alignType);
69:         int getMatrixNum();
70:         int getDNAMatrixNum();
71:         int getPWMatrixNum();
72:         int getPWDNAMatrixNum();
104:         void printGetMatrixResults(int mat[NUMRES][NUMRES]); 
170:         UserMatrixSeries matSeries;
lpsymphony:src/SYMPHONY/Clp/src/AbcMatrix.hpp: [ ]
289:   inline CoinPackedMatrix * matrix() const {
403:   CoinPackedMatrix * matrix_;
22: class AbcMatrix {
28:   inline CoinPackedMatrix * getPackedMatrix() const {
7: #define AbcMatrix_H
495: class AbcMatrix2 {
564: class AbcMatrix3 {
29:     return matrix_;
31:   /** Whether the packed matrix is column major ordered or not. */
35:   /** Number of entries in the packed matrix. */
37:     return matrix_->getNumElements();
41:     assert(matrix_->getNumCols()==model_->numberColumns());return matrix_->getNumCols();
45:     assert(matrix_->getNumRows()==model_->numberRows());return matrix_->getNumRows();
49:   /// A vector containing the elements in the packed matrix.
51:     return matrix_->getElements();
55:     return matrix_->getMutableElements();
57:   /// A vector containing the minor indices of the elements in the packed matrix. 
59:     return matrix_->getIndices();
61:   /// A vector containing the minor indices of the elements in the packed matrix. 
63:     return matrix_->getMutableIndices();
67:     return matrix_->getVectorStarts();
70:     return matrix_->getMutableVectorStarts();
74:     return matrix_->getVectorLengths();
78:     return matrix_->getMutableVectorLengths();
88:   /** Returns a new matrix in reverse order without gaps */
132:   /**@name Matrix times vector methods */
290:     return matrix_;
307:   /// Current start of search space in matrix (as fraction)
314:   /// Current end of search space in matrix (as fraction)
452:   /// Current start of search space in matrix (as fraction)
454:   /// Current end of search space in matrix (as fraction)
607:   void swapOne(const AbcSimplex * model, const AbcMatrix * matrix,
1: /* $Id: AbcMatrix.hpp 1910 2013-01-27 02:00:13Z stefan $ */
6: #ifndef AbcMatrix_H
14: /** This implements a scaled version of CoinPackedMatrix
16:     1) scaled CoinPackedMatrix without gaps
20: class AbcMatrix2;
21: class AbcMatrix3;
27:   /// Return a complete CoinPackedMatrix
89:   CoinPackedMatrix * reverseOrderedCopy() const;
288:   /// Returns CoinPackedMatrix (non const)
372:   AbcMatrix();
374:   ~AbcMatrix();
380:   AbcMatrix(const AbcMatrix&);
381:   /** The copy constructor from an CoinPackedMatrix. */
382:   AbcMatrix(const CoinPackedMatrix&);
385:   AbcMatrix (const AbcMatrix & wholeModel,
388:   AbcMatrix (const CoinPackedMatrix & wholeModel,
392:   AbcMatrix& operator=(const AbcMatrix&);
394:   void copy(const AbcMatrix * from);
449:   //AbcMatrix2 * rowCopy_;
451:   //AbcMatrix3 * columnCopy_;
504: 		      const CoinPackedMatrix * rowCopy,
518:   AbcMatrix2();
520:   AbcMatrix2(AbcSimplex * model, const CoinPackedMatrix * rowCopy);
522:   ~AbcMatrix2();
528:   AbcMatrix2(const AbcMatrix2&);
529:   AbcMatrix2& operator=(const AbcMatrix2&);
589:   AbcMatrix3();
591:   AbcMatrix3(AbcSimplex * model, const CoinPackedMatrix * columnCopy);
593:   ~AbcMatrix3();
599:   AbcMatrix3(const AbcMatrix3&);
600:   AbcMatrix3& operator=(const AbcMatrix3&);
11: #include "ClpMatrixBase.hpp"
RSeqAn:inst/include/seqan/align/matrix_base.h: [ ]
96: class Matrix<TValue, 0, THost>
111:     Matrix()
115:     Matrix(Matrix const & other_):
159: class Matrix<TValue, 2, THost>
176:     Matrix()
185:     Matrix(Matrix const & other_):
219: class Matrix<TValue, 3, THost>
236:     Matrix()
245:     Matrix(Matrix const & other_):
130:     ~Matrix()
201:     ~Matrix()
261:     ~Matrix()
455:     typedef Matrix<TValue, DIMENSION, THost> TMatrix;
481:     typedef Matrix<TValue, DIMENSION, THost> TMatrix;
38: #define SEQAN_HEADER_MATRIX_BASE_H
57:     typedef Matrix<TValue, DIMENSION, THost> TMatrix_;
37: #ifndef SEQAN_HEADER_MATRIX_BASE_H
49: class Matrix;
55: struct SizeArr_<Matrix<TValue, DIMENSION, THost> >
65: struct Host<Matrix<TValue, DIMENSION, THost> >
71: struct Host<Matrix<TValue, DIMENSION, THost> const>
82:  * @class Matrix
84:  * @brief A simple n-dimensional matrix type.
87:  *            class Matrix;
89:  * @tparam TValue    Type of matrix entries.
90:  * @tparam DIMENSION Dimension of the matrix.  Use 0 for n-dimensional, values &gt; 0 for a matrix with
101:     typedef typename Size<Matrix>::Type TSize;
121:     inline Matrix const &
122:     operator = (Matrix const & other_)
164:     typedef typename Size<Matrix>::Type TSize;
191:     inline Matrix const &
192:     operator = (Matrix const & other_)
224:     typedef typename Size<Matrix>::Type TSize;
251:     inline Matrix const &
252:     operator = (Matrix const & other_)
279: inline typename SizeArr_<Matrix<TValue, DIMENSION, THost> >::Type &
280: _dataLengths(Matrix<TValue, DIMENSION, THost> & me)
286: inline typename SizeArr_<Matrix<TValue, DIMENSION, THost> >::Type const &
287: _dataLengths(Matrix<TValue, DIMENSION, THost> const & me)
293: inline typename SizeArr_<Matrix<TValue, DIMENSION, THost> >::Type &
294: _dataFactors(Matrix<TValue, DIMENSION, THost> & me)
300: inline typename SizeArr_<Matrix<TValue, DIMENSION, THost> >::Type const &
301: _dataFactors(Matrix<TValue, DIMENSION, THost> const & me)
311: dependent(Matrix<TValue, DIMENSION, THost> & me)
319: inline Holder<typename Host<Matrix<TValue, DIMENSION, THost> >::Type> &
320: _dataHost(Matrix<TValue, DIMENSION, THost> & matrix)
322:     return matrix.data_host;
326: inline Holder<typename Host<Matrix<TValue, DIMENSION, THost> >::Type> const &
327: _dataHost(Matrix<TValue, DIMENSION, THost> const & matrix)
329:     return matrix.data_host;
336: assignHost(Matrix<TValue, DIMENSION, THost> & me, THost const & value_)
345: moveHost(Matrix<TValue, DIMENSION, THost> & me, THost const & value_)
353: struct Value< Matrix<TValue, DIMENSION, THost> >
361: struct Iterator< Matrix<TValue, DIMENSION, THost>, TIteratorSpec >
363:     typedef Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator> Type;
367: struct Iterator< Matrix<TValue, DIMENSION, THost> const, TIteratorSpec >
369:     typedef Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator> Type;
376: inline typename Size<Matrix<TValue, DIMENSION, THost> const>::Type
377: dimension(Matrix<TValue, DIMENSION, THost> const & me)
386: setDimension(Matrix<TValue, DIMENSION, THost> & me,
402: inline typename Size<Matrix<TValue, DIMENSION, THost> >::Type
403: length(Matrix<TValue, DIMENSION, THost> const & me,
410: inline typename Size<Matrix <TValue, DIMENSION, THost> >::Type
411: length(Matrix<TValue, DIMENSION, THost> const & me)
417: inline bool empty(Matrix<TValue, DIMENSION, THost> const & me)
426: setLength(Matrix<TValue, DIMENSION, THost> & me,
433:     typedef typename SizeArr_<Matrix<TValue, DIMENSION, THost> >::TSize_ TSize_;
441:  * @fn Matrix#resize
442:  * @brief Resize the matrix and fill it with a given value or zeroes.
444:  * @signature void resize(matrix[, val]);
446:  * @param[in,out] matrix The Matrix to fill.
447:  * @param[in]     val    The optional value to fill the matrix with.
453: resize(Matrix<TValue, DIMENSION, THost> & me)
479: resize(Matrix<TValue, DIMENSION, THost> & me, TFillValue myValue)    //resize the matrix and fill with value
503: inline typename Position<Matrix <TValue, DIMENSION, THost> >::Type
504: nextPosition(Matrix<TValue, DIMENSION, THost> & me,
512: inline typename Position<Matrix <TValue, DIMENSION, THost> >::Type
513: nextPosition(Matrix<TValue, DIMENSION, THost> const & me,
521: inline typename Position<Matrix <TValue, DIMENSION, THost> >::Type
522: previousPosition(Matrix<TValue, DIMENSION, THost> & me,
530: inline typename Position<Matrix <TValue, DIMENSION, THost> >::Type
531: previousPosition(Matrix<TValue, DIMENSION, THost> const & me,
541: inline typename Size< Matrix <TValue, DIMENSION, THost> >::Type
542: coordinate(Matrix<TValue, DIMENSION, THost> const & me,
561: inline typename Iterator<Matrix <TValue, DIMENSION, THost>, Tag<TTag> const>::Type
562: begin(Matrix<TValue, DIMENSION, THost> & me,
565:     return typename Iterator<Matrix <TValue, DIMENSION, THost>, Tag<TTag> const >::Type(me, 0);
568: inline typename Iterator<Matrix <TValue, DIMENSION, THost> const, Tag<TTag> const>::Type
569: begin(Matrix<TValue, DIMENSION, THost> const & me,
572:     return typename Iterator<Matrix <TValue, DIMENSION, THost> const, Tag<TTag> const >::Type(me, 0);
578: inline typename Iterator<Matrix <TValue, DIMENSION, THost>, Tag<TTag> const >::Type
579: end(Matrix<TValue, DIMENSION, THost> & me,
582:     return typename Iterator<Matrix <TValue, DIMENSION, THost>, Tag<TTag> const >::Type(me, length(host(me)));
585: inline typename Iterator<Matrix <TValue, DIMENSION, THost> const, Tag<TTag> const >::Type
586: end(Matrix<TValue, DIMENSION, THost> const & me,
589:     return typename Iterator<Matrix <TValue, DIMENSION, THost>, Tag<TTag> const >::Type(me, length(host(me)));
595: inline typename Reference<Matrix<TValue, DIMENSION, THost> >::Type
596: value(Matrix<TValue, DIMENSION, THost> & me,
603: inline typename Reference<Matrix<TValue, DIMENSION, THost> const>::Type
604: value(Matrix<TValue, DIMENSION, THost> const & me,
614: inline typename Reference<Matrix<TValue, DIMENSION, THost> >::Type
615: value(Matrix<TValue, DIMENSION, THost> & me,
623: inline typename Reference<Matrix<TValue, DIMENSION, THost> const>::Type
624: value(Matrix<TValue, DIMENSION, THost> const & me,
636: inline typename Reference<Matrix<TValue, DIMENSION, THost> >::Type
637: value(Matrix<TValue, DIMENSION, THost> & me,
650: inline typename Reference<Matrix<TValue, DIMENSION, THost> >::Type
651: value(Matrix<TValue, DIMENSION, THost> & me,
667: goNext(Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator> & me,
675: goNext(Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator> & me,
683: goNext(Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator> & me)
690: goNext(Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator> & me)
701: goPrevious(Iter< Matrix<TValue, DIMENSION, THost>, PositionIterator > & me,
709: goPrevious(Iter< Matrix<TValue, DIMENSION, THost> const, PositionIterator > & me,
717: goPrevious(Iter< Matrix<TValue, DIMENSION, THost>, PositionIterator > & me)
724: goPrevious(Iter< Matrix<TValue, DIMENSION, THost> const, PositionIterator > & me)
735: goTo(Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1)
743: goTo(Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1)
751: goTo(Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1, TPosition2 pos...(2 bytes skipped)...
759: goTo(Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator> & me, TPosition0 pos0, TPosition1 pos1, TPositio...(8 bytes skipped)...
768: inline typename Size< Matrix<TValue, DIMENSION, THost> >::Type
769: coordinate(Iter<Matrix<TValue, DIMENSION, THost>, PositionIterator > & me,
776: inline typename Size< Matrix<TValue, DIMENSION, THost> >::Type
777: coordinate(Iter<Matrix<TValue, DIMENSION, THost> const, PositionIterator > & me,
784:  * @fn Matrix::operator+
785:  * @brief Sum operator for the Matrix type.
787:  * @signature TMatrix Matrix::operator+(lhs, rhs);
792:  * @return TMatrix The resulting matrix of same type as <tt>lhs</tt> and <tt>rhs</tt>.
796: Matrix<TValue,DIMENSION>
797: operator + (Matrix<TValue,DIMENSION, THost1> const & matrix1, Matrix<TValue,DIMENSION, THost2> const & matrix2)
800:     SEQAN_ASSERT(_dataLengths(matrix1) == _dataLengths(matrix2));
802:     Matrix<TValue,DIMENSION> result;
803:     //copy the first matrix
804:     setDimension(result,length(_dataLengths(matrix1)));
805:     _dataLengths(result) = _dataLengths(matrix1);
811:         value(host(result), i)=value(host(matrix1), i)+value(host(matrix2), i);
813:     //Return matrix sum
818: Matrix<TValue,DIMENSION>
819: operator - (Matrix<TValue,DIMENSION, THost1> const & matrix1,Matrix<TValue,DIMENSION, THost2> const & matrix2)
822:     SEQAN_ASSERT(_dataLengths(matrix1) == _dataLengths(matrix2));
824:     Matrix<TValue,DIMENSION> result;
825:     //resize the matrix
826:     setDimension(result,length(_dataLengths(matrix1)));
827:     _dataLengths(result) = _dataLengths(matrix1);
833:         value(host(result), i)=value(host(matrix1), i)-value(host(matrix2), i);
835:     //Return matrix difference
840: Matrix<TValue, 2>
841: operator * (Matrix<TValue, 2, THost1> const & matrix1, Matrix<TValue, 2, THost2> const & matrix2)
843:     SEQAN_ASSERT_EQ(length(matrix1,1), length(matrix2,0));
845:     unsigned int nrow1=length(matrix1,0);
846:     unsigned int ncol2=length(matrix2,1);
847:     Matrix<TValue, 2> result;
848:     //resize the matrix
853:     //Matrix product
858:             for(unsigned int colRes = 0; colRes < length(matrix1,1); colRes++)
860:                 value(result,row,col)+=    value(host(matrix1), row + colRes * matrix1.data_factors[1])*value(host(matrix2), colRes + col * matrix2.data_factors[1]);
864:     //return the matrix product
870: Matrix<TValue, 2>
871: operator * (TValue const & scalar, Matrix<TValue, 2, THost> const & matrix)
873:     Matrix<TValue, 2> result;
874:     result= matrix;
880:     //return the matrix product
885: Matrix<TValue, 2>
886: operator * (Matrix<TValue, 2, THost> const & matrix, TValue const & scalar)
888:     Matrix<TValue, 2> result;
889:     result= matrix;
895:     //return the matrix product
902: operator == (Matrix<TValue, DIMENSION1, THost1> const & matrix1, Matrix<TValue, DIMENSION2, THost2> const & matrix2)
905:     result= (matrix1.data_lengths==matrix2.data_lengths)&&(matrix1.data_factors==matrix2.data_factors)&&(value(matrix1.data_host)==value(matrix2.data_host))&&(DIMENSION1==DIMENSION2);
911: Matrix<TValue,2>
912: matricialSum(Matrix<TValue,2> &matrix1,Matrix<TValue,2> &matrix2)
915:     if(length(matrix1,0) != length(matrix2,0)||length(matrix1,1) != length(matrix2,1))
921:     unsigned int nrow=length(matrix1,0);
922:     unsigned int ncol=length(matrix1,1);
924:     Matrix<TValue,2> result;
925:     //resize the matrix
933:         value(host(result), i)=value(host(matrix1), i)+value(host(matrix2), i);
935:     //Return matrix difference
946: inline Matrix<TValue,2>
947: matricialDifference(Matrix<TValue,2> & matrix1, Matrix<TValue,2> & matrix2)
950:     if(length(matrix1,0) != length(matrix2,0)||length(matrix1,1) != length(matrix2,1))
955:     unsigned int nrow=length(matrix1,0);
956:     unsigned int ncol=length(matrix1,1);
958:     Matrix<TValue,2> result;
959:     //resize the matrix
970:                 value(host(result), i1 + i2 * _dataFactors(result)[1])=value(host(matrix1), i1 + i2 * _dataFactors(matrix1)[1])-value(host(matrix2), i1 + i2 * _dataFactors(matrix2)[1]);
974:     //Return matrix difference
981: inline Matrix<TValue, 2>
982: matricialProduct(Matrix<TValue, 2> &matrix1,
983:         Matrix<TValue, 2> &matrix2)
986:     if(length(matrix1,1) != length(matrix2,0))
988:         fprintf(stderr,"Error: Number of columns of matrix1 is unequal to number of rows of matrix2");
991:     unsigned int nrow1=length(matrix1,0);
992:     unsigned int ncol2=length(matrix2,1);
993:     Matrix<TValue, 2> result;
994:     //resize the matrix
999:     //Matrix product
1004:             for(unsigned int colRes = 0; colRes < length(matrix1,1); colRes++)
1006:                 value(result,row,col)+=value(matrix1, row,colRes)*value(matrix2,colRes,col);
1010:     //return the matrix product
1016:  * @fn Matrix#transpose
1017:  * @brief Tranpose a 2D Matrix.
1019:  * @signature TMatrix transpose(matrix);
1021:  * @param[in] matrix The matrix to tranpose.
1022:  * @return TMatrix The resulting tranposed matrix.
1026: Matrix<TValue,2>
1027: transpose(Matrix<TValue,2, THost> const & matrix)
1030:     unsigned int nrow=length(matrix,0);
1031:     unsigned int ncol=length(matrix,1);
1033:     Matrix<TValue,2> result;
1034:     //resize the matrix
1044:             value(host(result), i2 + i1 * _dataFactors(result)[1])=value(host(matrix), i1 + i2 * matrix.data_factors[1]);
1049:     //Return transposed matrix
1056: std::ostream& operator<<(std::ostream &out, const Matrix<TValue,2, THost> &matrix)
1058:     for(unsigned int i1 = 0;i1< matrix.data_lengths[0];++i1)
1060:             for(unsigned int i2 = 0;i2<(matrix.data_lengths[1]-1);++i2)
1062:                 out<<value(host(matrix), i1 + i2 * matrix.data_factors[1])<<"\t";
1065:             out<<value(host(matrix), i1 + (matrix.data_lengths[1]-1) *matrix.data_factors[1])<<"\n";
1078: // void read(FILE *file, Matrix<TValue,2> & matrix)
1082: //     //read the transition matrix
1083: //     setLength(matrix, 0, column_size);
1084: //     setLength(matrix, 1, column_size);
1085: // resize(matrix,0.0);
1090: //           fscanf(file,"%lf ", & value(matrix, row,col));
58:     typedef typename Size<TMatrix_>::Type TSize_;
456:     typedef typename Size<TMatrix>::Type TSize;
482:     typedef typename Size<TMatrix>::Type TSize;
Rdisop:src/imslib/src/ims/utils/matrix.h: [ ]
48: class matrix {
65: 	matrix (size_type n, size_type m, value_type v = value_type()) { data = data_type (n, row_type (m, v)); }
3: #define IMS_MATRIX_H
1: // this header defines template object matrix, and also necessary row
2: #ifndef IMS_MATRIX_H
10: // row type necessary for matrix
87: typename matrix<T,A>::size_type matrix<T,A>::cols() const
139: //matrix
143: std::istream& operator>> (std::istream& s, const matrix<T,A>& m)
145: 	typename matrix<T,A>::const_row_iterator it = m.rows_begin();
156: std::ostream& operator<< (std::ostream& s, const matrix<T,A>& m)
158: 	typename matrix<T,A>::const_row_iterator it = m.rows_begin();
beachmat:inst/include/tatami/base/Matrix.hpp: [ ]
22: class Matrix {
549: using NumericMatrix = Matrix<double, int>;
2: #define TATAMI_MATRIX_H
1: #ifndef TATAMI_MATRIX_H
8:  * @file Matrix.hpp
10:  * Virtual class for a matrix with a defined type.
16:  * @brief Virtual class for a matrix with a defined type.
18:  * @tparam T Type of the matrix data.
24:     virtual ~Matrix() = default;
35:     Matrix(Matrix&&) = default;
40:     Matrix& operator=(Matrix&&) = default;
45:     Matrix(const Matrix&) = default;
50:     Matrix& operator=(const Matrix&) = default;
53:     Matrix() = default;
85:      * @return Is this matrix sparse?
98:      * @return A `pair` containing the number of matrix elements that prefer row-level access (`first`) or column-level access (`second`).
103:      * For simpler matrices, the return value contains the total size of the matrix in one of the `double`s and zero in the other.
CoGAPS:src/data_structures/Matrix.cpp: [ ]
12: Matrix::Matrix() : mNumRows(0), mNumCols(0) {}
14: Matrix::Matrix(unsigned nrow, unsigned ncol)
30: Matrix::Matrix(const Matrix &mat, bool genesInCols, bool subsetGenes,
72: Matrix::Matrix(const std::string &path, bool genesInCols, bool subsetGenes,
177: Matrix Matrix::getMatrix() const
1: #include "Matrix.h"
21: void Matrix::pad(float val)
29: // constructor from data set read in as a matrix
136: unsigned Matrix::nRow() const
141: unsigned Matrix::nCol() const
146: float Matrix::operator()(unsigned i, unsigned j) const
153: float& Matrix::operator()(unsigned i, unsigned j)
160: Vector& Matrix::getCol(unsigned col)
166: const Vector& Matrix::getCol(unsigned col) const
172: bool Matrix::empty() const
182: Archive& operator<<(Archive &ar, const Matrix &mat)
192: Archive& operator>>(Archive &ar, Matrix &mat)
4: #include "../file_parser/MatrixElement.h"
105:             MatrixElement e(fp.getNext());
116:             MatrixElement e(fp.getNext());
Rdisop:src/imslib/src/ims/calib/matchmatrix.h: [ ]
43: 	row_t *matrix;
23: class InvalidMatchMatrix : public Exception {
25: 		explicit InvalidMatchMatrix() : Exception() { }
26: 		explicit InvalidMatchMatrix(const std::string& msg) : Exception(msg) { }
33: class MatchMatrix {
2: #define IMS_MATCHMATRIX_H
30: /** Represents a matrix which contains entries either 0 or 1 and has a staircase property.
35: 	// The matrix is a staircase matrix, so we only store the start and the end
1: #ifndef IMS_MATCHMATRIX_H
46: 	/** Construct MatchMatrix with specified number of rows.
49: 	explicit MatchMatrix(std::size_t rows);
50: 	~MatchMatrix();
53: 	void set(std::size_t row, std::size_t column) /*throw (IndexOutOfBounds, InvalidMatchMatrix)*/;
55: 	void unset(std::size_t row, std::size_t column) /*throw (IndexOutOfBounds, InvalidMatchMatrix)*/;
QUBIC:src/matrix.h: [ ]
7: template<typename T> class Matrix {
12:   Matrix(std::size_t reserved_count) {
2: #define MATRIX_H
1: #ifndef MATRIX_H
CoGAPS:src/data_structures/Matrix.h: [ ]
11: class Matrix
2: #define __COGAPS_MATRIX_H__
1: #ifndef __COGAPS_MATRIX_H__
15:     Matrix();
16:     Matrix(unsigned nrow, unsigned ncol);
17:     Matrix(const Matrix &mat, bool genesInCols, bool subsetGenes,
19:     Matrix(const std::string &path, bool genesInCols, bool subsetGenes,
29:     Matrix getMatrix() const;
30:     friend Archive& operator<<(Archive &ar, const Matrix &mat);
31:     friend Archive& operator>>(Archive &ar, Matrix &mat);
38: #endif // __COGAPS_MATRIX_H__
GSVA:inst/shinyApp/matrixModule.R: [ ]
26:     matrix <- reactive({
1: matrixUI <- function(id){
24: matrixServer <- function(id){
3:   div(id = ns("matrix-input"),
5:                  label = h5("EXPRESSION DATA MATRIX", style="font-weight: bold"),
10:       fileInput(ns("matrixFile"), "Choose expression data matrix file:",
18:       selectInput(ns("matrixVar"), "Choose expression data matrix object:",
29:         matrix <- data.matrix(read.csv(file=input$matrixFile$datapath, row.names = 1L))
32:         matrix <- get(input$matrixVar)
34:       matrix
4:     radioButtons(ns("matrixSourceType"),
6:                  choices = c("From file" = "fileMatrix",
7:                    "From workspace" = "varMatrix")),
9:       condition = "input.matrixSourceType == 'fileMatrix'", ns = ns,
17:       condition = "input.matrixSourceType == 'varMatrix'", ns= ns,
27:       if(input$matrixSourceType=="fileMatrix"){
28:         if(is.null(input$matrixFile)) return(NULL) #this is in order to disable "run" btn
31:         if(is.null(input$matrixVar)) return(NULL)
36:       if(input$matrixSourceType == "fileMatrix"){
37:         input$matrixFile$name
39:         input$matrixVar
Director:inst/www/js/d3.v3.js: [ ]
6188:     chord.matrix = function(x) {
223:   d3.transpose = function(matrix) {
224:     if (!(n = matrix.length)) return [];
225:     for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) {
227:         row[j] = matrix[j][i];
5952:       return new d3_transform(t ? t.matrix : d3_transformIdentity);
6116:     var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
6125:           x += matrix[i][j];
6139:             return sortSubgroups(matrix[i][a], matrix[i][b]);
6148:           var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
6189:       if (!arguments.length) return matrix;
6190:       n = (matrix = x) && matrix.length;
1187:       point = point.matrixTransform(container.getScreenCTM().inverse());
interactiveDisplay:inst/www/js/d3.v2.js: [ ]
5000:     var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5001:     chord.matrix = function(x) {
2751:   d3.transpose = function(matrix) {
2752:     return d3.zip.apply(d3, matrix);
3138:       return new d3_transform(t ? t.matrix : d3_transformIdentity);
4937:           x += matrix[i][j];
4951:             return sortSubgroups(matrix[i][a], matrix[i][b]);
4960:           var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
5002:       if (!arguments.length) return matrix;
5003:       n = (matrix = x) && matrix.length;
651:       point = point.matrixTransform(container.getScreenCTM().inverse());
MotifDb:inst/scripts/import/uniprobe/import.R: [ ]
231:       matrix = matrices [[m]]
73:   matrix.start.lines = grep ('A\\s*[:\\|]', text)
79:   pwm.matrix = parsePWMfromText (lines)
148:     matrix.start.lines = grep ('A:', text)
153:     pwm.matrix = parsePWMfromText (lines.of.text)
157:     matrix.name <- paste(name.tokens[(token.count-1):token.count], collapse="/")
195:     matrix.name = names (matrices) [m]
33: createMatrixNameUniqifier = function (matrix)
36:   write (as.character (matrix), file=temporary.file)
52:   result = matrix (nrow=4, ncol=column.count, byrow=TRUE, dimnames=list (c ('A', 'C', 'G', 'T'), 1:column.count))
74:   stopifnot (length (matrix.start.lines) == 1)
75:   #printf ('%50s: %s', filename, list.to.string (matrix.start.lines))
76:   start.line = matrix.start.lines [1]
80:   return (pwm.matrix)
149:     stopifnot (length (matrix.start.lines) == 1)
150:     start.line = matrix.start.lines [1]
158:     matrices [[matrix.name]] = pwm.matrix
184: # and update matrix names
196:     #printf ('%d: %s', m, matrix.name)
197:     native.name.raw = gsub ('All_PWMs/', '', matrix.name)
225:       # the organism-dataSource-geneIdentifier matrix name.
232:       uniqifier = createMatrixNameUniqifier (matrix)
42: } # createMatrixNameUniqifier
CellaRepertorium:src/cdhit-common.h: [ ]
183: 		int matrix[MAX_AA][MAX_AA];
173: typedef Vector<VectorInt> MatrixInt;
176: typedef Vector<VectorInt64> MatrixInt64;
179: class ScoreMatrix { //Matrix
197: typedef Vector<VectorIntX> MatrixIntX;
189: 		void set_matrix(int *mat1);
186: 		ScoreMatrix();
193: }; // END class ScoreMatrix
476: 	MatrixInt64  score_mat;
477: 	MatrixInt    back_mat;
531: extern ScoreMatrix  mat;
606: int local_band_align( char query[], char ref[], int qlen, int rlen, ScoreMatrix &mat,
TRONCO:R/visualization.R: [ ]
2377:     matrix = matrix(0, nrow = length(keys) + 3, ncol = 1)
407:     pheat.matrix = data.lifting(x,data)
1223: draw_matrix <- function(matrix,
98:     ##  This function sorts a matrix to enhance mutual exclusivity
198:             stop('"group.samples" should be matrix with sample names and group assignment.')
364:     data.lifting <- function(obj, matrix) {
375:                                        function(obj, matrix) {
377:                                            ## Are you sure (obj %in% # matrix)
380:                                            if (obj %in% matrix) {
385:                                        rownames(matrix)))]
386:                 sub.data = matrix[keys.subset, , drop = FALSE]
394:                 matrix[keys.subset, ] = sub.data 
404:         return(list(data=matrix, colors=map.gradient))
408:     map.gradient = pheat.matrix$colors
409:     data = pheat.matrix$data
785:     data = matrix(0, nrow = ngenes(x), ncol = ntypes(x))
882:         tmp = as.matrix(subdata[which(refcol == i), ]);
1060:         t = c(as.vector(as.matrix(annotation_col)), colnames(annotation_col)) 
1083:             c(as.vector(as.matrix(annotation_row)),
1161:         stop("Gaps do not match with matrix size")
1182:     dist = matrix(0, nrow = 2 * n - 1, ncol = 2, dimnames = list(NULL, c("x", "y"))) 
1230:         n = nrow(matrix)
1231:         m = ncol(matrix)
1248:                      gp = gpar(fill = matrix, col = border_color))
1383:     return(as.matrix(new))
1550: heatmap_motor <- function(matrix,
1585:            nrow = nrow(matrix),
1586:            ncol = ncol(matrix),
1634:         ## gt = heatmap_motor(matrix, cellwidth = cellwidth,
1650:             heatmap_motor(matrix,
1711:     ## Draw matrix.
1713:     elem = draw_matrix(matrix, border_color, gaps_row, gaps_col, fmat, fontsize_number, number_color)
1714:     res = gtable_add_grob(res, elem, t = 4, l = 3, clip = "off", name = "matrix")
1810:         mat = as.matrix(mat)
1811:         return(matrix(scale_vec_colours(as.vector(mat),
1972: #' @param mat numeric matrix of the values to be plotted.
1994: #' of the above it is assumed that a distance matrix is provided.
2032: #' the cells. If this is a matrix (with same dimensions as original matrix), the contents
2033: #' of the matrix are shown instead of original values.
2067: #' # Create test matrix
2068: #' test = matrix(rnorm(200), 20, 10)
2144:     ## Preprocess matrix.
2146:     mat = as.matrix(mat)
2172:     if (is.matrix(display_numbers) | is.data.frame(display_numbers)) {
2174:             stop("If display_numbers provided as matrix, its dimensions have to match with mat")
2177:         display_numbers = as.matrix(display_numbers)
2178:         fmat = matrix(as.character(display_numbers), nrow = nrow(display_numbers), ncol = ncol(display_numbers))
2182:             fmat = matrix(sprintf(number_format, mat), nrow = nrow(mat), ncol = ncol(mat))
2185:             fmat = matrix(NA, nrow = nrow(mat), ncol = ncol(mat))
2259:     ## Select only the ones present in the matrix.
2378:     rownames(matrix) = c(keys, 'soft', 'co-occurrence', 'other')
2379:     ## colnames(matrix) = paste(to, collapse = ':')
2380:     colnames(matrix) = to[1]
2420:     matrix['co-occurrence', ] = length(co.occurrences)
2421:     cat('Co-occurrence in #samples: ', matrix['co-occurrence', ], '\n')
2426:         matrix[keys[i], ] = length(intersect(to.samples, hard.pattern.samples[[keys[i]]])) 
2427:     cat('Hard exclusivity in #samples:', matrix[keys, ], '\n')  
2433:     matrix['other', ] = length(intersect(to.samples, union))
2434:     cat('Other observations in #samples:', matrix['other', ], '\n') 
2438:     matrix['soft', ] = length(to.samples) - colSums(matrix)
2439:     cat('Soft exclusivity in #samples:', matrix['soft', ], '\n')  
2443:     sector.color = rep('gray', nrow(matrix) + 1) 
2444:     link.color = rep('gray', nrow(matrix)) 
2446:     names(sector.color) = c(rownames(matrix), colnames(matrix))
2447:     names(link.color) = rownames(matrix)
2465:     idx.max = which(matrix == max(matrix))
2466:     link.style = matrix(0, nrow=nrow(matrix), ncol=ncol(matrix))
2467:     rownames(link.style) = rownames(matrix)
2468:     colnames(link.style) = colnames(matrix)
2482:     sector.color[colnames(matrix)] = as.colors(x)[as.events(x, genes = to[1], types=to[2])[, 'type' ]]
2489:         ## rownames(matrix)[i] = paste(paste(rep(' ', i), collapse = ''), events.names[i, 'event' ])
2491:             rownames(matrix)[i] = paste(paste(rep(' ', i), collapse = ''), events.names[i, 'event' ])
2492:         else rownames(matrix)[i] = events.names[i, 'event' ]
2494:         names(sector.color)[i] = rownames(matrix)[i]    
2499:         cat('Circlize matrix.\n')
2500:         print(matrix)
2508:         chordDiagram(matrix, 
2536:         layout(matrix(c(1,2,3,3), ncol = 2, byrow = TRUE), heights = c(4, 1))
2551:         print(matrix)
2553:         ## barplot(matrix[, 1], widths, space = 0)
2555:         rownames(matrix)[length(keys) + 1] = '2 or more\n(soft-exclusivity)'
2556:         rownames(matrix)[length(keys) + 2] = 'all together\n(co-occurrence)'
2558:         rownames(matrix)[nrow(matrix)] = 'none of the\nevents'
2560:         summary = matrix[ (length(keys) + 1):nrow(matrix), 1, drop = FALSE]
2561:         summary = rbind( sum(matrix[1:length(keys),]), summary)
2586:         exclus = matrix[1:length(keys), 1, drop = FALSE]
2617:                    c(paste(sum(matrix[1:length(keys) ,]), 'with 1 event (hard exclusivity)'),
2618:                      paste(matrix[length(keys) + 1, ],  'with 2 or more events'),
2619:                      paste(matrix[length(keys) + 2, ], 'with all events (co-occurrence)'),
2620:                      paste(matrix[length(keys) + 3, ], 'with no events')
pcxn:R/pcxn_analyze.R: [ ]
84:                 matrix <- pathCor_pathprint_v1.2.3_dframe
89:                 matrix <- pathCor_pathprint_v1.2.3_unadjusted_dframe 
98:                 matrix <- pathCor_Hv5.1_dframe
102:                 matrix <- pathCor_Hv5.1_unadjusted_dframe 
111:                 matrix <- pathCor_CPv5.1_dframe
115:                 matrix <- pathCor_CPv5.1_unadjusted_dframe 
123:                 matrix <- pathCor_GOBPv5.1_dframe
127:                 matrix <- pathCor_GOBPv5.1_unadjusted_dframe 
173:         step1_matrix <-
174:             subset(matrix, abs(PathCor) >= min_abs_corr & p.value <= max_pval)
178:             temp_cor <- subset(step1_matrix,(Pathway.A == unused_genesets[i]
199:         # create matrix with geneset groups
210:         step2_matrix <-
211:             subset(step1_matrix, Pathway.A %in% interesting_genesets &
217:                         top, " top correlated genesets, ", dim(step2_matrix)[1],
224:                         top, " top correlated genesets, ", dim(step2_matrix)[1],
227:         po = new("pcxn",type = "pcxn_analyze", data = as.matrix(step2_matrix),
BioNERO:R/gcn_inference.R: [ ]
428:     hm <- WGCNA::labeledHeatmap(Matrix = modtraitcor,
991:                 matrix <- list_mat[[x]]
131:     cor_matrix <- calculate_cor_adj(cor_method, norm.exp, SFTpower, net_type)$cor
132:     adj_matrix <- calculate_cor_adj(cor_method, norm.exp, SFTpower, net_type)$adj
957:     cor_matrix <- net$correlation_matrix
407:     textMatrix <- paste(signif(modtraitcor, 2), modtraitsymbol, sep = "")
94: #'   \item Adjacency matrix
99: #'   \item Correlation matrix
130:     if(verbose) { message("Calculating adjacency matrix...") }
134:     #Convert to matrix
135:     gene_ids <- rownames(adj_matrix)
136:     adj_matrix <- matrix(adj_matrix, nrow=nrow(adj_matrix))
137:     rownames(adj_matrix) <- gene_ids
138:     colnames(adj_matrix) <- gene_ids
140:     #Calculate TOM from adjacency matrix
141:     if(verbose) { message("Calculating topological overlap matrix (TOM)...") }
143:     TOM <- WGCNA::TOMsimilarity(adj_matrix, TOMType = tomtype)
207:     kwithin <- WGCNA::intramodularConnectivity(adj_matrix, new.module_colors)
209:     result.list <- list(adjacency_matrix = adj_matrix,
214:                         correlation_matrix = cor_matrix,
295:     expr <- as.matrix(t(norm.exp))
312:     # Define a matrix of labels for the original and all resampling runs
313:     labels <- matrix(0, nGenes, nRuns + 1)
359: #' @param cex.text Font size for numbers inside matrix. Default: 0.6.
395:     modtraitcor <- cor(as.matrix(MEs), trait, use = "p", method=cor_method)
463: #'   \item{filtered_corandp}{Filtered matrix of correlation and p-values}
464: #'   \item{raw_GS}{Raw matrix of gene significances}
493:     GS <- cor(as.matrix(t(final_exp)), trait, use = "p")
514:     p <- ComplexHeatmap::pheatmap(as.matrix(GS), border_color = NA,
610:         fmat <- matrix(c(GinSet, RinSet, GninSet, RninSet), nrow = 2,
865:     edges <- net$correlation_matrix
888: #' Get edge list from an adjacency matrix for a group of genes
910: #' the correlation matrix was calculated. Only required
919: #' edge lists by filtering the original correlation matrix by the thresholds
956:     # Define objects containing correlation matrix and data frame of genes and modules
963:         cor_matrix <- cor_matrix[keep, keep]
968:         cor_matrix <- cor_matrix[genes, genes]
971:     # Should we filter the matrix?
973:         # Create edge list from correlation matrix
974:         edges <- cormat_to_edgelist(cor_matrix)
987:             list_mat <- replicate(length(cutoff), cor_matrix, simplify = FALSE)
992:                 matrix[matrix < cutoff[x] ] <- NA
993:                 diag(matrix) <- 0
996:                 degree <- rowSums(matrix, na.rm=TRUE)
999:                 matrix[lower.tri(matrix, diag=TRUE)] <- NA
1001:                 # Convert symmetrical matrix to edge list (Gene1, Gene2, Weight)
1002:                 matrix <- na.omit(data.frame(as.table(matrix), stringsAsFactors=FALSE))
1003:                 result <- list(matrix=matrix, degree=degree)
1027:                 stop("Please, specify the number of samples used to calculate the correlation matrix")
1048:         # Create edge list from correlation matrix without filtering
1049:         edgelist <- cormat_to_edgelist(cor_matrix)
408:     dim(textMatrix) <- dim(modtraitcor)
412:         textMatrix <- t(textMatrix)
433:                                 textMatrix = textMatrix, setStdMargins = FALSE,
HiCBricks:R/Brick_functions.R: [ ]
2168:     Matrix <- Brick_get_matrix(Brick = Brick, chr1 = chr1, chr2 = chr2,
2255:     Matrix <- Brick_get_vector_values(Brick = Brick, chr1=chr1, chr2=chr2,
554:     Matrix_info <- return_configuration_matrix_info(Brick)
776:     Matrix.list.df <- do.call(rbind,chr1.list)
1322: Brick_load_matrix = function(Brick = NA, chr1 = NA, chr2 = NA, resolution = NA,
1613:     Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, 
1657:     Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
1713:     Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
1803:     Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
1898:     Matrix.list <- Brick_list_matrices(Brick = Brick, chr1 = chr1, chr2 = chr2,
2228: Brick_get_matrix = function(Brick, chr1, chr2, x_coords,
2574: Brick_get_entire_matrix = function(Brick, chr1, chr2, resolution){
2592:     entire_matrix <- dataset_handle[]
2848:     a_matrix <- .remove_nas(Brick_get_entire_matrix(Brick = Brick, 
2850:     normalised_matrix <- .normalize_by_distance_values(a_matrix)
2851:     correlation_matrix <- cor(normalised_matrix)
206:     Configuration_matrix_list <- list()
1419: Brick_load_cis_matrix_till_distance = function(Brick = NA, chr = NA, 
1607: Brick_matrix_isdone = function(Brick, chr1, chr2, resolution = NA){
1651: Brick_matrix_issparse = function(Brick, chr1, chr2, resolution = NA){
1703: Brick_matrix_maxdist = function(Brick, chr1, chr2, resolution = NA){
1758: Brick_matrix_exists = function(Brick, chr1, chr2, resolution = NA){
1797: Brick_matrix_minmax = function(Brick, chr1, chr2, resolution = NA){
1843: Brick_matrix_dimensions = function(Brick, chr1, chr2, resolution = NA){
1892: Brick_matrix_filename = function(Brick, chr1, chr2, resolution = NA){
2124: Brick_get_matrix_within_coords = function(Brick, x_coords,
2647: Brick_get_matrix_mcols = function(Brick, chr1, chr2, resolution, 
2706: Brick_list_matrix_mcols = function(){
8: #' table associated to the Hi-C experiment, creates a 2D matrix
21: #' contains 250 entries in the binning table, the _cis_ Hi-C data matrix for
24: #' matrices for chr1,chr2 will be a matrix with dimension 250 rows and
60: #' set to matrix dimensions/100.
95: #'                \item Min - min value of Hi-C matrix
96: #'                \item Max - max value of Hi-C matrix
97: #'                \item sparsity - specifies if this is a sparse matrix
99: #'                \item Done - specifies if a matrix has been loaded
101: #'            \item matrix - \strong{dataset} - contains the matrix
235:         Configuration_matrix_list <- return_configuration_matrix_info(
267:             Configuration_matrix_list[[paste(chrom1, chrom2, 
281:         Configuration_matrix_list, 
527: #' for that chromosome in a Hi-C matrix.
555:     current_resolution <- vapply(Matrix_info, function(a_list){
561:     chrom1_binned_length <- vapply(Matrix_info[current_resolution], 
565:     chrom1s <- vapply(Matrix_info[current_resolution], 
569:     chrom1_max_sizes <- vapply(Matrix_info[current_resolution], 
720: #' List the matrix pairs present in the Brick store.
727: #' @inheritParams Brick_load_matrix
733: #' minimum and maximum values in the matrix, done is a logical value
734: #' specifying if a matrix has been loaded and sparsity specifies if a matrix
735: #' is defined as a sparse matrix.
777:     rownames(Matrix.list.df) <- NULL
778:     return(Matrix.list.df)
1263: #' Load a NxM dimensional matrix into the Brick store.
1269: #' the rows of the matrix
1273: #' the columns of the matrix
1275: #' @param matrix_file \strong{Required}.
1277: #' matrix into the Brick store.
1280: #' The delimiter of the matrix file.
1283: #' If a matrix was loaded before, it will not be replaced. Use remove_prior to
1284: #' override and replace the existing matrix.
1290: #' If true, designates the matrix as being a sparse matrix, and computes the
1306: #' out_dir <- file.path(tempdir(), "matrix_load_test")
1314: #' Matrix_file <- system.file(file.path("extdata", 
1318: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1319: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1323:     matrix_file = NA, delim = " ", remove_prior = FALSE, num_rows = 2000, 
1328:         resolution = resolution, matrix_file = matrix_file, 
1348:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2,
1352:     if(Brick_matrix_isdone(Brick = Brick, chr1 = chr1,
1354:         stop("A matrix was preloaded before. ",
1367:         Matrix.file = matrix_file, delim = delim, Group.path = Group.path, 
1375: #' Load a NxN dimensional sub-distance \emph{cis} matrix into
1380: #' @inheritParams Brick_load_matrix
1384: #' the rows and cols of the matrix
1388: #' it does not make sense to load the entire matrix into the data structure, as
1389: #' after a certain distance, the matrix will become extremely sparse. This
1403: #' out_dir <- file.path(tempdir(), "matrix_load_dist_test")
1411: #' Matrix_file <- system.file(file.path("extdata", 
1415: #' Brick_load_cis_matrix_till_distance(Brick = My_BrickContainer, 
1416: #' chr = "chr2L", resolution = 100000, matrix_file = Matrix_file, 
1420:     resolution = NA, matrix_file, delim = " ", distance, remove_prior = FALSE,
1425:         matrix_file = matrix_file, delim = delim, distance = distance, 
1443:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr,
1447:     if(Brick_matrix_isdone(Brick = Brick, chr1 = chr,
1449:         stop("A matrix was preloaded before. Use remove_prior = TRUE to ",
1461:     RetVar <- ._Process_matrix_by_distance(Brick = Brick_filepath,
1462:         Matrix.file = matrix_file, delim = delim, Group.path = Group.path,
1470: #' Load a NxN dimensional matrix into the Brick store from an mcool file.
1472: #' Read an mcool contact matrix coming out of 4D nucleome projects into a
1477: #' @inheritParams Brick_load_matrix
1489: #' @param matrix_chunk \strong{Optional}. Default 2000.
1490: #' The nxn matrix square to fill per iteration in a mcool file.
1493: #' cooler_read_limit sets the upper limit for the number of records per matrix
1495: #' matrix_chunk value will be re-evaluated dynamically.
1521: #' resolution = 50000, matrix_chunk = 2000, remove_prior = TRUE,
1527: #' @seealso \code{\link{Create_many_Bricks_from_mcool}} to create matrix from 
1533:     matrix_chunk = 2000, cooler_read_limit = 10000000, remove_prior = FALSE,
1569:         resolution = resolution, matrix_chunk = matrix_chunk, 
1575: #' Check if a matrix has been loaded for a chromosome pair.
1579: #' @inheritParams Brick_load_matrix
1581: #' @return Returns a logical vector of length 1, specifying if a matrix has
1588: #' out_dir <- file.path(tempdir(), "matrix_isdone_test")
1596: #' Matrix_file <- system.file(file.path("extdata", 
1600: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1601: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1604: #' Brick_matrix_isdone(Brick = My_BrickContainer, chr1 = "chr2L", 
1609:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2,
1615:     return(Matrix.list[Matrix.list$chr1 == chr1 &
1616:         Matrix.list$chr2 == chr2, "done"])
1619: #' Check if a matrix for a chromosome pair is sparse.
1623: #' @inheritParams Brick_load_matrix
1625: #' @return Returns a logical vector of length 1, specifying if a matrix was
1626: #' loaded as a sparse matrix.
1632: #' out_dir <- file.path(tempdir(), "matrix_issparse_test")
1640: #' Matrix_file <- system.file(file.path("extdata", 
1644: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1645: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1648: #' Brick_matrix_issparse(Brick = My_BrickContainer, chr1 = "chr2L", 
1653:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2,
1659:     return(Matrix.list[Matrix.list$chr1 == chr1 &
1660:         Matrix.list$chr2 == chr2, "sparsity"])
1664: #' Get the maximum loaded distance from the diagonal of any matrix.
1666: #' If values beyond a certain distance were not loaded in the matrix, this
1670: #' `Brick_matrix_maxdist` will return this parameter.
1674: #' @inheritParams Brick_load_matrix
1677: #' distance loaded for that matrix
1684: #' out_dir <- file.path(tempdir(), "matrix_maxdist_test")
1692: #' Matrix_file <- system.file(file.path("extdata", 
1696: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1697: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1700: #' Brick_matrix_maxdist(Brick = My_BrickContainer, chr1 = "chr2L", 
1705:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2,
1709:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2, 
1715:     return((Matrix.list[Matrix.list$chr1 == chr1 &
1716:         Matrix.list$chr2 == chr2, "distance"]))
1722: #' are provided. If a user is in doubt regarding whether a matrix is present or
1729: #' @inheritParams Brick_load_matrix
1731: #' @return Returns a logical vector of length 1, specifying if the matrix
1739: #' out_dir <- file.path(tempdir(), "matrix_exists_test")
1747: #' Matrix_file <- system.file(file.path("extdata", 
1751: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1752: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1755: #' Brick_matrix_exists(Brick = My_BrickContainer, chr1 = "chr2L", 
1765: #' Return the value range of the matrix
1769: #' @inheritParams Brick_load_matrix
1772: #' maximum finite real values in the matrix.
1778: #' out_dir <- file.path(tempdir(), "matrix_minmax_test")
1786: #' Matrix_file <- system.file(file.path("extdata", 
1790: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1791: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1794: #' Brick_matrix_minmax(Brick = My_BrickContainer, chr1 = "chr2L", 
1799:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2, 
1805:     Filter <- Matrix.list$chr1 == chr1 & Matrix.list$chr2 == chr2
1806:     Extent <- c(Matrix.list[Filter, "min"],Matrix.list[Filter, "max"])
1810: #' Return the dimensions of a matrix
1814: #' @inheritParams Brick_load_matrix
1816: #' @return Returns the dimensions of a Hi-C matrix for any given
1824: #' out_dir <- file.path(tempdir(), "matrix_dimension_test")
1832: #' Matrix_file <- system.file(file.path("extdata", 
1836: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1837: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1840: #' Brick_matrix_dimensions(Brick = My_BrickContainer, chr1 = "chr2L", 
1844:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2, 
1853:         dataset.path = Reference.object$hdf.matrix.name,
1859: #' Return the filename of the loaded matrix
1863: #' @inheritParams Brick_load_matrix
1866: #' the currently loaded matrix.
1873: #' out_dir <- file.path(tempdir(), "matrix_filename_test")
1881: #' Matrix_file <- system.file(file.path("extdata", 
1885: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1886: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1889: #' Brick_matrix_filename(Brick = My_BrickContainer, chr1 = "chr2L", 
1894:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2, 
1900:     Filter <- Matrix.list$chr1 == chr1 & Matrix.list$chr2 == chr2
1901:     Extent <- Matrix.list[Filter, "filename"]
1914: #' A string specifying the chromosome for the cis Hi-C matrix from which values
1947: #' Matrix_file <- system.file(file.path("extdata", 
1951: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
1952: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
1966: #' @seealso \code{\link{Brick_get_matrix_within_coords}} to get matrix by
1967: #' using matrix coordinates, \code{\link{Brick_fetch_row_vector}} to get values
1969: #' to get values using matrix coordinates, \code{\link{Brick_get_matrix}} to
1970: #' get matrix by using matrix coordinates.
1979:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr, 
1981:         !Brick_matrix_isdone(Brick = Brick, chr1 = chr, 
1993:     Max.dist <- Brick_matrix_maxdist(Brick = Brick, chr1 = chr, chr2 = chr,
1997:             "this matrix was at a distance of "
2041:             Name = Reference.object$hdf.matrix.name,
2055: #' Return a matrix subset between two regions.
2057: #' `Brick_get_matrix_within_coords` will fetch a matrix subset after
2060: #' This function calls \code{\link{Brick_get_matrix}}.
2075: #' If true, will force the retrieval operation when matrix contains loaded
2080: #' the matrix is returned.
2082: #' @return Returns a matrix of dimension x_coords binned length by y_coords
2090: #' out_dir <- file.path(tempdir(), "get_matrix_coords_test")
2098: #' Matrix_file <- system.file(file.path("extdata", 
2102: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2103: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2106: #' Brick_get_matrix_within_coords(Brick = My_BrickContainer,
2111: #' Brick_get_matrix_within_coords(Brick = My_BrickContainer,
2118: #' @seealso \code{\link{Brick_get_matrix}} to get matrix by using matrix
2122: #' \code{\link{Brick_get_vector_values}} to get values using matrix
2152:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2,
2154:         stop(chr1," ",chr2," matrix is yet to be loaded into the class.")
2171:     return(Matrix)
2174: #' Return a matrix subset.
2176: #' `Brick_get_matrix` will fetch a matrix subset between row values
2182: #' @inheritParams Brick_load_matrix
2191: #' If provided a data transformation with FUN will be applied before the matrix
2194: #' @inheritParams Brick_get_matrix_within_coords
2196: #' @return Returns a matrix of dimension x_coords length by y_coords length.
2203: #' out_dir <- file.path(tempdir(), "get_matrix_test")
2211: #' Matrix_file <- system.file(file.path("extdata", 
2215: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2216: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2219: #' Brick_get_matrix(Brick = My_BrickContainer, chr1 = "chr2L", chr2 = "chr2L",
2222: #' @seealso \code{\link{Brick_get_matrix_within_coords}} to get matrix by using
2223: #' matrix genomic coordinates, \code{\link{Brick_get_values_by_distance}} to
2227: #' matrix coordinates.
2243:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2, 
2245:         stop(chr1,chr2," matrix is yet to be loaded into the class.\n")
2258:         return(Matrix)             
2260:         return(FUN(Matrix))
2266: #' `Brick_fetch_row_vector` will fetch any given rows from a matrix. If
2273: #' @inheritParams Brick_load_matrix
2293: #' @inheritParams Brick_get_matrix_within_coords
2300: #' If provided a data transformation with FUN will be applied before the matrix
2320: #' Matrix_file <- system.file(file.path("extdata", 
2324: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2325: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2334: #' @seealso \code{\link{Brick_get_matrix_within_coords}} to get matrix by
2335: #' using matrix genomic coordinates, \code{\link{Brick_get_values_by_distance}}
2338: #' subset them, \code{\link{Brick_get_matrix}} to get matrix by using
2339: #' matrix coordinates.
2354:     max.dist <- Brick_matrix_maxdist(Brick = Brick, chr1 = chr1, chr2 = chr2, 
2359:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2,
2361:         stop(chr1,chr2," matrix is yet to be loaded.")
2437: #' other matrix retrieval functions.
2441: #' @inheritParams Brick_load_matrix
2457: #' @inheritParams Brick_get_matrix_within_coords
2460: #' returns a matrix of dimension xaxis length by yaxis length.
2477: #' Matrix_file <- system.file(file.path("extdata", 
2481: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2482: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2503:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2,
2505:         stop(chr1,chr2," matrix is yet to be loaded.")
2513:     Max.dist <- Brick_matrix_maxdist(Brick = Brick, chr1 = chr1, chr2 = chr2, 
2518:             "this matrix was at a distance of ",
2527:         Brick = Brick_filepath, Name = Reference.object$hdf.matrix.name, 
2536: #' Return an entire matrix for provided chromosome pair for a resolution.
2538: #' `Brick_get_entire_matrix` will return the entire matrix for the entire 
2544: #' @inheritParams Brick_load_matrix
2546: #' @return Returns an object of class matrix with dimensions corresponding to
2563: #' Matrix_file <- system.file(file.path("extdata", 
2567: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2568: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2571: #' Entire_matrix <- Brick_get_entire_matrix(Brick = My_BrickContainer, 
2581:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2,
2583:         stop(chr1,chr2," matrix is yet to be loaded.")
2590:         Brick = Brick_filepath, Name = Reference_object$hdf.matrix.name, 
2594:     return(entire_matrix)
2597: #' Get the matrix metadata columns in the Brick store.
2599: #' `Brick_get_matrix_mcols` will get the specified matrix metadata column for
2600: #' a chr1 vs chr2 Hi-C data matrix. Here, chr1 represents the rows and chr2
2601: #' represents the columns of the matrix. For cis Hi-C matrices, where 
2615: #' @inheritParams Brick_load_matrix
2618: #' A character vector of length 1 specifying the matrix metric to retrieve
2620: #' @return Returns a 1xN dimensional vector containing the specified matrix
2628: #' out_dir <- file.path(tempdir(), "get_matrix_mcols_test")
2636: #' Matrix_file <- system.file(file.path("extdata", 
2640: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2641: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2644: #' Brick_get_matrix_mcols(Brick = My_BrickContainer, chr1 = "chr2L", 
2652:     Meta.cols <- Reference.object$hdf.matrix.meta.cols()
2657:     if(!Brick_matrix_exists(Brick = Brick, chr1 = chr1, chr2 = chr2, 
2659:         stop("Matrix for this chromsome pair does not exist.\n")  
2661:     if(!Brick_matrix_isdone(Brick = Brick, chr1 = chr1, chr2 = chr2,
2663:         stop("Matrix for this chromsome pair is yet to be loaded.\n")  
2668:     if(!Brick_matrix_issparse(Brick = Brick, chr1 = chr1, chr2 = chr2,
2670:         stop("This matrix is not a sparse matrix.",
2685: #' List the matrix metadata columns in the Brick store.
2687: #' `Brick_get_matrix_mcols` will list the names of all matrix metadata 
2690: #' @return Returns a vector containing the names of all matrix metadata columns
2697: #' out_dir <- file.path(tempdir(), "list_matrix_mcols_test")
2705: #' Brick_list_matrix_mcols()
2708:     Meta.cols <- Reference.object$hdf.matrix.meta.cols()
2714: #' upper triangle sparse matrix
2719: #' objects as a upper triangle sparse matrix (col > row) containing 
2746: #' Matrix_file <- system.file(file.path("extdata", 
2750: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2751: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2833: #' Matrix_file <- system.file(file.path("extdata", 
2837: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2838: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2852:     correlation_matrix <- .remove_nas(correlation_matrix)
2856:     pca_list <- prcomp(correlation_matrix)
2868: #' @inheritParams Brick_load_matrix
2873: #' sparse matrix
2875: #' @param matrix_chunk \strong{Optional}. Default 2000.
2876: #' The nxn matrix square to fill per iteration.
2900: #' Matrix_file <- system.file(file.path("extdata", 
2904: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr2L", 
2905: #' chr2 = "chr2L", matrix_file = Matrix_file, delim = " ", 
2918:     resolution = NULL, batch_size = 1000000, matrix_chunk = 2000,
2930:         delim = delim, resolution = resolution, matrix_chunk = matrix_chunk, 
173:     Reference.object <- GenomicMatrix$new()
330:     Reference.object <- GenomicMatrix$new()
426:     Reference.object <- GenomicMatrix$new()
468:     Reference.object <- GenomicMatrix$new()
549:     Reference.object <- GenomicMatrix$new()
617:     Reference.object <- GenomicMatrix$new()
691:     Reference.object <- GenomicMatrix$new()
756:     Reference.object <- GenomicMatrix$new()
810:     Reference.object <- GenomicMatrix$new()
892:     Reference.object <- GenomicMatrix$new()
953:     Reference.object <- GenomicMatrix$new()
1086:     Reference.object <- GenomicMatrix$new()
1325:     Reference.object <- GenomicMatrix$new()
1366:     RetVar <- ._ProcessMatrix_(Brick = Brick_filepath, 
1423:     Reference.object <- GenomicMatrix$new()
1535:     Reference.object <- GenomicMatrix$new()
1608:     Reference.object <- GenomicMatrix$new()
1652:     Reference.object <- GenomicMatrix$new()
1704:     Reference.object <- GenomicMatrix$new()
1798:     Reference.object <- GenomicMatrix$new()
1848:     Reference.object <- GenomicMatrix$new()
1893:     Reference.object <- GenomicMatrix$new()
1977:     Reference.object <- GenomicMatrix$new()
2494:     Reference.object <- GenomicMatrix$new()
2575:     Reference_object <- GenomicMatrix$new()
2651:     Reference.object <- GenomicMatrix$new()
2707:     Reference.object <- GenomicMatrix$new()
2760:     Reference.object <- GenomicMatrix$new()
2920:     Reference.object <- GenomicMatrix$new()
BADER:src/meth.h: [ ]
6: } Matrix;
2: typedef struct MatrixStructure {
20:     Matrix kA;
21:     Matrix kB;
24:     Matrix lambdaA;
26:     Matrix lambdaB;
44: double columnMean ( Matrix &A, int column )
95: void mult ( Vector &a, Matrix &X, Vector &b )
chromPlot:R/chromplot-Internal.R: [ ]
898:     matrix <- t(sapply(data, unlist)) #list to matrix
325:                     plot.lodclust(as.matrix(track[,c("Start", "End")]),
396:     intervals <- as.matrix(intervals)
445:     intmat  <- matrix(intmat, ncol=2)
517:     if(is.data.frame(x) | is.matrix(x)) {
899:     aux    <-matrix[, c(2:5)]
LymphoSeq:R/differentialAbundance.R: [ ]
66:         matrix <- matrix(c(in.x, in.y, not.x, not.y), nrow = 2)
67:         fisher <- stats::fisher.test(matrix, workspace = 2e6)
scde:R/functions.R: [ ]
6015:             matrix <- gcl$vmap[rev(gcl$row.order), results$hvc$order, drop = FALSE]
6083:                        matrix <- results$rcm[rev(results$tvc$order), results$hvc$order]
6324:                        matrix <- results$rcm[rev(results$tvc$order), results$hvc$order]
1079: winsorize.matrix <- function(mat, trim) {
3405: calculate.joint.posterior.matrix <- function(lmatl, n.samples = 100, bootstrap = TRUE, n.cores = 15) {
3422: calculate.batch.joint.posterior.matrix <- function(lmatll, composition, n.samples = 100, n.cores = 15) {
3810: get.exp.posterior.matrix <- function(m1, counts, marginals, grid.weight = rep(1, nrow(marginals)), rescale = TRUE, n.cores =...(17 bytes skipped)...
3826: get.exp.logposterior.matrix <- function(m1, counts, marginals, grid.weight = rep(1, nrow(marginals)), rescale = TRUE, n.cores =...(6 bytes skipped)...
109: ##' Filter counts matrix
111: ##' Filter counts matrix based on gene and cell requirements
113: ##' @param counts read count matrix. The rows correspond to genes, columns correspond to individual cells
118: ##' @return a filtered read count matrix
145: ##' @param counts read count matrix. The rows correspond to genes (should be named), columns correspond to individual cells. The matrix should contain integer counts
163: ##' @return a model matrix, with rows corresponding to different cells, and columns representing different parameters of the d...(16 bytes skipped)...
184: ...(114 bytes skipped)...thod is designed to work on read counts - do not pass normalized read counts (e.g. FPKM values). If matrix contains read counts, but they are stored as numeric values, use counts<-apply(counts,2,function(x)...(49 bytes skipped)...
208: ##' @param counts count matrix
228:     fpkm <- log10(exp(as.matrix(fpkm))+1)
229:     wts <- as.numeric(as.matrix(1-fail[, colnames(fpkm)]))
262: ##' @param counts read count matrix
264: ...(41 bytes skipped)...e two groups of cells being compared. The factor entries should correspond to the rows of the model matrix. The factor should have two levels. NAs are allowed (cells will be omitted from comparison).
265: ##' @param batch a factor (corresponding to rows of the model matrix) specifying batch assignment of each cell, to perform batch correction
284: ##' \code{difference.posterior} returns a matrix of estimated expression difference posteriors (rows - genes, columns correspond to different magnit...(64 bytes skipped)...
305:         stop("ERROR: provided count data does not cover all of the cells specified in the model matrix")
309:     counts <- as.matrix(counts[, ci])
416: ##' @param models model matrix
417: ##' @param counts count matrix
513: ##' @param counts read count matrix
516: ##' @param batch a factor describing which batch group each cell (i.e. each row of \code{models} matrix) belongs to
523: ##' @return \subsection{default}{ a posterior probability matrix, with rows corresponding to genes, and columns to expression levels (as defined by \code{prior$x})
525: ...(24 bytes skipped)...ndividual.posterior.modes}{ a list is returned, with the \code{$jp} slot giving the joint posterior matrix, as described above. The \code{$modes} slot gives a matrix of individual expression posterior mode values on log scale (rows - genes, columns -cells)}
526: ...(85 bytes skipped)...st} slot giving a list of individual posterior matrices, in a form analogous to the joint posterior matrix, but reported on log scale }
538: ...(43 bytes skipped)...counts))) { stop("ERROR: provided count data does not cover all of the cells specified in the model matrix") }
545:     counts <- as.matrix(counts[, ci, drop = FALSE])
571:     # prepare matrix models
574:     mm <- matrix(NA, nrow(models), length(mn))
575:     mm[, which(!is.na(mc))] <- as.matrix(models[, mc[!is.na(mc)], drop = FALSE])
645: # models - entire model matrix, or a subset of cells (i.e. select rows) of the model matrix for which the estimates should be obtained
647: # return - a matrix of log(FPM) estimates with genes as rows and cells  as columns (in the model matrix order).
653: ##' @param counts count matrix
655: ##' @return a matrix of expression magnitudes on a log scale (rows - genes, columns - cells)
666: ...(43 bytes skipped)...counts))) { stop("ERROR: provided count data does not cover all of the cells specified in the model matrix") }
672: # magnitudes can either be a per-cell matrix or a single vector of values which will be evaluated for each cell
676: ##' Returns estimated drop-out probability for each cell (row of \code{models} matrix), given either an expression magnitude
678: ##' @param magnitudes a vector (\code{length(counts) == nrows(models)}) or a matrix (columns correspond to cells) of expression magnitudes, given on a log scale
679: ##' @param counts a vector (\code{length(counts) == nrows(models)}) or a matrix (columns correspond to cells) of read counts from which the expression magnitude should be estimate...(1 bytes skipped)...
681: ##' @return a vector or a matrix of drop-out probabilities
704:     if(is.matrix(magnitudes)) { # a different vector for every cell
705: ...(55 bytes skipped)...es))) { stop("ERROR: provided magnitude data does not cover all of the cells specified in the model matrix") }
730: ##' @param counts read count matrix (must contain the row corresponding to the specified gene)
732: ##' @param groups a two-level factor specifying between which cells (rows of the models matrix) the comparison should be made
733: ##' @param batch optional multi-level factor assigning the cells (rows of the model matrix) to different batches that should be controlled for (e.g. two or more biological replicates). The e...(224 bytes skipped)...
759:     counts <- as.matrix(counts[gene, ci, drop = FALSE])
819:         layout(matrix(c(1:3), 3, 1, byrow = TRUE), heights = c(2, 1, 2), widths = c(1), FALSE)
926: ##' @param counts count matrix
927: ...(8 bytes skipped)...am reference a vector of expression magnitudes (read counts) corresponding to the rows of the count matrix
936: ##' @return matrix of scde models
988:         #l <- layout(matrix(seq(1, 4*length(ids)), nrow = length(ids), byrow = TRUE), rep(c(1, 1, 1, 0.5), length(ids)), rep(1,...(23 bytes skipped)...
989:         l <- layout(matrix(seq(1, 4), nrow = 1, byrow = TRUE), rep(c(1, 1, 1, 0.5), 1), rep(1, 4), FALSE)
1000:         # make a joint model matrix
1011: ##' Determine principal components of a matrix using per-observation/per-variable weights
1015: ##' @param mat matrix of variables (columns) and observations (rows)
1026: ##' @return a list containing eigenvector matrix ($rotation), projections ($scores), variance (weighted) explained by each component ($var), total (...(45 bytes skipped)...
1030: ##' mat <- matrix( c(rnorm(5*10,mean=0,sd=1), rnorm(5*10,mean=5,sd=1)), 10, 10)  # random matrix
1032: ##' matw <- matrix( c(rnorm(5*10,mean=0,sd=1), rnorm(5*10,mean=5,sd=1)), 10, 10)  # random weight matrix
1040:       stop("bwpca: weight matrix contains NaN values")
1043:       stop("bwpca: value matrix contains NaN values")
1046:         matw <- matrix(1, nrow(mat), ncol(mat))
1061: ##' Winsorize matrix
1065: ##' @param mat matrix
1068: ##' @return Winsorized matrix
1072: ##' mat <- matrix( c(rnorm(5*10,mean=0,sd=1), rnorm(5*10,mean=5,sd=1)), 10, 10)  # random matrix
1075: ##' win.mat <- winsorize.matrix(mat, 0.1)
1100: ##' @param counts count matrix (integer matrix, rows- genes, columns- cells)
1133: ...(114 bytes skipped)...thod is designed to work on read counts - do not pass normalized read counts (e.g. FPKM values). If matrix contains read counts, but they are stored as numeric values, use counts<-apply(counts,2,function(x)...(49 bytes skipped)...
1162:         #celld <- WGCNA::cor(log10(matrix(as.numeric(as.matrix(ca)), nrow = nrow(ca), ncol = ncol(ca))+1), method = cor.method, use = "p", nThreads = n.cores)
1164:             celld <- WGCNA::cor(sqrt(matrix(as.numeric(as.matrix(ca[, ids])), nrow = nrow(ca), ncol = length(ids))), method = cor.method, use = "p", nThreads = n.co...(4 bytes skipped)...
1166:             celld <- stats::cor(sqrt(matrix(as.numeric(as.matrix(ca[, ids])), nrow = nrow(ca), ncol = length(ids))), method = cor.method, use = "p")
1174:         # TODO: correct for batch effect in cell-cell similarity matrix
1176:             # number batches 10^(seq(0, n)) compute matrix of id sums, NA the diagonal,
1178:             bm <- matrix(bid, byrow = TRUE, nrow = length(bid), ncol = length(bid))+bid
1181:             # use tapply to calculate means shifts per combination reconstruct shift vector, matrix, subtract
1239:                     l <- layout(matrix(seq(1, 4), nrow = 1, byrow = TRUE), rep(c(1, 1, 1, ifelse(local.theta.fit, 1, 0.5)), 1), rep(1, 4),...(7 bytes skipped)...
1263:     # make a joint model matrix
1278: ##' @param models model matrix (select a subset of rows to normalize variance within a subset of cells)
1279: ##' @param counts read count matrix
1288: ##' @param weight.k k value to use in the final weight matrix
1294: ##' @param gene.length optional vector of gene lengths (corresponding to the rows of counts matrix)
1307: ##' \item{matw} { weight matrix corresponding to the expression matrix}
1334:         stop(paste("supplied count matrix (cd) is missing data for the following cells:[", paste(rownames(models)[!rownames(models) %in% coln...(44 bytes skipped)...
1343:         if(verbose) { cat("Winsorizing count matrix ... ") }
1345:         #tfpm <- log(winsorize.matrix(exp(fpm), trim = trim))
1346:         tfpm <- winsorize.matrix(fpm, trim)
1430:     if(verbose) { cat("calculating weight matrix ... ") }
1450:     # calculate batch-specific version of the weight matrix if needed
1695:     # use milder weight matrix
1787: ##' (weighted) projection of the expression matrix onto a specified aspect (some pattern
1794: ##' @param center whether the matrix should be re-centered following pattern subtraction
1796: ##' @return a modified varinfo object with adjusted expression matrix (varinfo$mat)
1850: ##' @param center whether the expression matrix should be recentered
1989: ##' Determine de-novo gene clusters, their weighted PCA lambda1 values, and random matrix expectation.
1995: ##' @param n.samples number of randomly generated matrix samples to test the background distribution of lambda1 on
2004: ...(10 bytes skipped)... secondary.correlation whether clustering should be performed on the correlation of the correlation matrix instead
2014: ##' \item{varm} {standardized lambda1 values for each randomly generated matrix cluster}
2036:         mat <- winsorize.matrix(mat, trim = trim)
2060:                 gd <- as.dist(1-WGCNA::cor(as.matrix(gd), method = "p", nThreads = n.cores))
2062:                 gd <- as.dist(1-cor(as.matrix(gd), method = "p"))
2103:                 # generate random normal matrix
2105:                 m <- matrix(rnorm(nrow(mat)*n.cells), nrow = nrow(mat), ncol = n.cells)
2113:                     m <- winsorize.matrix(m, trim = trim)
2124:                         gd <- as.dist(1-WGCNA::cor(as.matrix(gd), method = "p", nThreads = 1))
2126:                         gd <- as.dist(1-cor(as.matrix(gd), method = "p"))
2230: ##' \item{xv} {a matrix of normalized aspect patterns (rows- significant aspects, columns- cells}
2231: ##' \item{xvw} { corresponding weight matrix }
2505: ##' @param distance distance matrix
2569:     if(trim > 0) { xvl$d <- winsorize.matrix(xvl$d, trim) } # trim prior to determining the top sets
2593: ...(35 bytes skipped)...f whether to return just the hclust result or a list containing the hclust result plus the distance matrix and gene values
2690: ##' @param mat Numeric matrix
2694: ##' @param row.cols  Matrix of row colors.
2695: ##' @param col.cols  Matrix of column colors. Useful for visualizing cell annotations such as batch labels.
2730: ##' @param col.cols  Matrix of column colors. Useful for visualizing cell annotations such as batch labels. Default NULL.
2840:         layout(matrix(c(1:3), 3, 1, byrow = TRUE), heights = c(2, 1, 2), widths = c(1), FALSE)
2953:                 m1@concomitant@x <- matrix()
2955:                     mod@x <- matrix()
2956:                     mod@y <- matrix()
3083: # vil - optional binary matrix (corresponding to counts) with 0s marking likely drop-out observations
3118:     f <- calcNormFactors(as.matrix(counts[gis, !is.na(groups)]), ...)
3127:     fpkm <- log10(exp(as.matrix(fpkm))+1)
3128:     wts <- as.numeric(as.matrix(1-fail[, colnames(fpkm)]))
3218:         # pair cell name matrix
3267:             m1@concomitant@x <- matrix()
3269:                 mod@x <- matrix()
3270:                 mod@y <- matrix()
3327:             #l <- layout(matrix(seq(1, 4*length(ids)), nrow = length(ids), byrow = TRUE), rep(c(1, 1, 1, 0.5), length(ids)), rep(1,...(23 bytes skipped)...
3328:             l <- layout(matrix(seq(1, 4), nrow = 1, byrow = TRUE), rep(c(1, 1, 1, ifelse(linear.fit, 1, 0.5)), 1), rep(1, 4), FALS...(2 bytes skipped)...
3344:         # make a joint model matrix
3386:             df <- get.exp.logposterior.matrix(group.ifm[[nam]], dat[, nam], marginals, n.cores = inner.cores, grid.weight = prior$grid.weight)
3403: # calculate joint posterior matrix for a given group of experiments
3420: # lmatll - list of posterior matrix lists (as obtained from calculate.posterior.matrices)
3467: # calculate a joint posterior matrix with bootstrap
3589:     #matrix(cbind(ifelse(rdf$count<= zero.count.threshold, 0.95, 0.05), ifelse(rdf$count > zero.count.threshold...(15 bytes skipped)...
3604:         l <- layout(matrix(c(1:4), 1, 4, byrow = TRUE), c(1, 1, 1, 0.5), rep(1, 4), FALSE)
3654:     fdf <- data.frame(y = rowMeans(matrix(log10(rdf$fpm[1:(n.zero.windows*bw)]+1), ncol = bw, byrow = TRUE)), zf = rowMeans(matrix(as.integer(rdf$cluster[1:(n.zero.windows*bw)] == 1), ncol = bw, byrow = TRUE)))
3663:         cm0 <- exp(model.matrix(mt, data = mf) %*% m1@concomitant@coef)
3716: # df: count matrix
3717: # xr: expression level for each row in the matrix
3740: # counts - observed count matrix corresponding to the models
3780:     cm0 <- exp(model.matrix(mt, data = mf) %*% m1@concomitant@coef)
3797:     cm0 <- model.matrix(mt, data = mf) %*% m1@concomitant@coef
3805: # returns a matrix of posterior values, with rows corresponding to genes, and
3812:     #message(paste("get.exp.posterior.matrix() :", round((1-length(uc)/length(counts))*100, 3), "% savings"))
3828:     #message(paste("get.exp.logposterior.matrix() :", round((1-length(uc)/length(counts))*100, 3), "% savings"))
3841: # similar to get.exp.posterior.matrix(), but returns inverse ecdf list
3848: # similar to get.exp.posterior.matrix(), but returns inverse ecdf list
3871:     cm0 <- exp(model.matrix(mt, data = mf) %*% m1@concomitant@coef)
4138:         m <- matrix(sapply(components, function(x) x@logLik(model@x, model@y)), nrow = nrow(model@y))
4141:         m <- matrix(do.call(cbind, lapply(seq_along(components), function(i) {
4175:         m <- matrix(sapply(components, function(x) x@logLik(model@x, model@y)), nrow = nrow(model@y))
4178:         m <- matrix(do.call(cbind, lapply(seq_along(components), function(i) {
4223:         m <- matrix(sapply(components, function(x) x@logLik(model@x, model@y)), nrow = nrow(model@y))
4226:         m <- matrix(do.call(cbind, lapply(seq_along(components), function(i) {
4488:     x <- as.matrix(x)
4490:     ynames <- if (is.matrix(y))
4611:                 stop(gettextf("X matrix has rank %d, but only %d observations",
4711:         fit$qr <- as.matrix(fit$qr)
4718:         Rmat <- as.matrix(Rmat)
4856:     if (!is.matrix(x)) {
5008: # weight matrix should have the same dimensions as the data matrix
5154:         stop("'x' must be a numeric matrix")
5259:         if(is.matrix(ColSideColors)) {
5261:                 stop("'ColSideColors' matrix must have the same number of columns as length ncol(x)")
5306:         if(is.matrix(ColSideColors)) {
5307:             image(t(matrix(1:length(ColSideColors), byrow = TRUE, nrow = nrow(ColSideColors), ncol = ncol(ColSideColors))), co...(70 bytes skipped)...
5572:         mat <- winsorize.matrix(mat, trim = trim)
5583:     dd <- as.dist(1-abs(cor(t(as.matrix(d)))))
5599:         vd <- as.dist(1-cor(as.matrix(d)))
5669: ##' @param colcols optional column color matrix
5678: ##' @param box whether to draw a box around the plotted matrix
5680: ##' @param return.details whether the function should return the matrix as well as full PCA info instead of just PC1 vector
5726:         mat <- winsorize.matrix(mat, trim = trim)
5766:             mat <- winsorize.matrix(mat, trim = trim)
5791:     dd <- as.dist(1-abs(cor(t(as.matrix(d)))))
5807:         vd <- as.dist(1-cor(as.matrix(d)))
5973: ##' @field mat Matrix of posterior mode count estimates
5974: ##' @field matw Matrix of weights associated with each estimate in \code{mat}
6016:             matrix <- list(data = as.numeric(t(matrix)),
6017:                            dim = dim(matrix),
6018:                            rows = rownames(matrix),
6019:                            cols = colnames(matrix),
6024:             ol <- list(matrix = matrix)
6026:                 rcmvar <- matrix(gcl$rotation[rev(gcl$row.order), , drop = FALSE], ncol = 1)
6033:                 colcols <- matrix(gcl$oc[results$hvc$order], nrow = 1)
6084:                        matrix <- list(data = as.numeric(t(matrix)),
6085:                                       dim = dim(matrix),
6086:                                       rows = rownames(matrix),
6087:                                       cols = colnames(matrix),
6090:                                       range = range(matrix)
6095:                        rcmvar <- matrix(apply(results$rcm[rev(results$tvc$order), , drop = FALSE], 1, var), ncol = 1)
6105:                        ol <- list(matrix = matrix, rowcols = rowcols, colcols = colcols, coldend = treeg, trim = trim)
6159:                        patc <- .Call("matCorr", as.matrix(t(mat)), as.matrix(pat, ncol = 1) , PACKAGE = "scde")
6325:                        body <- paste(capture.output(write.table(round(matrix, 1), sep = "\t")), collapse = "\n")
1081:     wm <- .Call("winsorizeMatrix", mat, trim, PACKAGE = "scde")
1755:         ##   # construct mat multiplier submatrix
3723:         x <- FLXgetModelmatrix(m1@model[[1]], edf, m1@model[[1]]@formula)
3724:         #cx <- FLXgetModelmatrix(m1@concomitant, edf, m1@concomitant@formula)
shinyMethyl:R/server.R: [ ]
97:             matrix <- apply(quantiles, 2, function(x){
101:             matrix.x <- matrix[1:512,]
102:             matrix.y <- matrix[513:(2*512),]
223:                 density.matrix <- returnDensityMatrix()
224:                 x.matrix <- density.matrix[[1]]
225:                 y.matrix <- density.matrix[[2]]
87: 	returnDensityMatrix <- reactive({
107: 	returnDensityMatrixNorm <- reactive({
103:             return(list(matrix.x = matrix.x, matrix.y = matrix.y))
121:             matrix <- apply(quantiles, 2, function(x){
125:             matrix.x <- matrix[1:512,]
126:             matrix.y <- matrix[513:(2*512),]
127:             return(list(matrix.x = matrix.x, matrix.y = matrix.y))	
226:                 x.matrix <- ((x.matrix - mouse.x)/range.x)^2
227:                 y.matrix <- ((y.matrix - mouse.y)/range.y)^2
228:                 clickedIndex <- arrayInd(which.min(x.matrix+y.matrix),
229:                                          c(512,ncol(x.matrix)))[2]
266:                 density.matrix <- returnDensityMatrixNorm()
267:                 x.matrix <- density.matrix[[1]]
268:                 y.matrix <- density.matrix[[2]]
269:                 x.matrix <- ((x.matrix - mouse.x)/range.x)^2
270:                 y.matrix <- ((y.matrix - mouse.y)/range.y)^2
271:                 clickedIndex <- arrayInd(which.min(x.matrix+y.matrix),
272:                                          c(512,ncol(x.matrix)))[2]
359:             densitiesPlot(matrix.x = returnDensityMatrix()[[1]],
360:                           matrix.y = returnDensityMatrix()[[2]],
372:                                 matrix.x = returnDensityMatrix()[[1]],
373:                                 matrix.y = returnDensityMatrix()[[2]],
426: 		densitiesPlot(matrix.x = returnDensityMatrixNorm()[[1]],
427:                               matrix.y = returnDensityMatrixNorm()[[2]],
439:                                     matrix.x = returnDensityMatrixNorm()[[1]],
440:                                     matrix.y = returnDensityMatrixNorm()[[2]],
616:             matrix <- apply(betaQuantiles[[index]], 2, function(x){
620:             matrix.x <- matrix[1:512,]
621:             matrix.y <- matrix[513:(2*512),]
629:             densitiesPlot(matrix.x = matrix.x,
630:                           matrix.y = matrix.y,
epihet:R/epiNetwork.R: [ ]
180:         h <- WGCNA::labeledHeatmap(Matrix = moduleTraitCor,
51:     group.matrix <- compare.matrix[, group.samples]
53:     value.matrix <- group.matrix[DEH.loci, ]
58:     hit.matrix <- as.matrix(o)
60:         input.matrix = value.matrix
68:             mean.matrix <- foreach(i = geneid, .combine = cbind) %do%
173:         textMatrix <- paste(signif(moduleTraitCor, 2),
11: #' @param compare.matrix The comparison matrix generated from
17: #' for the samples in the comparison matrix. The row names should
35: #' heterogeneity matrix for patients
38: #' if node type is gene,it contains the epigenetic heterogeneity matrix for
41: epiNetwork <- function(node.type = "locus", DEH, compare.matrix,
49:     compare.matrix <- compare.matrix[which(compare.matrix$type == value), ]
50:     rownames(compare.matrix) <- compare.matrix$location
54:     value.matrix <- t(value.matrix)
61:         nSamples = nrow(value.matrix)
71:                   queryhit.id <- hit.matrix[which(hit.matrix[, 2] == i), 1]
73:                   epivalue <- value.matrix[, queryhit.loci$loci]
82:             mean.matrix <- mean.matrix[, colSums(mean.matrix) != 0]
83:             nSamples <- dim(mean.matrix)[1]
84:             input.matrix <- mean.matrix
90:     sft <- WGCNA::pickSoftThreshold(input.matrix, powerVector = powers,
131:     net <- WGCNA::blockwiseModules(input.matrix, power = softpowers,
157:         module <- data.frame(gene = colnames(input.matrix),
161:     MEs0 <- WGCNA::moduleEigengenes(input.matrix, moduleColors)$eigengenes
194:         geneset <- data.frame(DEHloci = mcols(userset[hit.matrix[,1]])$loci,
195:             gene = mcols(annotation.obj[hit.matrix[,2]])$name,
262:         result <- list(epimatrix = input.matrix, module = module,
265:         result <- list(epimatrix = input.matrix, module = module)
12: #' the compMatrix() function.
175:         dim(textMatrix) <- dim(moduleTraitCor)
183:             colors = WGCNA::blueWhiteRed(50), textMatrix = textMatrix,
TRONCO:R/as.functions.R: [ ]
900:     matrix = NULL
1013:     as.adj.matrix(x,
1289:     as.adj.matrix(x,
646: as.adj.matrix <- function(x,
916:     matrix.to.df <- function(m) {    
1035:     matrix.to.df <- function(z) {   
1213:     matrix.to.df <- function(z) {   
1217:         prederr.matrix = x$kfold[[z]]$prederr
1297:     matrix.to.df <- function(z) {  
1303:         posterr.matrix = get(z, x$kfold)$posterr
1967:     adj.matrix = get(model, as.adj.matrix(x, models = model))
21: #' @return A TRONCO genotypes matrix.
87: #' @return A matrix with 2 columns (event type, gene name) for the events found.
121: #' @return A matrix with 1 column annotating stages and rownames as sample IDs.
143: #' @return A matrix with 1 column annotating stages and rownames as sample IDs.
180: #' @return A matrix, subset of \code{as.genotypes(x)} with colnames substituted  with events' types.
627: #' Extract the adjacency matrix of a TRONCO model. The matrix is indexed with colnames/rownames which 
629: #' specify a subset of events to build the matrix, a subset of models if multiple reconstruction have
630: #' been performed. Also, either the prima facie matrix or the post-regularization matrix can be extracted.
634: #' as.adj.matrix(test_model)
635: #' as.adj.matrix(test_model, events=as.events(test_model)[5:15,])
636: #' as.adj.matrix(test_model, events=as.events(test_model)[5:15,], type='pf')
638: #' @title as.adj.matrix
642: #' @param type Either the prima facie ('pf') or the post-regularization ('fit') matrix, 'fit' by default.
643: #' @return The adjacency matrix of a TRONCO model. 
644: #' @export as.adj.matrix
667:             mat = m[[i]]$adj.matrix$adj.matrix.fit
669:             mat = m[[i]]$adj.matrix$adj.matrix.pf
683: #' Extract the marginal probabilities from a TRONCO model. The return matrix is indexed with rownames which 
685: #' specify a subset of events to build the matrix, a subset of models if multiple reconstruction have
709:         stop('Events should have colnames to access the adjacency matrix - use \'as.events\' function?')
734: #' Extract the joint probabilities from a TRONCO model. The return matrix is indexed with rownames/colnames which 
736: #' specify a subset of events to build the matrix, a subset of models if multiple reconstruction have
761:         stop('Events should have colnames to access the adjacency matrix - use \'as.events\' function?')
787: #' Extract the conditional probabilities from a TRONCO model. The return matrix is indexed with rownames which 
789: #' specify a subset of events to build the matrix, a subset of models if multiple reconstruction have
814:         stop('Events should have colnames to access the adjacency matrix - use \'as.events\' function?')
903:         matrix$pf = x$adj.matrix.prima.facie   
905:         matrix =
906:             as.adj.matrix(x,
911:     matrix = lapply(matrix, keysToNames, x = x)
981:     return(lapply(matrix, matrix.to.df))
1012:     matrix = 
1019:     matrix = lapply(matrix, keysToNames, x = x)
1036:         m = matrix[[z]]
1117:     res = lapply(seq_along(matrix), matrix.to.df)
1118:     names(res) = names(matrix)
1219:             names(prederr.matrix) = lapply(names(prederr.matrix), function(k) { nameToKey(x, k) })
1220:             return(prederr.matrix)
1225:         df$prederr = t(as.data.frame(prederr.matrix)) # values
1248:     res = lapply(seq_along(models), matrix.to.df)
1288:     matrix = 
1295:     matrix = lapply(matrix, keysToNames, x = x)
1302:         m = matrix[[z]]
1306:             rownames(posterr.matrix) = lapply(rownames(posterr.matrix), function(k) { nameToKey(x, k) })
1307:             colnames(posterr.matrix) = lapply(colnames(posterr.matrix), function(k) { nameToKey(x, k) })
1308:             return(posterr.matrix)
1312:         posterr.matrix = keysToNames(posterr.matrix, x = x)
1333:                     val = posterr.matrix[[select,selected]]
1369:     res = lapply(models, matrix.to.df)
1370:     names(res) = names(matrix)
1802: #' Convert colnames/rownames of a matrix into intelligible event names, e.g., change a key G23 in 'Mutation KRAS'.
1807: #' adj_matrix = as.adj.matrix(test_model, events=as.events(test_model)[5:15,])$capri_bic
1808: #' keysToNames(test_model, adj_matrix)
1813: #' @param matrix A matrix with colnames/rownames which represent genotypes keys. 
1814: #' @return The matrix with intelligible colnames/rownames. 
1817: keysToNames <- function(x, matrix) {
1819:     if (!is.matrix(matrix)
1820:         || any(is.null(colnames(matrix)))
1821:         || any(is.null(rownames(matrix))))
1822:         stop('"matrix" should be a matrix with rownames/colnames.')
1830:     colnames(matrix) = sapply(colnames(matrix), resolve)
1831:     rownames(matrix) = sapply(rownames(matrix), resolve)
1832:     return(matrix)
1840: #' adj_matrix = as.adj.matrix(test_model, events=as.events(test_model)[5:15,])$bic
1961:     genotypes = as.matrix(genotypes)
1968:     adj.matrix = keysToNames(x, adj.matrix)
1975:     for (from in rownames(adj.matrix)) {
1976:         for (to in colnames(adj.matrix)) {
1977:             if (adj.matrix[from, to] == 1) {
ISAnalytics:R/plotting-functions.R: [ ]
717:         matrix <- wide %>%
1820:             as_matrix <- as.matrix(x, rownames = "int_id")
1826:             as_matrix <- as.matrix(x, rownames = "int_id")
13: #' Users can supply as `x` either a simple integration matrix or a
20: #' @param x Either a simple integration matrix or a data frame resulting
700:         ## --- Obtain data matrix and annotations
719:             as.matrix()
720:         rownames(matrix) <- wide[[gene_sym_col]]
801:         map <- rlang::exec(pheatmap::pheatmap, mat = matrix, !!!params_to_pass)
1821:             eul <- eulerr::euler(as_matrix)
1827:             eul <- eulerr::venn(as_matrix)
1856: #' @param data Either a single integration matrix or a list of integration
1864: #' integration matrix is provided as `data` should be of the same length.
celda:R/plot_dr.R: [ ]
103:             matrix <- SummarizedExperiment::assay(x, i = useAssay)
834:   matrix <- factorized$proportions$cell
4: #' @param x Numeric matrix or a \linkS4class{SingleCellExperiment} object
5: #'  with the matrix located in the assay slot under \code{useAssay}. Each
6: #'  row of the matrix will be plotted as a separate facet.
118:               matrix = matrix,
165:             x <- as.matrix(x)
169:               matrix = x,
190:                                matrix,
204:     data.frame(dim1, dim2, t(as.data.frame(matrix)), check.names = FALSE)
290: #'  expression matrix where x and y axis are from a data dimension
293: #' @param x Numeric matrix or a \linkS4class{SingleCellExperiment} object
294: #'  with the matrix located in the assay slot under \code{useAssay}. Rows
329: #'   matrix. Default TRUE.
518:             x <- as.matrix(x)
594:   counts <- as.matrix(counts[featuresIx, , drop = FALSE])
616:     matrix = counts,
636: #'  gene expression matrix where x and y axis are from a data
639: #' @param x Numeric matrix or a \linkS4class{SingleCellExperiment} object
640: #'  with the matrix located in the assay slot under \code{useAssay}. Rows
660: #'  \code{x} is a matrix object.
669: #'  Whether rows of the matrix should be rescaled to [0, 1]. Default TRUE.
837:     for (x in seq(nrow(matrix))) {
838:       matrix[x, ] <- matrix[x, ] - min(matrix[x, ])
839:       matrix[x, ] <- matrix[x, ] / max(matrix[x, ])
846:   rownames(matrix) <- gsub("L", "", rownames(matrix))
848:     if (length(rownames(matrix)[rownames(matrix) %in% modules]) < 1) {
851:     matrix <-
852:       matrix[which(rownames(matrix) %in% modules), , drop = FALSE]
853:     matrix <-
854:       matrix[match(rownames(matrix), modules), , drop = FALSE]
857:   rownames(matrix) <- paste0("L", rownames(matrix))
860:     data.frame(dim1, dim2, t(as.data.frame(matrix)), check.names = FALSE)
905: #'  gene expression matrix where x and y axis are from a
1150: #' @param x Numeric matrix or a \linkS4class{SingleCellExperiment} object
1151: #'  with the matrix located in the assay slot under \code{useAssay}. Rows
1164: #'  \code{x} is a matrix object.
1167: #'   matrix. Default \code{TRUE}.
1252:             x <- as.matrix(x)
1283:   dataFeature <- as.matrix(counts[featuresIx, , drop = FALSE])
1348:     if (inherits(x, c("matrix", "Matrix"))) {
742:             factorized <- factorizeMatrix(x,
793:             factorized <- factorizeMatrix(x = x, celdaMod = celdaMod)
RGMQL:R/Utils.R: [ ]
82:         matrix <- matrix(new_value)
80:     aggregate_matrix <- t(vapply(meta_data, function(x) {
86:     metadata_matrix <- cbind(m_names,aggregate_matrix)
92:     cond_matrix <- NULL
85:     m_names <- matrix(names)
95:         cond_matrix <- rbind(cond_matrix, def)
99:         cond_matrix <- rbind(cond_matrix, exact)
103:         cond_matrix <- rbind(cond_matrix, full)
104:     cond_matrix
MotifDb:misc/hocomoco-v11/importV11.R: [ ]
106:     matrix <- matrices[[matrix.id]]
75:   matrix.names <- sapply(pwm.list, function (element) element$title)
101:   matrix.ids <- names(matrices)
103:   for (matrix.id in matrix.ids) {
302:   rawMatrixList <- readRawMatrices("./", dataDir)
44:   for (i in 1:max){ # loop through all motifs in the matrix file, one motif at a time
63:    mtx <- pwm.1$matrix
71: # rather than a sublist of title and matrix, each element is simply a matrix, with the element named
74:   matrices <- sapply(pwm.list, function (element) element$matrix)
76:   matrix.names <- sub("^> ", "", matrix.names)
77:   names(matrices) <- matrix.names
104:     tokens <- strsplit(matrix.id, ".", fixed=TRUE)[[1]]
107:     geneSymbol <- sub("_HUMAN.*$", "", matrix.id)
108:     tbl.sub <- subset(tbl.raw, Model==matrix.id)
116:     new.row <- list (providerName=matrix.id,
117:                      providerId=matrix.id, #"HOCOMOCO v8 and ChiPMunk 3.1"
125:                      sequenceCount=max(colSums(matrix)),
131:     #printf("matrix.id: %s", matrix.id);
134:     full.name <- sprintf ('%s-%s-%s', organism, dataSource, matrix.id)
136:     } # for matrix.id
151:      # make sure the reliability score (A-D) is searchably found in the matrix rowname
162: # we now have metadata rownames, one per matrix, each of which has all (or at least at lot) of information
163: # used in querying.  For instance, the hocomoco give name for the first matrix is
209:      # after normalization, each matrix column should total to 1.0
210:      # so sum(matrix) should be equals to the number of columns
232:   result <- matrix (nrow=4, ncol=cols,
247:   #return (list (title=title, consensus.sequence=consensus.sequence, matrix=result))
248:   return (list (title=title, matrix=result))
303:   length(rawMatrixList)
304:   matrices <- extractMatrices (rawMatrixList)
ISAnalytics:R/analysis-functions.R: [ ]
728:         matrix <- matrix(
22: #' @param x An integration matrix - aka a data frame that includes
23: #' the `mandatory_IS_vars()` as columns. The matrix can either be aggregated
309: #' @param x An integration matrix (data frame containing
458: #' @param x An integration matrix - must be annotated
741:         ft <- stats::fisher.test(matrix)
1005: #' @param x An integration matrix, must include the `mandatory_IS_vars()`
1273: #' @param x A simple integration matrix or an aggregated matrix (see details)
1326: #' Expands integration matrix with the cumulative IS union over time.
1330: #' Given an input integration matrix that can be grouped over time,
1335: #' @param x An integration matrix, ideally aggregated via
1350: #' * Checks if the matrix is annotated by assessing presence of
HiCBricks:R/cooler_loader_v2.R: [ ]
567:                 Matrix <- matrix(data = 0, nrow = Dim[1], ncol = Dim[2])
101:     matrix_keys <- Reference_object$mcool.matrix.keys(version = mcool_version)
102:     matrix_group_path <- .create_matrix_group_path(resolution = resolution,
309:     matrix_mcols_keys <- Reference_object$hdf.matrix.meta.cols()
552:                 Matrix_dimensions <- Brick_matrix_dimensions(Brick = Brick,
600:                 matrix_extent <- .add_metrics(Brick_filepath = Brick_filepath,
1: .create_matrix_group_path <- function(has_resolution = FALSE, 
4:     Keys <- Reference_object$mcool.matrix.keys(version = mcool_version)
104:     Bin1_id <- .fetch_data(file = mcool_path, group = matrix_group_path,
105:         name = matrix_keys[2], start = read_from, num_rows = read_to)
106:     Bin2_id <- .fetch_data(file = mcool_path, group = matrix_group_path,
107:         name = matrix_keys[3], start = read_from, num_rows = read_to)
108:     Counts <- .fetch_data(file = mcool_path, group = matrix_group_path,
109:         name = matrix_keys[4], start = read_from, num_rows = read_to)
113: .create_mcool_chr1_indexes <- function(chromosomes, ignore_chrs, matrix_chunk, 
117:         ignore_chrs = ignore_chrs, matrix_chunk = matrix_chunk)
157:     matrix_chunk){
165:         step = matrix_chunk)
191: .return_chr1_chr2_pairs <- function(Brick, chromosomes, matrix_chunk, 
195:         matrix_chunk = matrix_chunk, chr_offsets = chr_offsets, 
199:         matrix_chunk = matrix_chunk)
252:         name = Reference_object$hdf.matrix.rowSums, object = chr1_rows)
254:         name = Reference_object$hdf.matrix.colSums, object = chr2_rows)
256:         name = Reference_object$hdf.matrix.coverage, object = chr1_rows)
258:         name = Reference_object$hdf.matrix.coverage.t, object = chr2_rows)
280:                 name = Reference_object$hdf.matrix.coverage)
283:             name = Reference_object$hdf.matrix.coverage, 
288:                 name = Reference_object$hdf.matrix.coverage.t)
291:             name = Reference_object$hdf.matrix.coverage.t, 
306: .add_metrics <- function(Brick_filepath, group_path, a_matrix, 
310:     a_matrix[is.na(a_matrix) | is.nan(a_matrix) | is.infinite(a_matrix)] <- 0
311:     Row_sums <- rowSums(a_matrix)
312:     Col_sums <- colSums(a_matrix)
313:     chr1_bin_coverage_submat <- rowSums(a_matrix > 0)
314:     chr2_bin_coverage_submat <- colSums(a_matrix > 0)
317:         length.out = nrow(a_matrix))
319:         length.out = ncol(a_matrix))
322:         name = Reference_object$hdf.matrix.rowSums, start = chr1_start, 
326:         name = Reference_object$hdf.matrix.rowSums, object = chr1_row_sums,
330:         name = Reference_object$hdf.matrix.colSums, start = chr2_start, 
334:         name = Reference_object$hdf.matrix.colSums, object = chr2_col_sums,
338:         name = Reference_object$hdf.matrix.coverage, start = chr1_start, 
342:         name = Reference_object$hdf.matrix.coverage, 
347:         name = Reference_object$hdf.matrix.coverage.t, start = chr2_start, 
351:         name = Reference_object$hdf.matrix.coverage.t,
354:     return(range(a_matrix))
476:     has_resolution = FALSE, matrix_chunk = 2000, norm_factor = NULL,
506:         matrix_chunk = matrix_chunk, num_records_limit = cooler_read_limit, 
516:         Dimensions <- Brick_matrix_dimensions(Brick = Brick, 
579:                 Matrix[cbind(Bin1_id_mat_id, Bin2_id_mat_id)] <- Counts_submat
587:                         Matrix[cbind(Bin2_id_mat_id, Bin1_id_mat_id)] <- 
591:                         data = t(Matrix), Brick = Brick_filepath,
594:                         Name = Reference_object$hdf.matrix.name)
597:                     data = Matrix, Brick = Brick_filepath, Start = Start, 
598:                     Name = Reference_object$hdf.matrix.name, Stride = Stride, 
601:                     group_path = chr2_group_path, a_matrix = Matrix, 
602:                     dimensions = dim(Matrix), 
606:                     chr2 = chr2, min = matrix_extent[1], 
607:                     max = matrix_extent[2], nrow = Matrix_dimensions[1], 
608:                     ncol = Matrix_dimensions[2], 
609:                     distance = max(Matrix_dimensions),
3:     Reference_object <- GenomicMatrix$new()
18:     Reference_object <- GenomicMatrix$new()
34:     Reference_object <- GenomicMatrix$new()
67:     Reference_object <- GenomicMatrix$new()
100:     Reference_object <- GenomicMatrix$new()
246:     Reference_object <- GenomicMatrix$new()
262:     Reference_object <- GenomicMatrix$new()
308:     Reference_object <- GenomicMatrix$new()
374:     Reference_object <- GenomicMatrix$new()
419:     Reference_object <- GenomicMatrix$new()
458:     Reference_object <- GenomicMatrix$new()
479:     Reference_object <- GenomicMatrix$new()
EpiCompare:R/plot_chromHMM.R: [ ]
81:   matrix <- genomation::heatTargetAnnotation(annotation, plot = FALSE)
89:     matrix_melt <- reshape2::melt(matrix)
80:   # obtain matrix
82:   rownames(matrix) <- names(peaklist) # set row names
84:   label_corrected <- gsub('X', '', colnames(matrix))
85:   colnames(matrix) <- label_corrected # set corrected labels
88:     # convert matrix into molten data frame
90:     colnames(matrix_melt) <- c("Sample", "State", "value")
92:     chrHMM_plot <- ggplot2::ggplot(matrix_melt) +
104:     chrHMM_plot <- plotly::plot_ly(x = colnames(matrix),
105:                                    y = rownames(matrix),
106:                                    z = matrix,
ELMER:R/Small.R: [ ]
1001:   matrix <- Matrix::Matrix(0, nrow = nrow(motifs), ncol = ncol(motifs) - 21 ,sparse = TRUE)
426: makeSummarizedExperimentFromGeneMatrix <- function(exp, genome = genome){
572: splitmatrix <- function(x,by="row") {
998: getMatrix <- function(filename) {
6: #' a matrix or path of rda file only containing the data.
8: #' a matrix or path of rda file only containing the data. Rownames should be 
13: #'  of the gene expression and DNA methylation matrix. This should be used if your matrix
16: ...(14 bytes skipped)...A methylation" and "Gene expression"), primary (sample ID) and colname (names of the columns of the matrix).
111: #'    #1) Get gene expression matrix
299:         stop("Please the gene expression matrix should receive ENSEMBLE IDs")
363:         stop("Error DNA methylation matrix and gene expression matrix are not in the same order")
381: ...(63 bytes skipped)...ary (sample ID) and colname(DNA methylation and gene expression sample [same as the colnames of the matrix])")
400:         stop("Error DNA methylation matrix and gene expression matrix are not in the same order")
452:     stop("Please the gene expression matrix should receive ENSEMBLE IDs (ENSG)")
474:   assay <- data.matrix(met)
538: #' This function will receive the DNA methylation and gene expression matrix and will create
540: #' @param met DNA methylation matrix or Summarized Experiment
541: #' @param exp Gene expression matrix or Summarized Experiment
569: # @param x A matrix 
571: # @return A list each of which is the value of each row/column in the matrix.
789: #' @param data A MultiAssayExperiment with a DNA methylation martrix or a DNA methylation matrix
994: # This will read this homer file and create a sparce matrix
1002:   colnames(matrix) <- gsub(" Distance From Peak\\(sequence,strand,conservation\\)","",colnames(motifs)[-c(1:21)])
1003:   rownames(matrix) <- motifs$PeakID
1004:   matrix[!is.na(motifs[,-c(1:21)])] <- 1
1005:   matrix <- as(matrix, "nsparseMatrix")
1006:   return(matrix)
1015: #' foreground <- Matrix::Matrix(sample(0:1,size = 100,replace = TRUE), 
1019: #' background <- Matrix::Matrix(sample(0:1,size = 100,replace = TRUE), 
1033:   a <- Matrix::colSums(foreground)
1034:   b <- nrow(foreground) - Matrix::colSums(foreground)
1035:   c <- Matrix::colSums(background)
1036:   d <- nrow(background) - Matrix::colSums(background)
1038:     x <- fisher.test(matrix(c(a[i],b[i],c[i],d[i]),nrow = 2,ncol = 2))
1045:                         NumOfRegions = Matrix::colSums(foreground, na.rm=TRUE),
262:     exp <- makeSummarizedExperimentFromGeneMatrix(exp, genome)
1011: #' @param foreground A nsparseMatrix object in each 1 means the motif is found in a region, 0 not.
1012: #' @param background A nsparseMatrix object in each 1 means the motif is found in a region, 0 not.
interacCircos:inst/htmlwidgets/lib/d3.js: [ ]
5599:     chord.matrix = function(x) {
167:   d3.transpose = function(matrix) {
168:     return d3.zip.apply(d3, matrix);
5377:       return new d3_transform(t ? t.matrix : d3_transformIdentity);
5527:     var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5536:           x += matrix[i][j];
5550:             return sortSubgroups(matrix[i][a], matrix[i][b]);
5559:           var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
5600:       if (!arguments.length) return matrix;
5601:       n = (matrix = x) && matrix.length;
1108:       point = point.matrixTransform(container.getScreenCTM().inverse());
GeneTonic:R/gs_heatmap.R: [ ]
209:       matrix = mydata_sig,
484:   score_matrix <- mat
265:       matrix = mydata_sig,
301: #' @return A matrix with the geneset Z scores, e.g. to be plotted with [gs_scoresheat()]
362:   # returns a matrix, rows = genesets, cols = samples
369:   gss_mat <- matrix(NA, nrow = nrow(res_enrich), ncol = ncol(se))
391: #' Plots a matrix of geneset scores
393: #' Plots a matrix of geneset Z scores, across all samples
395: #' @param mat A matrix, e.g. returned by the [gs_scores()] function
487:     score_matrix <- score_matrix[row_tree$order, ]
491:     score_matrix <- score_matrix[, col_tree$order]
494:   labels_rows <- factor(rownames(score_matrix),
495:     levels = rev(rownames(score_matrix))
498:   labels_cols <- factor(colnames(score_matrix),
499:     levels = colnames(score_matrix)
506:   scores <- data.frame(as.vector(score_matrix))
365:   rowsd_se <- matrixStats::rowSds(mydata)
RGMQL:vignettes/RGMQL-vignette.R: [ ]
292: matrix <- filter_and_extract(data_in, metadata= NULL,
295: matrix
IRISFGM:R/CellTypePrediction.R: [ ]
76:         MATRIX <- rep(0, Covered) %o% rep(0, Covered)
48: #' @importFrom igraph as_adjacency_matrix
61:     A <- igraph::as_adjacency_matrix(G, type = "both", attr = "Weight", names = TRUE, sparse = FALSE)  # convert graph into adjacency matrix
87:             MATRIX <- MATRIX + TEMP
89:         MATRIX <- MATRIX/length(CAN_I)
90:         rownames(MATRIX) <- colnames(MATRIX) <- rownames(A)
91:         hc <- hclust(dist(MATRIX))
117: #' @importFrom igraph as_adjacency_matrix
124:     A <- igraph::as_adjacency_matrix(G, type = "both", attr = "Weight", names = TRUE, sparse = FALSE)  # convert graph into adjacency matrix
141: ## Raw is the path to the original expression matrix method should be either 'MCL' or 'SC', and if 'SC', user also need to specify K, the number of
BioNERO:R/consensus_modules.R: [ ]
448:     hm <- WGCNA::labeledHeatmap(Matrix = cons_cor,
424:     textMatrix <- paste(signif(cons_cor, 2), modtraitsymbol, sep = "")
193:     if(verbose) { message("Calculating adjacency matrix...") }
210:     if(verbose) { message("Calculating topological overlap matrix (TOM)...") }
332: #' @param cex.text Font size for numbers inside matrix. Default: 0.6.
396:     cons_cor <- matrix(NA, nrow(moduleTraitCor[[1]]), ncol(moduleTraitCor[[1]]))
397:     cons_pval <- matrix(NA, nrow(moduleTraitCor[[1]]), ncol(moduleTraitCor[[1]]))
425:     textMatrix[textMatrix == "NANA"] <- "-"
426:     dim(textMatrix) <- dim(moduleTraitCor[[set]])
429:         textMatrix <- t(textMatrix)
453:                                 textMatrix = textMatrix, setStdMargins = FALSE,
HiCBricks:R/backend_functions.R: [ ]
467:     Matrix <- NULL
600:         Matrix <- as.matrix(fread(file = Matrix.file, sep=delim, nrows=Iter, 
374:     Matrix.return <- rbind(Matrix.top,Matrix.bottom)
460:     Matrix.range <- c(NA,NA)
563:     Matrix.range <- c(NA,NA)
1: GenomicMatrix <- R6Class("GenomicMatrix",
388: ._Compute_various_matrix_metrics <- function(Matrix = NULL, 
422: ._Compute_various_col_matrix_metrics <- function(Matrix = NULL, 
446: ._Process_matrix_by_distance <- function(Brick = NULL, Matrix.file = NULL, 
548: ._ProcessMatrix_ <- function(Brick = NULL, Matrix.file = NULL, delim = NULL, 
10:         hdf.matrix.name = "matrix",
11:         hdf.matrix.coverage = "chr1_bin_coverage",
12:         hdf.matrix.coverage.t = "chr2_bin_coverage",
13:         hdf.matrix.rowSums = "chr1_row_sums",
14:         hdf.matrix.colSums = "chr2_col_sums",
15:         hdf.matrix.sparsity = "sparsity",
50:         hdf.matrix.meta.cols = function(){
51:             Temp <- c(self$hdf.matrix.coverage,
52:                 self$hdf.matrix.coverage.t,
53:                 self$hdf.matrix.rowSums,
54:                 self$hdf.matrix.colSums, 
55:                 self$hdf.matrix.sparsity)
120:         mcool.matrix.keys = function(version = NULL){
122:                 return(c("matrix","bin1_id","bin2_id","count"))
134:         Configurator_JSON_matrix_names = c("chrom1", 
150:         Matrix.range=NA,
357: ._Do_rbind_on_matrices_of_different_sizes_ <- function(Matrix.top = NULL, 
358:     Matrix.bottom = NULL, row.length = NULL, col.length = NULL, 
360:     if(is.null(Matrix.top)){
361:         return(Matrix.bottom)
365:         Matrix.top <- cbind(Matrix.top,matrix(NA, 
366:             nrow = nrow(Matrix.top), ncol = Makeup.col))
370:         Matrix.bottom <- cbind(matrix(NA, 
371:             nrow = nrow(Matrix.bottom), 
372:             ncol = Makeup.col),Matrix.bottom)   
375:     return(Matrix.return)
392:     Bin.coverage <- vapply(seq_len(nrow(Matrix)),function(x){
393:         Vec.sub <- Matrix[x,]
396:     Row.sums <- vapply(seq_len(nrow(Matrix)),function(x){
397:         Vec.sub <- Matrix[x,]
401:         Sparsity.Index <- vapply(seq_len(nrow(Matrix)),function(x){
402:             Vec.sub <- Matrix[x,]
411:     Row.extent <- ._Do_on_vector_ComputeMinMax_(Matrix)
424:     Matrix[is.na(Matrix) | is.infinite(Matrix)] <- 0
426:         metrics.list[["bin.coverage"]] + colSums(Matrix > 0)
428:     colSums(Matrix)
454:     Handler <- .create_file_connection(Filename = Matrix.file, mode = "r")
473:         if(is.null(Matrix)){
478:             Matrix <- matrix(data = 0, nrow = num.rows, 
485:         Matrix[Row.loc, Col.loc] <- Vector[Col.lower.limit:Col.upper.limit]
489:             Count <- c(nrow(Matrix),ncol(Matrix))
490:             Metrics.list <- ._Compute_various_matrix_metrics(Matrix = Matrix, 
492:                 sparsity.bins = sparsity.bins, range = Matrix.range, 
494:             Matrix.range <- Metrics.list[["extent"]]
503:                 Name = Reference.object$hdf.matrix.name,
504:                 data = Matrix, Start = Start, Stride = Stride, Count = Count)
507:             Object.size <- object.size(Matrix)
508:             Matrix <- NULL
518:         name = Reference.object$hdf.matrix.rowSums, 
522:         name = Reference.object$hdf.matrix.colSums, 
526:         name = Reference.object$hdf.matrix.coverage, 
530:         name = Reference.object$hdf.matrix.coverage.t, 
534:             name = Reference.object$hdf.matrix.sparsity, 
538:     Attr.vals <- c(basename(Matrix.file),as.double(Matrix.range),
605:         Metrics.list <- ._Compute_various_matrix_metrics(Matrix = Matrix, 
607:             range = Matrix.range, distance = distance, 
609:         Col.metrics.list <- ._Compute_various_col_matrix_metrics(
610:             Matrix = Matrix, 
612:         Matrix.range <- Metrics.list[["extent"]]
617:         Cumulative.data <- rbind(Cumulative.data,Matrix)
627:                 Name = Reference.object$hdf.matrix.name,
640:         name = Reference.object$hdf.matrix.rowSums, 
644:         name = Reference.object$hdf.matrix.colSums, 
648:         name = Reference.object$hdf.matrix.coverage, 
652:         name = Reference.object$hdf.matrix.coverage.t, 
656:             name = Reference.object$hdf.matrix.sparsity, 
661:     Attr.vals <- c(basename(Matrix.file),
662:         as.double(Matrix.range),
690:             return(.create_configuration_matrix_info(
743:         File = hdf_file, name = Reference.object$hdf.matrix.name,
745:     return(.create_configuration_matrix_info(
91:         TerrificNumberOfHiCFormats = c("NxNMatrix","PAIRIX","Cooler","HOMER",
230:     Reference.object <- GenomicMatrix$new()
255:     Reference.object <- GenomicMatrix$new()
309:     Reference.object <- GenomicMatrix$new()
349:     Reference.object <- GenomicMatrix$new()
450:     Reference.object <- GenomicMatrix$new()
552:     Reference.object <- GenomicMatrix$new()
678:     Reference.object <- GenomicMatrix$new()
772: #     Reference.object <- GenomicMatrix$new()
781: #     Reference.object <- GenomicMatrix$new()
787: #     Reference.object <- GenomicMatrix$new()
singleCellTK:R/importSeqc.R: [ ]
112:             matrix <- .unionGeneMatrix(geneUnion = geneUnion, matrix = mat[[i]])
23: .unionGeneMatrix <- function(geneUnion, matrix){
95:         matrixFile <- paste(prefix[i], 'sparse_molecule_counts.mtx', sep = "_")
3:     matrix,
8:     rownames(matrix) <- features[[1]]
11:         assays = list(counts = matrix))
24:     missGene <- geneUnion[!geneUnion %in% rownames(matrix)]
25:     missMat <- Matrix::Matrix(0, nrow = length(missGene), ncol = ncol(matrix),
28:     matb <- methods::as(matrix, "dgCMatrix")
29:     rownames(matb) <- rownames(matrix)
34:         warning("Duplicated genes exist in count matrix. Filtered",
113:             matrix <- matrix[geneUnion, ]
114:             feature <- S4Vectors::DataFrame('feature_name' = rownames(matrix))
118:                 matrix = matrix,
138:                 matrix = mat[[i]],
178: #' @param class Character. The class of the expression matrix stored in the SCE
179: #'  object. Can be one of \code{"Matrix"} (as returned by \link{readMM} 
180: #'  function), or \code{"matrix"} (as returned by \link[base]{matrix} function).
181: #'  Default \code{"Matrix"}.
182: #' @param delayedArray Boolean. Whether to read the expression matrix as
191: #' \code{SingleCellExperiment} object containing the combined count matrix,
195: #'  contains count matrix, feature annotations and cell annotations for
208: #'  will combined count matrix with genes detected in at least one sample.
210: #'  matrix, the feature annotations, and the cell annotation.
213: #' # The following filtered feature, cell, and matrix files were downloaded from
229:     class = c("Matrix", "matrix"),
103:         mat[[i]] <- .readMatrixMM(file.path(dir, matrixFile),
MotifDb:inst/scripts/import/stamlab/import.R: [ ]
171:     matrix = matrices [[matrix.id]]
73:   matrix.ids = unique (tbl.rmat$id)
77:   for (matrix.id in matrix.ids) {
102:   tbl.matrix =  read.table ('MATRIX.txt', sep='\t', header=F, as.is=TRUE)
168:   matrix.ids = names (matrices) 
170:   for (matrix.id in matrix.ids) {
11:   rawMatrixList <- readRawMatrices (dataDir)
61:   ms = sapply (pwm.list, function (element) element$matrix)
68: #  matrices = sapply (list.pwms, function (pwm) pwm$matrix)
69: #  matrix.names = sapply (list.pwms, function (pwm) pwm$title)
70: #  names (matrices) = matrix.names
74:   result =  vector ('list', length (matrix.ids))
78:     tbl.sub = subset (tbl.rmat, id == matrix.id)
79:       # sanity check this rather unusual representation of a position count matrix
84:       printf ('matrix.id %s has sequence of length %d', matrix.id, base.count$Freq [1])
90:     m = matrix (nucleotide.counts, byrow=TRUE, nrow=4, dimnames=list(row.names, col.names))
93:     } # for matrix.id
95:   names (result) = matrix.ids
103:   colnames (tbl.matrix) = c ('id', 'category', 'mID', 'version', 'binder')
105:   tbl.protein = read.table ('MATRIX_PROTEIN.txt', sep='\t', header=F, as.is=TRUE)
108:   tbl.species = read.table ('MATRIX_SPECIES.txt', sep='\t', header=F, as.is=TRUE)
111:   tbl.anno = read.table ('MATRIX_ANNOTATION.txt', sep='\t', header=F, as.is=TRUE, quote="")
133:   tbl.md = merge (tbl.matrix, tbl.species, all.x=TRUE)
174:     new.row = list (providerName=matrix.id,
175:                     providerId=matrix.id,
190:     full.name = sprintf ('%s-%s-%s', 'Hsapiens', 'stamlab', matrix.id)
335:   result = matrix (nrow=line.count-1, ncol=4, dimnames=list(1:(line.count-1), c ('A','C','G','T')))  
344:   return (list (title=title, consensus.sequence=consensus.sequence, matrix=result))
13:   matrices <- extractAndNormalizeMatrices (rawMatrixList)
preprocessCore:src/R_subColSummarize.c: [ ]
48:   double *matrix;
87:     AverageLog_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
108:   double *matrix=NUMERIC_POINTER(RMatrix);
161:   /* The aim is to try to be as fair as possible in dividing up the matrix */
179:   args[0].matrix = matrix;
235:     AverageLog_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
263:     LogAverage_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
281:   double *matrix=NUMERIC_POINTER(RMatrix);
335:   /* The aim is to try to be as fair as possible in dividing up the matrix */
353:   args[0].matrix = matrix;
410:     LogAverage_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
439:     ColAverage_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
457:   double *matrix=NUMERIC_POINTER(RMatrix);
511:   /* The aim is to try to be as fair as possible in dividing up the matrix */
529:   args[0].matrix = matrix;
585:     ColAverage_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
614:     TukeyBiweight_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
634:   double *matrix=NUMERIC_POINTER(RMatrix);
688:   /* The aim is to try to be as fair as possible in dividing up the matrix */
706:   args[0].matrix = matrix;
762:     TukeyBiweight_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
791:     TukeyBiweight_no_log_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
810:   double *matrix=NUMERIC_POINTER(RMatrix);
864:   /* The aim is to try to be as fair as possible in dividing up the matrix */
882:   args[0].matrix = matrix;
939:     TukeyBiweight_no_log_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
967:     MedianLog_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
987:   double *matrix=NUMERIC_POINTER(RMatrix);
1041:   /* The aim is to try to be as fair as possible in dividing up the matrix */
1059:   args[0].matrix = matrix;
1115:     MedianLog_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
1143:     LogMedian_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
1162:   double *matrix=NUMERIC_POINTER(RMatrix);
1216:   /* The aim is to try to be as fair as possible in dividing up the matrix */
1234:   args[0].matrix = matrix;
1290:     LogMedian_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
1318:     ColMedian_noSE(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows);
1336:   double *matrix=NUMERIC_POINTER(RMatrix);
1390:   /* The aim is to try to be as fair as possible in dividing up the matrix */
1408:   args[0].matrix = matrix;
1464:     ColMedian_noSE(matrix, rows, cols, cur_rows, buffer, ncur_rows);
1495:     MedianPolish(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows, buffer2);
1515:   double *matrix=NUMERIC_POINTER(RMatrix);
1573:   /* The aim is to try to be as fair as possible in dividing up the matrix */
1591:   args[0].matrix = matrix;
1645:     MedianPolish(matrix, rows, cols, cur_rows, buffer, ncur_rows, buffer2);
1675:     MedianPolish_no_log(args->matrix, args->rows, args->cols, cur_rows, buffer, ncur_rows, buffer2);
1695:   double *matrix=NUMERIC_POINTER(RMatrix);
1749:   /* The aim is to try to be as fair as possible in dividing up the matrix */
1767:   args[0].matrix = matrix;
1824:     MedianPolish_no_log(matrix, rows, cols, cur_rows, buffer, ncur_rows, buffer2);
103: SEXP R_subColSummarize_avg_log(SEXP RMatrix, SEXP R_rowIndexList){
139:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
144:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
276: SEXP R_subColSummarize_log_avg(SEXP RMatrix, SEXP R_rowIndexList){
312:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
317:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
452: SEXP R_subColSummarize_avg(SEXP RMatrix, SEXP R_rowIndexList){
488:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
493:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
629: SEXP R_subColSummarize_biweight_log(SEXP RMatrix, SEXP R_rowIndexList){
666:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
671:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
805: SEXP R_subColSummarize_biweight(SEXP RMatrix, SEXP R_rowIndexList){
841:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
846:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
982: SEXP R_subColSummarize_median_log(SEXP RMatrix, SEXP R_rowIndexList){
1018:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
1023:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
1157: SEXP R_subColSummarize_log_median(SEXP RMatrix, SEXP R_rowIndexList){
1193:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
1198:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
1331: SEXP R_subColSummarize_median(SEXP RMatrix, SEXP R_rowIndexList){
1367:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
1372:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
1510: SEXP R_subColSummarize_medianpolish_log(SEXP RMatrix, SEXP R_rowIndexList){
1547:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
1552:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
1690: SEXP R_subColSummarize_medianpolish(SEXP RMatrix, SEXP R_rowIndexList){
1726:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
1731:   PROTECT(R_summaries = allocMatrix(REALSXP,length_rowIndexList,cols));
RGMQL:R/ordering-functions.R: [ ]
60:             matrix <- matrix(new_value)
80:             matrix <- matrix(new_value)
56:         order_matrix <- .jnull("java/lang/String")
76:         order_matrix <- .jnull("java/lang/String")
58:         order_matrix <- t(vapply(ords, function(x) {
63:     order_matrix
78:         order_matrix <- t(vapply(ords, function(x) {
83:     order_matrix
tRanslatome:R/GOsets.R: [ ]
99: 		matrix <- matrix(c(-log(as.numeric(pvalList1stlevel), base=10), 
205: 		matrix <- matrix(c(-log(as.numeric(pvalList1stlevel), base=10), 
295: 				Similarity.Matrix <- rbind(resulttable1to2, resulttable2to1)
102: 		print(matrix)
104: 		if ((sum(matrix == 0)) == (nrow(matrix) * ncol(matrix))) {
110: 			radial.plot(matrix, labels=uniquelistTerms, rp.type="p", 
208: 		print(matrix)
210: 		print(dim(matrix))
213: 		if ((sum(matrix == 0)) == (nrow(matrix) * ncol(matrix))) {
218: 			rownames(matrix) <- uniquelistTerms
219: 			colnames(matrix) <- c(label.level.enriched(object)[1], 
221: 			print(matrix)
222: 			heatmap.2(matrix, col = RGBColVec(50)[c(26:50)], key=TRUE, 
316: 			Similarity.Matrix <- rbind(ontologyCC$result1, ontologyCC$result2, 
323: 							similarity.matrix = Similarity.Matrix, 
324: 							identity.matrix = as.matrix(Atable), 
385: 	OntologyAndDirection <- matrix(,nrow=dim(finalmat)[1], ncol=2)
hermes:R/pca_cor_samplevar.R: [ ]
237:       matrix = t(mat),
107: h_pca_df_r2_matrix <- function(pca, df) {
184:     r2_matrix <- h_pca_df_r2_matrix(pca, df)
15: #' @param pca (`matrix`)\cr principal components matrix generated by [calc_pca()].
38:     is.matrix(pca),
49:   design <- stats::model.matrix(~x)
61: #' Calculation of R2 Matrix between Sample Variables and Principal Components
66: #' corresponding principal components matrix, and then generates the matrix of R2 values.
70: #'     `logical` are included in the resulting matrix, because other variable types are not
75: #' @param pca (`matrix`)\cr comprises principal components generated by [calc_pca()].
79: #' @return A matrix with R2 values for all combinations of sample variables and principal
100: #' r2_all <- h_pca_df_r2_matrix(pca, df)
109:     is.matrix(pca),
160: #' @seealso [h_pca_df_r2_matrix()] which is used internally for the details.
185:     .HermesDataPcaCor(r2_matrix)
196:   contains = "matrix"
235:     mat <- as(object, "matrix")
conclus:R/methods-clustering.R: [ ]
916:     matrix <- getClustersSimilarityMatrix(theObject)
631:             cellsSimilarityMatrix <- .mkSimMat(dbscanList, cores=cores)
634:             distMatrix <- as.dist(sqrt((1-cellsSimilarityMatrix)/2))
807:             cellsSimilarityMatrix <- getCellsSimilarityMatrix(theObject)
818:             clustersSimilarityMatrix <- .mkSimMed(
822:             distMatrix <- as.dist(sqrt((1 - clustersSimilarityMatrix)/2))
253: #' @param theObject An Object of class scRNASeq for which the count matrix was
389: #' For each cluster number (clusters), computes a similarity matrix with 1. In
390: #' the resulting list (l), there is one matrix for each cluster number.
397: #' @return A list of similarity matrix.
404:     ## Create a square matrix containing only 0 that will be filled by the
406:     simMat <- matrix(0, ncol=ncol, nrow=nrow)
451: #' @return A cell similarity matrix
455:     ## This foreach gives, for each dbscan result, a matrix containing 1 and
509:     ## Check if the normalized matrix is correct
542:     setClustersSimilarityMatrix(theObject) <-  matrix(nrow = 1, ncol = 1,
563: #' matrix of cells.
569: #' @param theObject An Object of class scRNASeq for which the count matrix was
597: #' ## Compute the cell similarity matrix
630:             message("Calculating cells similarity matrix.")
667: #' This function returns a matrix with "protocells" representing clusters.
673: #' @param mat Matrix containing the cells similarity or the clusters median.
678: #' @return A median matrix.
685:                 return(matrixStats::rowMedians(as.matrix(fullmat[, clusts ==
695: #' Generate the clusters similarity matrix.
704: #' @return A similarity matrix
709:     clusMed <- matrix(ncol=length(unique(clusters)), nrow=nrow(simMat))
713:     simMed <- matrix(ncol=length(unique(clusters)),
728:     ## Check if the normalized matrix is correct
735:     ## Check if the normalized matrix is filtered
744:     ## Check the cell similarity matrix
761: #' @param theObject An Object of class scRNASeq for which the count matrix was
819:                     as.matrix(cellsSimilarityMatrix), clusters, clustersNames)
821:             ## Plotting matrix
913:     ## Check that the cluster similarity matrix was computed
918:     if(all(dim(matrix) == c(1,1)))
59:                 "'sceNorm' slot updated. Please use 'normaliseCountMatrix'",
254: #' normalized. See ?normaliseCountMatrix.
319: #' normaliseCountMatrix runDBSCAN pdf
364:             tSNE <- .getTSNEresults(expressionMatrix=Biobase::exprs(sceObject),
513:                 "slot updated. Please use 'normaliseCountMatrix' on the object",
570: #' normalized (see ?normaliseCountMatrix), tSNE were calculated (see
590: #' An object of class scRNASeq with its cellsSimilarityMatrix and sceNorm slots
635:             clusteringTree <- hclust(distMatrix, method=clusteringMethod)
647:             setCellsSimilarityMatrix(theObject) <- cellsSimilarityMatrix
697: #' @param simMat The cellsSimilarityMatrix.
722: .checkParamsClusterSim <- function(clusteringMethod, cellsSimilarityMatrix,
732:                 "'sceNorm' slot updated. Please use 'normaliseCountMatrix' on",
745:     if(all(dim(cellsSimilarityMatrix) == c(1,1)))
748:                 "'cellsSimilarityMatrix' slot updated by clusterCellsInternal.",
762: #' normalized (see ?normaliseCountMatrix), tSNE were calculated (see
777: #' An object of class scRNASeq with its clustersSimilarityMatrix and
810:             .checkParamsClusterSim(clusteringMethod, cellsSimilarityMatrix,
823:             clusteringTree <- hclust(distMatrix, method=clusteringMethod)
830:             setClustersSimilarityMatrix(theObject)  <- clustersSimilarityMatrix
qmtools:R/reduceFeatures-functions.R: [ ]
113:     res <- pcaMethods::nipalsPca(Matrix = x, nPcs = ncomp, ...)
3: ##' Performs PCA on a matrix-like object where rows represent features and
10: ##' `reduced.pca` object that is a matrix with custom attributes to summarize
19: ##' * `loadings`: A matrix of variable loadings.
26: ##' @param x A matrix-like object.
64:     if (!is.matrix(x)) {
65:         x <- as.matrix(x)
70:     xt <- t(x) # transpose matrix;
131: ##' Performs t-SNE on a matrix-like object where rows represent features and
137: ##' `reduced.tsne` object that is a matrix with custom attributes to summarize
148: ##' @param x A matrix-like object.
151: ##' @param normalize A logical specifying whether the input matrix is
153: ##'   matrix is equal to unity. See [Rtsne::normalize_input] for details.
187:     if (!is.matrix(x)) {
188:         x <- as.matrix(x)
193:     xt <- t(x) # transpose matrix;
220: ##' Performs PLS-DA on a matrix-like object where rows represent features and
226: ##' so that it can be internally converted to an indicator matrix. The function
227: ##' returns a `reduced.plsda` object that is a matrix with custom attributes to
238: ##' * `loadings`: A matrix of loadings.
239: ##' * `loadings.weights`: A matrix of loading weights.
242: ##' * `Y.scores`: A matrix of Y-scores.
243: ##' * `Y.loadings`: A matrix of Y-loadings.
244: ##' * `projection`: The projection matrix.
253: ##' @param x A matrix-like object.
290:     if (!is.matrix(x)) {
291:         x <- as.matrix(x)
304:     y_dummy <- model.matrix(~ y - 1)
331:     class(out) <- c("reduced.plsda", "matrix", class(out))
MethReg:R/filter_by_quantile.R: [ ]
30:         matrix <- assay(dnam)
129:         matrix <- assay(exp)
186:         matrix <- assay(exp)
6: #' @param dnam DNA methylation matrix or SummarizedExperiment object
19: #' A subset of the original matrix only with the
32:         matrix <- dnam
36:     keep.rows <- which(rowSums(is.na(matrix)) != ncol(matrix))
37:     if(length(keep.rows) < nrow(matrix)){
39:         matrix <- matrix[keep.rows,]
42:     IQR <- calculate_IQR(matrix)
55:     matrix <- matrix[diff.regions,,drop = FALSE]
58:         dnam <- dnam[rownames(matrix),]
59:         assay(dnam) <- matrix
61:         dnam <- matrix
69: #'   matrix(nrow = 1,dimnames = list(c("row1"), LETTERS[1:10])) %>%
72: calculate_IQR <- function(matrix){
75:         "ID" = rownames(matrix),
76:         "IQR" = matrixStats::rowIQRs(matrix, na.rm = TRUE)
83: #'   matrix(nrow = 1,dimnames = list(c("row1"), LETTERS[1:10])) %>%
87:     matrix, 
93:     plyr::adply(.data = matrix,.margins = 1,.fun = function(row){
106: #' @param exp Gene expression matrix or SumarizedExperiment object
120: #' A subset of the original matrix only with the rows passing
131:         matrix <- exp
136:     diff.genes <- plyr::adply(matrix,.margins = 1,.fun = function(row){
170: #' @param exp Gene expression matrix or SumarizedExperiment object
178: #' @return A subset of the original matrix only with the rows
188:         matrix <- exp
191:     na.or.zeros <- matrix == 0 | is.na(matrix)
192:     percent.na.or.zeros <- rowSums(na.or.zeros) / ncol(matrix)
195:     message("Removing ", nrow(matrix) - length(genes.keep), " out of ", nrow(matrix), " genes")
201: #' @param exp Gene expression matrix or a Summarized Experiment object
209: #' A subset of the original matrix only with the rows
73:     check_package("matrixStats")
M3C:R/clustersim.R: [ ]
37:   matrix = matrix(nrow = n, ncol = 3)
50:   matrix2 <- subset(data.frame(matrix), X3 < r)
108:   final_matrix <- as.matrix(final_df)
13: #' @return A list: containing 1) matrix with simulated data in it
38:   matrix[,1] <- rep(c(1:sqrt(n)),each=sqrt(n))
39:   matrix[,2] <- rep(c(1:sqrt(n)), sqrt(n))
42:   x1 <- (cluster::pam(data.frame(matrix)[,1:2], 1)$medoids)[1]
43:   y1 <- (cluster::pam(data.frame(matrix)[,1:2], 1)$medoids)[2]
45:   x2 <- matrix[,1]
46:   y2 <- matrix[,2]
48:   matrix[,3] <- answer
51:   #plot(matrix2[,1], matrix2[,2])
52:   matrix2[] <- vapply(as.matrix(matrix2), addnoise, numeric(1))
53:   #plot(matrix2[,1], matrix2[,2])
58:   res = matrix(nrow = nrow(matrix2), ncol = n2)
59:   for (i in seq(1,nrow(matrix2),1)){
60:     a <- matrix2[i,1] # get fixed co ordinate1 for entire row
61:     b <- matrix2[i,2] # get fixed co ordinate2 for entire row
72:   scores <- data.frame(pca1$x) # PC score matrix
104:   # convert back to a matrix of data for clustering
112:   jjj <- t(final_matrix[,4:5] %*% t(pca1$rotation[,1:2])) + pca1$center # equation, PCs * eigenvectors = original data
128:   scores <- data.frame(pca1$x) # PC score matrix
msa:src/ClustalOmega/src/hhalign/hhdecl-C.h: [ ]
138:   char matrix;            // Subst.matrix 0: Gonnet, 1: HSDM, 2: BLOSUM50
146:   float pca;              // Pseudocount matrix = (1-tau(i))*I + tau(i)*S
161:   float pcaV;              // Pseudocount matrix = (1-tau(i))*I + tau(i)*S
188:   float ssa;              // SS state evolution matrix M1 = (1-ssa)*I + ssa*M0
203:   int min_overlap;        // all cells of dyn. programming matrix with L_T-j+i or L_Q-i+j < min_overlap will be ignored
235: // substitution matrix flavours
238: float Sim[21][21];    // Similarity matrix Sim[a][b]: how similar are a and b?
239: float S[21][21];      // Substitution score matrix S[a][b] = log2(Pab/pa/pb)
240: float pb[21];         // pb[a] = background amino acid probabilities for chosen substitution matrix
241: ...(1 bytes skipped)...loat qav[21];        // qav[a] = background amino acid probabilities for query HMM (needed for rate matrix rescaling)
HiCBricks:R/viz_art_backend.R: [ ]
45:         Matrix <- Brick_get_matrix_within_coords(Brick = Brick, 
42:     Matrix.df.list <- list()
61:         Matrix.df <- melt(Matrix)
52:         if(dim(Matrix)[1] != length(Region.position.x) | 
53:             dim(Matrix)[2] != length(Region.position.y)){
54:             stop("Matrix dimensions do not match the expected ",
55:                 "dimensions of the matrix! Please check the ",
58:         Matrix[is.nan(Matrix) | is.infinite(Matrix) | is.na(Matrix)] <- 0
59:         rownames(Matrix) <- Region.position.x
60:         colnames(Matrix) <- Region.position.y
62:         colnames(Matrix.df) <- c("row","col","val")
65:             capped.val <- quantile(Matrix.df$val,value_cap)
66:             Matrix.df$val[Matrix.df$val > capped.val] <- capped.val
68:         Matrix.df$dist <- Matrix.df$col - Matrix.df$row
69:         Matrix.df$keep <- FALSE
71:             Matrix.df$keep[Matrix.df$dist >= 0] <- TRUE
73:             Matrix.df$keep[Matrix.df$dist <= 0] <- TRUE
75:         Matrix.df.list[[i]] <- Matrix.df
78:     Matrix.df <- do.call(rbind,Matrix.df.list)
80:         Matrix.df <- Matrix.df[Matrix.df$keep,]
81:         Matrix.df$val[Matrix.df$dist == 0] <- 0
84:         Matrix.df <- Matrix.df[Matrix.df$dist <= distance & 
85:         Matrix.df$dist >= -distance,]
87:     return(Matrix.df)
182: RotateHeatmap = function(Matrix=NULL, value.var=NULL, upper = FALSE){
183:     rotated.distance <- max(Matrix$dist)
186:         Vector <- Matrix[Matrix$dist==x,value.var]
16:     Reference.object <- GenomicMatrix$new()
30:     Reference.object <- GenomicMatrix$new()
341:     Reference.object <- GenomicMatrix$new()
UMI4Cats:R/utils.R: [ ]
122:   matrix <- assay(umi4c)
130:   mat_sp <- lapply(ids, function(x) matrix[x,])
155:   dds <- DESeq2::DESeqDataSetFromMatrix(
motifmatchr:src/MOODS/scanner.h: [ ]
16:         std::size_t matrix;
37:         void set_motifs(const std::vector<score_matrix>& matrices,
XNAString:src/ViennaRNA/constraints/hard.h: [ ]
383:       unsigned char *matrix;     /**<  @brief  Upper triangular matrix that encodes where a
391:       unsigned char         **matrix_local;
352:  *  used in the folding recursions. Attribute 'matrix' is used as source for
354:  *  Any entry in matrix[i,j] consists of the 6 LSB that allows one to distinguish the
RGMQL:R/evaluation-functions.R: [ ]
50:             matrix <- matrix(new_value)
46:         join_condition_matrix <- NULL
48:         join_condition_matrix <- t(vapply(array, function(x) {
53:     join_condition_matrix
lpsymphony:src/SYMPHONY/Clp/src/ClpModel.hpp: [ ]
697:      inline CoinPackedMatrix * matrix() const {
1148:      ClpMatrixBase * matrix_;
1203: #define MATRIX_SAME 2
1204: #define MATRIX_JUST_ROWS_ADDED 4
1205: #define MATRIX_JUST_COLUMNS_ADDED 8
720:      inline ClpMatrixBase * clpMatrix() const     {
724:      inline ClpPackedMatrix * clpScaledMatrix() const     {
728:      inline void setClpScaledMatrix(ClpPackedMatrix * scaledMatrix) {
733:      inline ClpPackedMatrix * swapScaledMatrix(ClpPackedMatrix * scaledMatrix) {
749:      inline void replaceMatrix(CoinPackedMatrix * newmatrix,
1152:      ClpPackedMatrix * scaledMatrix_;
1254:      CoinPackedMatrix baseMatrix_;
82:      void loadProblem (  const ClpMatrixBase& matrix,
87:      void loadProblem (  const CoinPackedMatrix& matrix,
93:      /** Just like the other loadProblem() method except that the matrix is
105:          If tryPlusMinusOne then will try adding as +-1 matrix
120:      void loadQuadraticObjective (  const CoinPackedMatrix& matrix);
167:          If tryPlusMinusOne then will try adding as +-1 matrix
168:          if no matrix exists.
178:          If tryPlusMinusOne then will try adding as +-1 matrix
179:          if no matrix exists.
215:          If tryPlusMinusOne then will try adding as +-1 matrix
216:          if no matrix exists.
225:          If tryPlusMinusOne then will try adding as +-1 matrix
226:          if no matrix exists.
230:      /// Modify one element of a matrix
233:           matrix_->modifyCoefficient(row, column, newElement, keepZero);
255:      /** Really clean up matrix (if ClpPackedMatrix).
256:          a) eliminate all duplicate AND small elements in matrix
696:      /// Matrix (if not ClpPackedmatrix be careful about memory leak
698:           if ( matrix_ == NULL ) return NULL;
699:           else return matrix_->getPackedMatrix();
701:      /// Number of elements in matrix
703:           return matrix_->getNumElements();
713:      /// Row Matrix
717:      /// Set new row matrix
719:      /// Clp Matrix
721:           return matrix_;
738:      /** Replace Clp Matrix (current is not deleted unless told to
743:      void replaceMatrix(ClpMatrixBase * matrix, bool deleteCurrent = false);
744:      /** Replace Clp Matrix (current is not deleted unless told to
944:      /**@name Matrix times vector methods
1027:          128 - Switch off all matrix sanity checks
1038:          262144 - extra copy of scaled matrix
1075:      /// puts in format I like - 4 array matrix - may make row copy
1147:      /// Packed matrix
1151:      /// Scaled packed matrix
1155:      /// Row scale factors for matrix
1159:      /// Inverse row scale factors for matrix (end of rowScale_)
1161:      /// Inverse column scale factors for matrix (end of columnScale_)
1190:              2 - matrix has not changed
1191:              4 - if matrix has changed only by adding rows
1192:              8 - if matrix has changed only by adding columns
1253:      /// Base packed matrix
1257:      /// Saved row scale factors for matrix
19: #include "ClpPackedMatrix.hpp"
116:      /** Load up quadratic objective.  This is stored as a CoinPackedMatrix */
253:      /// Create empty ClpPackedMatrix
254:      void createEmptyMatrix();
260:          returns number of elements eliminated or -1 if not ClpPackedMatrix
262:      int cleanMatrix(double threshold = 1.0e-20);
723:      /// Scaled ClpPackedMatrix
725:           return scaledMatrix_;
727:      /// Sets pointer to scaled ClpPackedMatrix
729:           delete scaledMatrix_;
730:           scaledMatrix_ = scaledMatrix;
732:      /// Swaps pointer to scaled ClpPackedMatrix
734:           ClpPackedMatrix * oldMatrix = scaledMatrix_;
735:           scaledMatrix_ = scaledMatrix;
736: 	  return oldMatrix;
746:          matrices were being rotated.  This version changes CoinPackedMatrix
747:          to ClpPackedMatrix.  ClpModel takes ownership.
751:           replaceMatrix(new ClpPackedMatrix(newmatrix), deleteCurrent);
1256:      CoinPackedMatrix baseRowCopy_;
264:      void copy(const ClpMatrixBase * from, ClpMatrixBase * & to);
714:      inline ClpMatrixBase * rowCopy() const       {
718:      void setNewRowCopy(ClpMatrixBase * newCopy);
1150:      ClpMatrixBase * rowCopy_;
conclus:R/methods-export.R: [ ]
118:     matrix <- getClustersSimilarityMatrix(theObject)
162:         matrix <- getCellsSimilarityMatrix(theObject)
338: .saveNormalizedMatrix <- function(theObject, experimentName, sceObject,
442: .saveCellsSimilarityMatrix <- function(theObject, experimentName, outputDir,
473: .saveClustersSimilarityMatrix <- function(theObject, experimentName, outputDir,
115:     ## Check that the cluster similarity matrix was computed
120:     if(all(dim(matrix) == c(1,1)))
151: #' @param cell If TRUE, exports the cells similarity matrix otherwise
152: #' exports the clusters similarity matrix. Default=TRUE.
165:         fileName <- "_cells_similarity_matrix.csv"
168:         matrix <- getClustersSimilarityMatrix(theObject)
171:         fileName <- "_clusters_similarity_matrix.csv"
174:     if(all(dim(matrix) == c(0,0)) || all(dim(matrix) == c(1,1)))
181:     write.csv(matrix, file=file.path(outputDir, fileName))
263: #' Export the normalized matrix, the columns, and the rows metadata to the
275: #' sceObject. Can be the normalized count matrix with f=Biobase::exprs, the row
312: #' normalized count matrix, the colData and the rowData in "1_MatrixInfo"
324: #' @param saveNormalizedMatrix Default=FALSE. Save the normalized count matrix
325: #' as a csv file. It is obtained with ?normaliseCountMatrix. The matrix is saved
328: #' count matrix as a tsv file. These data are obtained with
332: #' count matrix as a tsv file. These data are obtained with
346:         ## Export Normalized expression matrix
349:                             sceObject, Biobase::exprs, "_expression_matrix.tsv",
350:                             "Normalized expression matrix")
427: #' the cell similarity matrix in '4_CellSimilarityMatrix' sub-directory.
437: #' matrix that was obtained with ?clusterCellsInternal. This matrix is saved in
457: #' Internal function of exportResults. Save the cluster  similarity matrix
468: #' similarity matrix that was obtained with ?calculateClustersSimilarity. It is
621: #' @param saveNormalizedMatrix Default=FALSE. Save the normalized count matrix
622: #' as a csv file. It is obtained with ?normaliseCountMatrix. The matrix is saved
625: #' count matrix as a tsv file. These data are obtained with
629: #' count matrix as a tsv file. These data are obtained with
640: #' matrix that was obtained with ?clusterCellsInternal. This matrix is saved in
643: #' similarity matrix that was obtained with ?calculateClustersSimilarity. It is
148: #' dataDirectory/4_CellSimilarityMatrix or
149: #' dataDirectory/5_ClusterSimilarityMatrix. dataDirectory is directly retrieved
163:         matType <- "cellsSimilarityMatrix"
169:         matType <- "clustersSimilarityMatrix"
264: #' sub-directory '1_MatrixInfo'. These results were obtained with
265: #' ?normaliseCountMatrix.
267: #' @param theObject scRNASeq object on which ?normaliseCountMatrix was run.
268: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
291:                 "'sceNorm' slot updated. Please use 'normaliseCountMatrix'",
308: #' .saveNormalizedMatrix
322: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
326: #' to the sub-directory '1_MatrixInfo'.
329: #' ?normaliseCountMatrix. They are saved in the sub-directory '1_MatrixInfo'.
333: #' ?normaliseCountMatrix or were given as input of the method. These data are
334: #' saved in the sub-directory '1_MatrixInfo'.
339:                                     outputDir, saveNormalizedMatrix,
342:     if(saveNormalizedMatrix || saveRowData || saveColData){
343:         outputNorm <- file.path(outputDir, "1_MatrixInfo")
347:         if(saveNormalizedMatrix)
377: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
404: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
423: #' .saveCellsSimilarityMatrix
434: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
436: #' @param saveCellsSimilarityMatrix Default=FALSE. Save the cells similarity
438: #' the sub-directory '4_CellSimilarityMatrix'.
443:                                         saveCellsSimilarityMatrix){
445:     if(saveCellsSimilarityMatrix){
447:                                     "4_CellSimilarityMatrix")
454: #' .saveClustersSimilarityMatrix
458: #' in '5_ClusterSimilarityMatrix' sub-directory.
465: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
467: #' @param saveClustersSimilarityMatrix Default=FALSE. Save the cluster
469: #' saved in the sub-directory '5_ClusterSimilarityMatrix'.
474:                                             saveClustersSimilarityMatrix){
475:     if(saveClustersSimilarityMatrix){
477:                                 "5_ClusterSimilarityMatrix")
498: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
528: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
554: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
582: #' @param outputDir Output directory defined as dataDirectory/1_MatrixInfo.
607: #' saveNormalizedMatrix=FALSE, saveColData=FALSE, saveRowData=FALSE,
608: #' saveTsne=FALSE, saveDBScan=FALSE, saveCellsSimilarityMatrix=FALSE,
609: #' saveClustersSimilarityMatrix=FALSE, saveFullMarkers=FALSE,
623: #' to the sub-directory '1_MatrixInfo'.
626: #' ?normaliseCountMatrix or were given as input of the method. These data are
627: #' saved in the sub-directory '1_MatrixInfo'.
630: #' ?normaliseCountMatrix. They are saved in the sub-directory '1_MatrixInfo'.
639: #' @param saveCellsSimilarityMatrix Default=FALSE. Save the cells similarity
641: #' the sub-directory '4_CellSimilarityMatrix'.
642: #' @param saveClustersSimilarityMatrix Default=FALSE. Save the cluster
644: #' saved in the sub-directory '5_ClusterSimilarityMatrix'.
688:                 saveAll=FALSE, saveNormalizedMatrix=FALSE, saveColData=FALSE,
690:                 saveCellsSimilarityMatrix=FALSE,
691:                 saveClustersSimilarityMatrix=FALSE, saveFullMarkers=FALSE,
696:                 saveNormalizedMatrix <- saveColData <- saveRowData <- TRUE
697:                 saveTsne <- saveDBScan <- saveCellsSimilarityMatrix <- TRUE
698:                 saveClustersSimilarityMatrix <- saveFullMarkers <- TRUE
708:             .saveNormalizedMatrix(theObject, experimentName, sceObject,
709:                                 outputDir, saveNormalizedMatrix, saveRowData,
716:             .saveCellsSimilarityMatrix(theObject, experimentName, outputDir,
717:                                         saveCellsSimilarityMatrix)
719:             .saveClustersSimilarityMatrix(theObject, experimentName, outputDir,
720:                                         saveClustersSimilarityMatrix)
celda:R/moduleHeatmap.R: [ ]
462:         plt <- ComplexHeatmap::Heatmap(matrix = filteredNormCounts,
237:         factorizedMatrix <- factorizeMatrix(x,
9: #' @param x A numeric \link{matrix} of counts or a
11: #'  with the matrix located in the assay slot under \code{useAssay}.
35: #' @param normalizedCounts Integer matrix. Rows represent features and columns
36: #'  represent cells. If you have a normalized matrix result from
39: #'  rownames match the object in x. This matrix should
40: #'  correspond to one generated from this count matrix
46: #'  module heatmaps, where normalizing the counts matrix repeatedly would
236:         # factorize counts matrix
255:                 matrix = factorizedMatrix$proportions$module,
259:                 matrix = factorizedMatrix$proportions$module,
486:         plt <- ComplexHeatmap::Heatmap(matrix = filteredNormCounts,
241:         allCellStates <- factorizedMatrix$proportions$cell
260:                 n = nrow(factorizedMatrix$proportions$module))
390:     # Determine cell order from factorizedMatrix$proportions$cell
MotifDb:inst/scripts/import/jaspar2014/import.R: [ ]
127:     matrix = matrices [[matrix.id]]
56:   matrix.names <- sapply (pwm.list, function (element) element$title)
66:     tbl.matrix <-  read.table(file, sep='\t', header=FALSE, as.is=TRUE)
123:   matrix.ids = names (matrices) 
126:   for (matrix.id in matrix.ids) {
12:   rawMatrixList <- readRawMatrices (dataDir)
34:   filename <- file.path(dataDir, "matrix_data.txt")
55:   matrices = sapply (pwm.list, function (element) element$matrix)
57:   matrix.names <- sub("^>", "", matrix.names)
58:   names (matrices) <- matrix.names
65:     file <- file.path(dataDir, "MATRIX.txt")
67:     colnames(tbl.matrix) <- c('id', 'category', 'mID', 'version', 'binder')
69:     file <- file.path(dataDir, "MATRIX_PROTEIN.txt")
74:     file <- file.path(dataDir, "MATRIX_SPECIES.txt")
79:     file <- file.path(dataDir, "MATRIX_ANNOTATION.txt")
84:     file <- file.path(dataDir, "MATRIX_ANNOTATION.txt")
104:     tbl.md <- merge(tbl.matrix, tbl.species, all.x=TRUE)
128:     tbl.sub = subset (tbl.anno, fullID==substr(matrix.id,0,8))
147:                     sequenceCount=as.integer (mean (colSums (matrix))),
216:   result <- matrix (nrow=4, ncol=cols,
227:   #return (list (title=title, consensus.sequence=consensus.sequence, matrix=result))
228:   return (list (title=title, matrix=result))
13:   matrices <- extractMatrices (rawMatrixList)
evaluomeR:R/metricsAnalysis.R: [ ]
21:   matrix = data.matrix(data[,-1])
20:   # Data matrix without descritive column
22:   maxs = matrixStats::colMaxs(matrix)
23:   mins = matrixStats::colMins(matrix)
24:   means = colMeans(matrix)
25:   sd = matrixStats::colSds(matrix)
27:   dataStats = matrix(NA, nrow=5, ncol = length(data[,-1]), byrow=TRUE,
162:   d <- dist(t(data.metrics), method = "euclidean") # distance matrix
HiCBricks:R/LSD_functions.R: [ ]
221:         Matrix <- Brick_get_vector_values(Brick = Brick, chr1 = chr, 
2:     RowSums <- Brick_get_matrix_mcols(Brick = Brick, chr1 = chr, chr2 = chr, 
7:     Sparsity.index <- Brick_get_matrix_mcols(Brick = Brick, chr1 = chr, 
122: ComputeDirectionalityIndex <- function(Matrix = NULL, Window.size=NULL, 
124:     Sequence <- seq_len(nrow(Matrix))
128:     All.bins <- seq_len(nrow(Matrix))
141:             Row.vector <- Matrix[i,]
171:     RowSums <- Brick_get_matrix_mcols(Brick = Brick, chr1 = chr, chr2 = chr, 
174:         SparsityIndex <- Brick_get_matrix_mcols(Brick = Brick, chr1 = chr, 
227:         DI.data <- ComputeDirectionalityIndex(Matrix = Matrix, 
250: #' Do TAD Calls with Local Score Differentiator on a Hi-C matrix
297: #' Process bins in the matrix with row.sums greater than \emph{min_sum}.
328: #' If TRUE, a matrix which has been defined as sparse during the matrix loading
329: #' process will be treated as a dense matrix. The \emph{sparsity_threshold} 
330: #' filter will not be applied. Please note, that if a matrix is defined as 
335: #' number of non-zero bins at a certain distance from the diagonal. If a matrix
344: #' The size of the matrix chunk to process. This value should be larger than 2x
348: #' If TRUE, this will force the retrieval of a matrix chunk even when the 
370: #' Matrix_file <- system.file(file.path("extdata", 
374: #' Brick_load_matrix(Brick = My_BrickContainer, chr1 = "chr3R", 
375: #' chr2 = "chr3R", matrix_file = Matrix_file, delim = " ",
394:         Brick_matrix_isdone(Brick = Brick, chr1 = chr, chr2 = chr, 
405:         sparse <- Brick_matrix_issparse(Brick = Brick, chr1 = chr, chr2 = chr, 
407:         max.distance <- Brick_matrix_maxdist(Brick = Brick, chr1 = chr, 
426:         RowSums <- Brick_get_matrix_mcols(Brick = Brick, chr1 = chr, 
431:             SparsityIndex <- Brick_get_matrix_mcols(Brick = Brick, 
scRepertoire:R/combineContigs.R: [ ]
185:     matrix <- as.matrix(stringdistmatrix(tmp, method = "lv"))
186:     out_matrix <- matrix(ncol = ncol(matrix), nrow=ncol(matrix))
71:         Con.df <- data.frame(matrix(NA, length(unique_df), 7))
142:         Con.df <- data.frame(matrix(NA, length(unique_df), 9))
187:     for (j in seq_len(ncol(matrix))) {
188:         for (k in seq_len(nrow(matrix))) {
190:                 out_matrix[j,k] <- NA
193:                     out_matrix[j,k] <- matrix[j,k]/(max(length[j], length[k]))
194:                     out_matrix[k,j] <- matrix[k,j]/(max(length[j], length[k]))
196:                 out_matrix[j,k] <- matrix[j,k]/((length[j]+ length[k])/2)
197:                 out_matrix[k,j] <- matrix[k,j]/((length[j]+ length[k])/2)
202:     filtered <- which(out_matrix <= 0.15, arr.ind = TRUE)
177: #' @importFrom stringdist stringdistmatrix
NetSAM:R/mapToSymbol.R: [ ]
98:                     matrix <- mapresult$data_symbol
15:     if(length(which(inputType %in% c("genelist","network","sbt","sct","matrix")))==0){
16: ...(20 bytes skipped)...put 'inputType' is invalide! Please select an option from 'genelist', 'netwrok', 'sbt', 'sct', and 'matrix'!\n")
78:     if(inputType=="matrix"){
81:             outputFileName <- "matrix_symbol.cct"
88:                 stop("The ids in the input matrix can not be transformed to gene symbols! Please check whether the inut idType is correct!\n")
93:                     stop(paste("Only ",round(mapresult*100),"% ids in the input matrix can be transformed to gene symbols. Please check whether the inut idType is correct!\n",sep=""))
99:                     matrix <- cbind(rownames(matrix),matrix)
100:                     colnames(matrix)[1] <- "GeneSymbol"
101:                     write.table(matrix,file=outputFileName,row.names=F,col.names=T,sep="\t",quote=F)
430:         if(.getClass(inputNetwork)=="data.frame" || .getClass(inputNetwork)=="matrix"){
439:                         inputNetwork <- as.matrix(inputNetwork[,c(1,2)])
450:                     inputNetwork <- as.matrix(inputNetwork)
490: ...(0 bytes skipped)...                    stop("The input network should be from a file or a data object with data.frame, matrix, graphNEL or igraph class. Other types of input are invalid!\n")
650:     inputMat <- as.matrix(inputMat[,2:ncol(inputMat)])
667:             inputMat <- as.matrix(inputMat[idmap[,1],])
tRanslatome:R/EnrichedSets.R: [ ]
119: 		matrix <- matrix(c(-log(as.numeric(pvalList1stlevel), base=10), 
204: 		matrix <- matrix(c(-log(as.numeric(pvalList1stlevel), base=10), 
122: 		print(matrix)
124: 		if ((sum(matrix == 0)) == (nrow(matrix) * ncol(matrix))) {
130: 			radial.plot(matrix, labels=uniquelist, rp.type="p", 
207: 		print(matrix)
209: 		print(dim(matrix))
212: 		if ((sum(matrix == 0)) == (nrow(matrix) * ncol(matrix))) {
217: 			rownames(matrix) <- uniquelist
218: 			colnames(matrix) <- c(label.level.enriched(object)[1], 
220: 			print(matrix)
221: 			heatmap.2(matrix, col = RGBColVec(50)[c(26:50)], key=TRUE, 
celda:R/celdaProbabilityMap.R: [ ]
191:     g1 <- ComplexHeatmap::Heatmap(matrix = samp,
277:         g1 <- ComplexHeatmap::Heatmap(matrix = pop,
210:         g2 <- ComplexHeatmap::Heatmap(matrix = sampNorm,
289:         g2 <- ComplexHeatmap::Heatmap(matrix = popNorm,
316:         g1 <- ComplexHeatmap::Heatmap(matrix = samp,
334:             g2 <- ComplexHeatmap::Heatmap(matrix = sampNorm,
177:     factorized <- factorizeMatrix(x = sce, useAssay = useAssay,
249:     factorized <- factorizeMatrix(x = sce, useAssay = useAssay,
pcaMethods:R/pca.R: [ ]
122:     Matrix <- as.matrix(object[,num])
25: ##' Perform PCA on a numeric matrix for visualisation, information
53: ##' @param object Numerical matrix with (or an object coercible to
56: ##' matrix is used. Can also be a data frame in which case all
125:     Matrix <- t(exprs(object))
127:   Matrix <- as.matrix(object, rownames.force=TRUE)
130:     Matrix <- Matrix[,subset]
135:   if (nPcs > ncol(Matrix)) {
136:     warning("more components than matrix columns requested")
137:     nPcs <- min(dim(Matrix))
139:   if (nPcs > nrow(Matrix)) {
140:     warning("more components than matrix rows requested")
141:     nPcs <- min(dim(Matrix))
144:   if (!checkData(Matrix, verbose=interactive()))
148:   missing <- is.na(Matrix)
162:   prepres <- prep(Matrix, scale=scale, center=center, simple=FALSE, ...)
196:   rownames(res@scores) <- rownames(Matrix)
197:   if(all(dim(loadings(res)) == c(ncol(Matrix), nPcs))) {
199:     rownames(res@loadings) <- colnames(Matrix)
205:   res@nObs <- nrow(Matrix)
206:   res@nVar <- ncol(Matrix)
217:     cObs <- Matrix
219:       cObs[missing] <- fitted(res, Matrix, pre=TRUE, post=TRUE)[missing]
225:     res@cvstat <- Q2(res, Matrix, nruncv=1, ...)
236: ##' @param object Numerical matrix with (or an object coercible to
239: ##' matrix is used.
240: ##' @param method For convenience one can pass a large matrix but only
264:   if ( !checkData(as.matrix(object), verbose=interactive()) )
344: ##' @param Matrix Pre-processed (centered and possibly scaled)
345: ##' numerical matrix samples in rows and variables as columns. No
350: ##' @param verbose Verbose complaints to matrix structure
364: svdPca <- function(Matrix, nPcs=2, 
367:   pcs <- prcomp(Matrix, center=FALSE, scale.=FALSE)
396: ##' @return A matrix with X and Y coordinates for the circle
HiCBricks:R/table_loader_v2.R: [ ]
372:             Matrix <- matrix(data = 0, 
410:         matrix_range <- metrics.list[["extent"]]
32:     Matrix = NULL, group.path = NULL, chrom1 = NULL, chrom2 = NULL,   
36:     real.row.coords <- seq(1,nrow(Matrix),by = 1) + row.offset
37:     real.col.coords <- seq(1,ncol(Matrix),by = 1) + col.offset
38:     Values <- Matrix[cbind(row.pos,col.pos)]
39:     dataset.name <- as.character(Reference.object$hdf.matrix.name)    
42:             Values <- Matrix[cbind(row.pos,col.pos)]  
43:             Matrix[cbind(col.pos,row.pos)] <- Values  
47:             Count <- dim(t(Matrix))
49:                 Name = dataset.name, data = t(Matrix), Start = Start, 
51:             Matrix[is.na(Matrix) | is.infinite(Matrix) | is.nan(Matrix)] <- 0 
56:                 data = rowSums(t(Matrix)))
61:                 data = rowSums(t(Matrix) > 0))    
65:         Count <- dim(Matrix)
67:             Name = dataset.name, data = Matrix, Start = Start,    
69:         Matrix[is.na(Matrix) | is.infinite(Matrix) | is.nan(Matrix)] <- 0 
74:             data = rowSums(Matrix))   
79:             data = rowSums(Matrix > 0))   
83:         Count <- dim(Matrix)
85:             Name = dataset.name, data = Matrix, Start = Start,    
87:         Matrix[is.na(Matrix) | is.infinite(Matrix) | is.nan(Matrix)] <- 0 
92:                 data = rowSums(t(Matrix)))
97:                 data = rowSums(Matrix))
102:                 data = rowSums(t(Matrix) > 0))    
107:                 data = rowSums(Matrix > 0))
111:     if(min(Matrix) < Min | Min == 0){ 
112:         metrics.list[["extent"]][1] <- min(Matrix)
114:     if(max(Matrix) > Max){    
115:         metrics.list[["extent"]][2] <- max(Matrix)
255: # resolution: The resolution of the Hi-C matrix.
257: # matrix_chunk: The chunk of the matrix to process.
268: # matrix should be removed or not.
270: # is_sparse: A binary vector of length 1 specifying if the matrix being loaded
271: # is sparse. Not to be confused with a sparse matrix format, sparse here means
276: .process_tsv <- function(Brick, table_file, delim, resolution, matrix_chunk, 
307:             step = matrix_chunk)
395:             Matrix[cbind(Temp_table_df$chr1, 
399:                 Matrix = Matrix,
413:             as.double(matrix_range),
422:                 name = Reference.object$hdf.matrix.rowSums,
425:                 name = Reference.object$hdf.matrix.coverage,
428:                 name = Reference.object$hdf.matrix.colSums,
431:                 name = Reference.object$hdf.matrix.coverage.t,
438:                 name = Reference.object$hdf.matrix.rowSums,
441:                 name = Reference.object$hdf.matrix.colSums,
444:                 name = Reference.object$hdf.matrix.coverage,
447:                 name = Reference.object$hdf.matrix.coverage.t,
35:     Reference.object <- GenomicMatrix$new()   
280:     Reference.object <- GenomicMatrix$new()
R4RNA:R/io.R: [ ]
86:     matrix <- data.frame(matrix(unlist(cells), ncol = 3, byrow = TRUE))    
87:     i <- as.integer(as.character(matrix[, 1]))
88:     j <- as.integer(as.character(matrix[, 3]))
90:     seq <- paste(matrix[1:width, 2], collapse = "")
canceR:R/geteSet.R: [ ]
82:                     matrix <-rbind.na(colnames(ClinicalData), ClinicalData)
115:                     getInTable(matrix,title)
135:                     AssayData <- as.matrix(apply(AssayData,2 ,function(x) as.numeric(x)))
169:                         #             pData(eSet)[i] <- as.matrix(na.omit(pData(eSet)[i]))
universalmotif:R/create_motif.R: [ ]
614:   matrix <- input
3: #' Create a motif from a set of sequences, a matrix, or generate a random
6: #' @param input `character`, `numeric`, `matrix`,
121: #' mat <- matrix(c(1, 1, 1, 1,
140: #' mat.ppm <- matrix(c(0.1, 0.1, 0.1, 0.1,
351:           out2 <- rbind(out, matrix(0, ncol = ncol(out), nrow = length(missing.lets)))
389:   if (is.matrix(motif)) {
465: #     motif <- matrix(unlist(motif2), ncol = mot_len, byrow = TRUE)
505: #     motif <- matrix(unlist(motif2), ncol = mot_len, byrow = TRUE)
602: #' @describeIn create_motif Create motif from a matrix.
604: setMethod("create_motif", signature(input = "matrix"),
612:     stop("matrix cannot have NA values")
616:   if (!is.null(rownames(matrix)))
617:     matrix <- matrix[order(rownames(matrix)), ]
628:     if (any(!rownames(matrix) %in% alph.deparsed)) {
632:     if (length(alph.deparsed) != nrow(matrix)) {
636:   } else if (is.null(rownames(matrix)) && missing(alphabet))
637:     stop("Please provide the 'alphabet' arg or a matrix with rownames")
638:   else if (all(rownames(matrix) %in% DNA_BASES) &&
639:            missing(alphabet) && nrow(matrix) == 4)
641:   else if (all(rownames(matrix) %in% RNA_BASES) &&
642:            missing(alphabet) && nrow(matrix) == 4)
644:   else if (nrow(matrix) == 20 && missing(alphabet))
646:   else if (all(rownames(matrix) %in% AA_STANDARD2) &&
647:            missing(alphabet) && nrow(matrix) == 20)
649:   else if (!is.null(rownames(matrix)))
650:     alphabet <- collapse_cpp(rownames(matrix))
651:   else if (nrow(matrix) == 4 && missing(alphabet))
654:     alphabet <- collapse_cpp(rownames(matrix))
657:     if (nrow(matrix) != 4) stop("incorrect number of rows")
659:     if (nrow(matrix) != 20) stop("incorrect number of rows")
668:   motif <- matrix
808:   motif <- matrix(unlist(motif), ncol = mot_len, byrow = TRUE)
877:     motif <- matrix(unlist(motif), ncol = mot_len, byrow = TRUE)
347:         out <- consensusMatrix(input)
367:         "DNA" = if (sum(consensusMatrix(motif, baseOnly = TRUE)[5, ]))
369:         "RNA" = if (sum(consensusMatrix(motif, baseOnly = TRUE)[5, ]))
450: #     motif <- consensusMatrix(collapse_cpp(consensus))
494: #       motif <- consensusMatrix(collapse_cpp(consensus))
532: #           if (any(!rownames(consensusMatrix(consensus)) %in%
704:   sequences <- consensusMatrix(sequences, baseOnly = TRUE)
750:   sequences <- consensusMatrix(sequences, baseOnly = TRUE)
798:   sequences <- consensusMatrix(sequences)
858:     sequences <- consensusMatrix(sequences)
869:     sequences <- consensusMatrix(sequences)
PhyloProfile:R/clusterProfile.R: [ ]
99:         matrix <- matrix(0L, nrow = nrow(profiles), ncol = nrow(profiles))
90: getDistanceMatrix <- function(profiles = NULL, method = "mutualInformation") {
96:         distanceMatrix <- stats::dist(profiles, method = method)
1: #' Get data for calculating distance matrix from phylogenetic profiles
7: #' @param profileType type of data used for calculating the distance matrix.
15: #' @return A wide dataframe contains values for calculating distance matrix.
34:     # transform data into wide matrix
59:     # set name for wide matrix as gene IDs
67: #' Calculate the distance matrix
75: #' @return A calculated distance matrix for input phylogenetic profiles.
104:                 matrix[i, j] <- dcor(p_i, unlist(profiles[j,]))
109:         matrix <- 1 - matrix
110:         matrix <- as.data.frame(matrix)
112:         colnames(matrix) <- profileNames[seq_len(length(profileNames)) - 1]
113:         rownames(matrix) <- profileNames
114:         distanceMatrix <- stats::as.dist(matrix)
116:         distanceMatrix <- bioDist::mutualInfo(as.matrix(profiles))
119:         distanceMatrix <-  bioDist::cor.dist(as.matrix(profiles))
124: #' Create a hclust object from the distance matrix
126: #' @param distanceMatrix calculated distance matrix (see ?getDistanceMatrix)
130: #' @return An object class hclust generated based on input distance matrix and
147:     if (is.null(distanceMatrix)) stop("Distance matrix cannot be NULL!")
88: #' getDistanceMatrix(profiles, method)
117:         distanceMatrix <- max(distanceMatrix, na.rm = TRUE) - distanceMatrix
121:     return(distanceMatrix)
134: #' \code{\link{getDistanceMatrix}}, \code{\link{hclust}}
142: #' distanceMatrix <- getDistanceMatrix(profiles, distMethod)
144: #' clusterDataDend(distanceMatrix, clusterMethod)
146: clusterDataDend <- function(distanceMatrix = NULL, clusterMethod = "complete") {
148:     dd.col <- stats::hclust(distanceMatrix, method = clusterMethod)
165: #' distanceMatrix <- getDistanceMatrix(profiles, distMethod)
167: #' dd <- clusterDataDend(distanceMatrix, clusterMethod)
hermes:R/calc_cor.R: [ ]
112:       matrix = mat,
46:     sample_cor_matrix <- stats::cor(chosen_assay, method = method)
10: #' The `correlate()` method can calculate the correlation matrix between the sample vectors of
12: #' of a [`matrix`] with additional quality flags in the slot `flag_data`
32: #' # Calculate the sample correlation matrix.
49:       sample_cor_matrix,
63:   contains = "matrix",
82: #' # Plot the correlation matrix.
110:     mat <- as(object, "matrix")
MotifDb:inst/scripts/import/jaspar/import.R: [ ]
171:     matrix = matrices [[matrix.id]]
57:   matrix.ids = unique (tbl.rmat$id)
61:   for (matrix.id in matrix.ids) {
98:   tbl.matrix =  read.table (file, sep='\t', header=F, as.is=TRUE)
167:   matrix.ids = names (matrices) 
170:   for (matrix.id in matrix.ids) {
47:   file <- file.path(dataDir, 'MATRIX_DATA.txt')
58:   result =  vector ('list', length (matrix.ids))
62:     tbl.sub = subset (tbl.rmat, id == matrix.id)
63:       # sanity check this rather unusual representation of a position count matrix
68:       printf ('matrix.id %s has sequence of length %d', matrix.id, base.count$Freq [1])
74:     m = matrix (nucleotide.counts, byrow=TRUE, nrow=4, dimnames=list(row.names, col.names))
77:     } # for matrix.id
79:   names (result) = matrix.ids
85: #          MATRIX.txt:  9229	CORE	MA0001	1	AGL3
86: #  MATRIX_PROTEIN.txt: 9229	P29383
87: #  MATRIX_SPECIES.txt: 9229	3702
88: #  MATRIX_ANNOTATION.txt: 
97:   file <- file.path(dataDir, "MATRIX.txt")
99:   colnames (tbl.matrix) = c ('id', 'category', 'mID', 'version', 'binder')
101:   file <- file.path(dataDir, "MATRIX_PROTEIN.txt")
105:   file <- file.path(dataDir, "MATRIX_SPECIES.txt")
109:   file <- file.path(dataDir, "MATRIX_ANNOTATION.txt")
132:   tbl.md = merge (tbl.matrix, tbl.species, all.x=TRUE)
172:     stopifnot (length (intersect (matrix.id, tbl.anno$id)) == 1)
173:     tbl.sub = subset (tbl.anno, id==matrix.id)
192:                     sequenceCount=as.integer (mean (colSums (matrix))),
epihet:R/epiMap.R: [ ]
96:     matrix <- value.matrix[seq_len(loci.number), ]
87:     value.matrix <- compare.matrix[compare.matrix$type == value,
1: #' @title Make Pheatmap from Comparison Matrix
4: #' of max standard deviation from the comparison matrix
9: #' @param compare.matrix The comparison matrix generated from
45: #' comp.Matrix<-data.frame(
62: #' row.names = colnames(comp.Matrix)[1:6],stringsAsFactors = FALSE)
64: #' pmap <- epiMap(compare.matrix = comp.Matrix,
74: epiMap <- function(compare.matrix, value, annotate,
88:         -(length(compare.matrix) - 1)]
89:     rownames(value.matrix) <- value.matrix$location
90:     value.matrix <- value.matrix[, -length(value.matrix)]
91:     value.matrix$sd = apply(value.matrix, 1, sd, na.rm = TRUE)
92:     value.matrix <- value.matrix[order(-value.matrix$sd), ]
93:     value.matrix <- value.matrix[, -length(value.matrix)]
94:     loci.number <- floor(loci.percent * nrow(value.matrix))
98:         pmap <- pheatmap::pheatmap(matrix, show_rownames = show.rows,
108:         pmap <- pheatmap::pheatmap(matrix, show_rownames = show.rows,
5: #' generated by compMatrix(). The rows represent the loci
10: #' the compMatrix() function
GeneTonic:R/gs_upset.R: [ ]
241:     matrix = intersection_matrix(
45:     matrix(upgsg, ncol = length(gsg_list), byrow = FALSE)
plotgardener:R/readHic.R: [ ]
420:             matrix = rhic$matrix
16: #'     matrix = "observed",
48: #' @param matrix Character value indicating the type of matrix to output.
49: #' Default value is \code{matrix = "observed"}. Options are:
84:                     zrange = NULL, norm = "KR", matrix = "observed",
401:         upper <- data.frame(matrix(nrow = 0, ncol = 3))
407:     if (rhic$matrix == "logoe") {
408:         rhic$matrix <- "oe"
enhancerHomologSearch:src/ClustalW/multipleAlign/MyersMillerProfileAlign.h: [ ]
60:         int matrix[32][32];
23:         virtual int profileAlign(Alignment* alnPtr, DistMatrix* distMat, 
MotifDb:misc/hocomoco-v11/importV10.R: [ ]
88:     matrix <- matrices[[matrix.id]]
63:   matrix.names <- sapply (pwm.list, function (element) element$title)
80:   matrix.ids = names(matrices)
87:   for (matrix.id in matrix.ids) {
89:     short.matrix.name <- sub("\\..*$", "", matrix.id)
95:     split.matrix.name <- unlist(strsplit(short.matrix.name, "_"))[1]
96:     shorter.matrix.name <- split.matrix.name
10:   rawMatrixList <- readRawMatrices (dataDir)
37:   printf("checking for readable matrix file:")
47:   #loops through all motifs in the matrix file, one motif at a time
62:   matrices = sapply (pwm.list, function (element) element$matrix)
64:   matrix.names <- sub("^> ", "", matrix.names)
65:   names (matrices) <- matrix.names
90:     #stopifnot(length(grep(short.matrix.name, tbl.raw$symbol)) == 1)
91:     #md <- as.list(subset(tbl.raw, symbol==short.matrix.name))
97:     #if (grepl(split.matrix.name, "+")){
98:     #  shorter.matrix.name <- unlist(strsplit(split.matrix.name, "+"))[1]
102:     if (nchar(short.matrix.name) <=9){#!("+" %in% shorter.matrix.name)
103:       idStr <- paste0(shorter.matrix.name, "_HUMAN")
110:     new.row = list (providerName=matrix.id,
111:                     providerId=matrix.id, #"HOCOMOCO v8 and ChiPMunk 3.1"
113:                     geneSymbol=shorter.matrix.name, #md$symbol
119:                     sequenceCount=max(colSums(matrix)),
125:     printf("matrix.id: %s", matrix.id);
127:     full.name = sprintf ('%s-%s-%s', organism, dataSource, matrix.id)
129:   } # for matrix.id
164:   result <- matrix (nrow=4, ncol=cols,
177:   #return (list (title=title, consensus.sequence=consensus.sequence, matrix=result))
178:   return (list (title=title, matrix=result))
11:   matrices <- extractMatrices (rawMatrixList)
HiCDOC:src/constrainedClustering.cpp: [ ]
10:   std::vector<std::vector<T>> matrix;
9: class StdMatrix {
14:   StdMatrix (U &m): matrix(m.nrow(), std::vector<T>(m.ncol())) {
17:         matrix[i] = row;
22:     return matrix.size();
26:     return matrix.front().size();
30:     return matrix[i];
97:   StdMatrix<double> &matrix
105:   for (unsigned int vectorId = 0; vectorId < matrix.nrow(); vectorId++) {
106:     for (size_t i = 0; i < matrix.ncol(); ++i) {
107:       centroids[clusters[vectorId]][i] += matrix.row(vectorId)[i];
159:   StdMatrix<double> &matrix
162:   std::vector<double> distances(matrix.nrow());
163:   centroids[0] = matrix.row(unif_rand() * matrix.nrow());
172:     for (unsigned int vectorId = 0; vectorId < matrix.nrow(); vectorId++) {
174:         matrix.row(vectorId),
180:     for (unsigned int vectorId = 0; vectorId < matrix.nrow(); vectorId++) {
182:       centroids[centroidId] = matrix.row(vectorId);
191:   StdMatrix<double> &matrix,
195:   std::vector<double> medianVector(matrix.ncol());
201:     std::vector<std::vector<double>> linkedVectors(link.size(), std::vector<double>(matrix.ncol(), 0.0));
205:       if (vectorId >= matrix.nrow()) {
210:           std::to_string(matrix.nrow()) +
214:       linkedVectors[i] = matrix.row(vectorId);
230:   StdMatrix<double> &matrix,
243:   initializeCentroids(centroids, matrix);
247:     assignClusters(clusters, centroids, matrix, links);
248:     updateCentroids(centroids, clusters, matrix);
256:   for (unsigned int vectorId = 0; vectorId < matrix.nrow(); vectorId++) {
257:     quality += getDistance(matrix.row(vectorId), centroids[clusters[vectorId]]);
273:     throw std::invalid_argument("Matrix should not contain NAs.");
279:     throw std::invalid_argument("Matrix should not contain NANs.");
285:     throw std::invalid_argument("Matrix should not be empty.");
288:   StdMatrix<double> matrix(rMatrix);
290:   std::vector<int> clusters(matrix.nrow());
291:   std::vector<int> bestClusters(matrix.nrow());
292:   std::vector<std::vector<double>> centroids(totalClusters, std::vector<double>(matrix.ncol(), -1.0));
293:   std::vector<std::vector<double>> bestCentroids(totalClusters, std::vector<double>(matrix.ncol(), -1.0));
300:       matrix, links, clusters, centroids, maxDelta, maxIterations
192:   StdMatrix<int> &links
231:   StdMatrix<int> &links,
264:   NumericMatrix &rMatrix,
265:   IntegerMatrix &rLinks,
272:   if (any(is_na(rMatrix))) {
278:   if (any(is_nan(rMatrix))) {
284:   if (rMatrix.nrow() == 0) {
289:   StdMatrix<int>    links(rLinks);
preprocessCore:src/R_subrcModel_interfaces.c: [ ]
41:   double *matrix;
6:  ** a matrix rcModel fitting
140:      	    residuals[k*ncur_rows + i] = args->matrix[k*args->rows + cur_rows[i]];  
164:   double *matrix=NUMERIC_POINTER(RMatrix);
236:   /* The aim is to try to be as fair as possible in dividing up the matrix */
254:   args[0].matrix = matrix;
336:      	    residuals[k*ncur_rows + i] = matrix[k*rows + cur_rows[i]];  
455:      	    Ymat[k*ncur_rows + i] = args->matrix[k*args->rows + cur_rows[i]];  
484:   double *matrix=NUMERIC_POINTER(RMatrix);
562:   /* The aim is to try to be as fair as possible in dividing up the matrix */
580:   args[0].matrix = matrix;
676:      	    Ymat[k*ncur_rows + i] = matrix[k*rows + cur_rows[i]];  
104:     /* PROTECT(R_weights = allocMatrix(REALSXP,ncur_rows,cols));*/
105:     PROTECT(R_residuals = allocMatrix(REALSXP,ncur_rows,cols));
159: SEXP R_sub_rcModelSummarize_medianpolish(SEXP RMatrix, SEXP R_rowIndexList){
214:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
313:     /* PROTECT(R_weights = allocMatrix(REALSXP,ncur_rows,cols));*/
314:     PROTECT(R_residuals = allocMatrix(REALSXP,ncur_rows,cols));
412:     PROTECT(R_weights = allocMatrix(REALSXP,ncur_rows,cols));
413:     PROTECT(R_residuals = allocMatrix(REALSXP,ncur_rows,cols));
479: SEXP R_sub_rcModelSummarize_plm(SEXP RMatrix, SEXP R_rowIndexList, SEXP PsiCode, SEXP PsiK, SEXP Scales){
540:   PROTECT(dim1 = getAttrib(RMatrix,R_DimSymbol));
642:     PROTECT(R_weights = allocMatrix(REALSXP,ncur_rows,cols));
643:     PROTECT(R_residuals = allocMatrix(REALSXP,ncur_rows,cols));
snpStats:src/gsl_poly.h: [ ]
118:   double * matrix ; 
scRepertoire:R/clusterTCR.R: [ ]
55:         matrix <- as.matrix(stringdistmatrix(dictionary, method = "lv"))    
56:         out_matrix <- matrix(ncol = ncol(matrix), nrow=ncol(matrix))
57:         for (j in seq_len(ncol(matrix))) {
58:             for (k in seq_len(nrow(matrix))) {
60:                     out_matrix[j,k] <- NA
63:                         out_matrix[j,k] <- matrix[j,k]/(max(length[j], length[k]))
64:                         out_matrix[k,j] <- matrix[k,j]/(max(length[j], length[k]))
66:                       out_matrix[j,k] <- matrix[j,k]/((length[j]+ length[k])/2)
67:                       out_matrix[k,j] <- matrix[k,j]/((length[j]+ length[k])/2)
69:         filtered <- which(out_matrix <= (1-threshold), arr.ind = TRUE)
26: #' @importFrom stringdist stringdistmatrix
enhancerHomologSearch:src/ClustalW/pairwise/FullPairwiseAlign.h: [ ]
56:         int matrix[NUMRES][NUMRES];
21:         virtual void pairwiseAlign(Alignment *alignPtr, DistMatrix *distMat, int iStart, 
cisPath:inst/extdata/D3/d3.layout.js: [ ]
166:   chord.matrix = function(x) {
64:       matrix,
88:         x += matrix[i][j];
106:           return sortSubgroups(matrix[i][a], matrix[i][b]);
122:             v = matrix[di][dj],
167:     if (!arguments.length) return matrix;
168:     n = (matrix = x) && matrix.length;
sparseMatrixStats:src/ColumnView.h: [ ]
10:   const dgCMatrixView* matrix;
35:       if(cv != nullptr && cv->matrix->ncol == 0){
41:       int start_pos = cv->matrix->col_ptrs[index];
42:       int end_pos = cv->matrix->col_ptrs[index + 1];
43:       int number_of_zeros = cv->matrix->nrow - (end_pos - start_pos);
44:       VectorSubsetView<REALSXP> values(cv->matrix->values, start_pos, end_pos);
45:       VectorSubsetView<INTSXP> row_indices(cv->matrix->row_indices, start_pos, end_pos);
52:       if(index == cv->matrix->ncol)
66:   ColumnView(dgCMatrixView* matrix_): matrix(matrix_) {}
5: #include "SparseMatrixView.h"
GSVA:inst/shinyApp/server.R: [ ]
12:   matrix <- matrixServer("matrix1")
11:   # DATA MATRIX
62:       result <- gsva(isolate(matrix()),
145:   plot3_Server("plot3", eventData2, rv, matrix, genesets)
163:     if(!is.null(matrix()) && !is.null(genesets())){
pcxn:R/pcxn_explore.R: [ ]
61:             matrix <- pathCor_pathprint_v1.2.3_dframe 
150:     step1_matrix <- as.data.frame(rbind(m1,m2))
164:     step2_matrix <- subset(matrix, Pathway.A %in% interesting_genesets &
168:     step3_matrix <- subset(step2_matrix, abs(PathCor) >= min_abs_corr &
66:             matrix <- pathCor_pathprint_v1.2.3_unadjusted_dframe 
76:             matrix <- pathCor_Hv5.1_dframe
80:             matrix <- pathCor_Hv5.1_unadjusted_dframe 
97:             matrix <- pathCor_CPv5.1_dframe
101:             matrix <- pathCor_CPv5.1_unadjusted_dframe 
118:             matrix <- pathCor_GOBPv5.1_dframe
122:             matrix <- pathCor_GOBPv5.1_unadjusted_dframe 
148:     m1 <- subset(matrix,Pathway.A == query_geneset)
149:     m2 <- subset(matrix,Pathway.B == query_geneset)
151:     top_step1_matrix<- 
152:         (step1_matrix[order(-abs(step1_matrix$PathCor)),])[1:top,]
155:     interesting_genesets <- unique(as.list(c(top_step1_matrix$Pathway.A,
156:                                             top_step1_matrix$Pathway.B)))
158:     # create matrix with geneset groups
172:                 " top correlated genesets, ", dim(step3_matrix)[1],
175:     po = new("pcxn",type = "pcxn_explore", data = as.matrix(step3_matrix),
edge:src/edgeKLODP.c: [ ]
156: double **matrix(int nrl, int nrh, int ncl, int nch) {
178: void free_matrix(double **m, int nrl, int nrh, int ncl, int nch) {
128: int **imatrix(int nrl, int nrh, int ncl, int nch) {
150: void free_imatrix(int **m, int nrl, int nrh, int ncl, int nch) {
127: /* allocate a int matrix with subscript ranges m[nrl...nrh][ncl...nch] */
149: /* free int matrix allocated with imatrix() */
155: /* allocate a double matrix with subscript ranges m[nrl...nrh][ncl...nch] */
177: /* free double matrix allocated with matrix() */
mosbi:src/attr_graph.cpp: [ ]
6: using matrix = std::vector<Row>;
7: using cube = std::vector<matrix>;
9: //' Replace elements of an integer matrix.
11: //' This function replaces all elements of an integer matrix, which are under a 
14: //' @param m A numeric matrix.
16: //' matrix are replaced by zero.
17: //' @return An integer matrix.
20: //' m <- matrix(seq(1:16), nrow=4)
21: //' # m <- matrix(rnorm(10000), nrow=100)
44: //' E.g. if \code{MARGIN="column"}, for each column, a oc-occurance matrix 
49: //' @param m The matrix used for biclustering.
55: //' and each matrix the dimensions of \code{c(nrow(m), 
59: //' m <- matrix(seq(1:16), nrow=4)
60: //' # m <- matrix(rnorm(10000), nrow=100)
107:     // Generate adjacency matrix for the other attribute in this bicluster
26: IntegerMatrix replace_threshold(IntegerMatrix m, int threshold){
27:   IntegerMatrix tmp = m;
31:     IntegerMatrix::Column tmp_c = tmp(_, i);
67:                      const NumericMatrix m, 
92:     out_l.push_back(NumericMatrix(other_size,other_size));
98:     NumericMatrix m2(other_size,other_size);
117:       NumericMatrix tmp_m = out_l[a];
131:         NumericMatrix m3 = out_l[i];
138:         NumericMatrix m3 = out_l[i];
MotifDb:inst/scripts/import/demo/import.R: [ ]
82:     matrix <- matrices[[matrix.id]]
62:   matrix.names <- sapply (pwm.list, function (element) element$title)
79:   matrix.ids = names(matrices)
81:   for (matrix.id in matrix.ids) {
83:     short.matrix.name <- sub("\\..*$", "", matrix.id)
9:   rawMatrixList <- readRawMatrices (dataDir)
36:   printf("checking for readable matrix file:")
61:   matrices = sapply (pwm.list, function (element) element$matrix)
63:   matrix.names <- sub("^>", "", matrix.names)
64:   names (matrices) <- matrix.names
84:     stopifnot(length(grep(short.matrix.name, tbl.raw$ma.name)) == 1)
85:     md <- as.list(subset(tbl.raw, ma.name==short.matrix.name))
88:     new.row = list (providerName=matrix.id,
89:                     providerId=matrix.id,
97:                     sequenceCount=max(colSums(matrix)),
104:     full.name = sprintf ('%s-%s-%s-%s', organism, dataSource, md$gene.symbol, short.matrix.name)
162:   result <- matrix (nrow=4, ncol=cols,
173:   #return (list (title=title, consensus.sequence=consensus.sequence, matrix=result))
174:   return (list (title=title, matrix=result))
10:   matrices <- extractMatrices (rawMatrixList)
metagenomeSeq:R/loadMetaQ.R: [ ]
22: 	matrix <- dat3[,-c(1,len)]
3: #' Load a matrix of OTUs in Qiime's format
21: 	taxa<-as.matrix(taxa);
23: 	colnames(matrix) = subjects;
25: 	rownames(matrix) = otus;
26: 	obj <- list(counts=as.data.frame(matrix), taxa=as.data.frame(taxa),otus = as.data.frame(otus))
LymphoSeq:R/chordDiagramVDJ.R: [ ]
47:         matrix <- as.matrix(as.data.frame.matrix(table))
48:         ribbon.color <- circlize::colorRamp2(range(matrix), c("grey", "black"))
49:         circlize::chordDiagram(matrix, 
51:                                grid.col = c(rep(colors[1], dim(matrix)[1]), rep(colors[2], dim(matrix)[2])),