How to count specific columns and merge with unique ones?
Hi. I am not sure the title gives an optimal description of what I want to do.
I have several text files that contain data in many columns. All the files are organized the same way, but the data in the columns might differ. I want to count the number of times data occur in specific columns, sort the output and make a new file. However, I want check several files for the occurrence of the same data.
First I made a modification to the files, individually (any better way?) to make the file name occur in the first column:
Then I extracted the columns of interest and sorted them and made a new file:
The output.txt file could look like this:
Now, I want to count the number of times column 2 and column 3 are identical for every line and keep the first column information in the output file, separated by comma or similar. I want to result to be like this:
It would be good (but not a requirement) to have the last column in the final file to be sorted, lane1, lane2, lane3 etc. The lane* can also be separated by columns if that is easier.
So far I have tried to use:
However, I am not able to get the column data merged in the final output file. How should I go about to do that?
-James
Last edited by JamesT; 08-07-2012 at 08:52 AM..
Reason: Made a mistake in the first code
Hi all,
im a linux newbie, plz help!
I have a file -
box
--------
Fox-2
--------
UF29
zip42
--------
zf-CW
SNF2_N
Heli_Z
--------
Fox
--------
Kel_1
box (3 Replies)
Hi,
I have a requirement to remove certain spaces from a table of information, but I'm unsure where to start.
A typical table will be like this:
ABCDE 1 Elton John 25 12 15 9 3
ABCDE 2 Oasis 29 13 4 6 9
ABCDE 3 The Rolling Stones 55 19 3 8 6The goal is to remove only the spaces between... (11 Replies)
Hi, this is about sorting a very large file (like 10 gb) to keep lines with unique entries across SOME of the columns.
The line originally looked like this:
sort -u -k2,2 -k3,3n -k4,4n -k5,5n -k6,6n file_unsorted > file_sorted
please note the -u flag.
The problem is that this single... (4 Replies)
Hi everyone,
I have a file result.txt with records as following and another file mirna.txt with a list of miRNAs e.g. miR22, miR123, miR13 etc.
Gene Transcript miRNA
Gar Nm_111233 miR22
Gar Nm_123440 miR22
Gar Nm_129939 miR22
Hel Nm_233900 miR13
Hel ... (6 Replies)
Hi, I have tab-deliminated data similar to the following:
dot is-big 2
dot is-round 3
dot is-gray 4
cat is-big 3
hot in-summer 5
I want to count the frequency of each individual "unique" value in the 1st column. Thus, the desired output would be as follows:
dot 3
cat 1
hot 1
is... (5 Replies)
Hello,
I have two tab delimited text files. Both files have the same number of rows but not necessarily the same number of columns. The column headers look like,
File 1:
f0order CVorder Name f0 RI_9 E99 E199 E299 E399 E499 E599 E699 E799 E899 E999
File 2:... (9 Replies)
Dear community, I am facing a problem and I kindly ask your help:
I have 4 different data sets consisted from 3 different types of array.
On each file, column 1 is chromosome position, column 2 is SNP id etc... Lets say I have the following (bim) datasets:
x2014:
1 rs3094315... (4 Replies)
Discussion started by: fondan
4 Replies
LEARN ABOUT MOJAVE
mpsmatrixdescriptor
MPSMatrixDescriptor(3) MetalPerformanceShaders.framework MPSMatrixDescriptor(3)NAME
MPSMatrixDescriptor
SYNOPSIS
#import <MPSMatrixTypes.h>
Inherits NSObject.
Class Methods
(__nonnull instancetype) + matrixDescriptorWithDimensions:columns:rowBytes:dataType:
(__nonnull instancetype) + matrixDescriptorWithRows:columns:rowBytes:dataType:
(__nonnull instancetype) + matrixDescriptorWithRows:columns:matrices:rowBytes:matrixBytes:dataType:
(size_t) + rowBytesFromColumns:dataType:
(size_t) + rowBytesForColumns:dataType:
Properties
NSUInteger rows
NSUInteger columns
NSUInteger matrices
MPSDataType dataType
NSUInteger rowBytes
NSUInteger matrixBytes
Detailed Description
This depends on Metal.framework
A MPSMatrixDescriptor describes the sizes, strides, and data type of a an array of 2-dimensional matrices. All storage is assumed to be in
'matrix-major'. See the description for MPSMatrix for further details.
Method Documentation
+ (__nonnull instancetype) matrixDescriptorWithDimensions: (NSUInteger) rows(NSUInteger) columns(NSUInteger) rowBytes(MPSDataType) dataType
Create a MPSMatrixDescriptor with the specified dimensions and data type.
Parameters:
rows The number of rows of the matrix.
columns The number of columns of the matrix.
rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size.
dataType The type of the data to be stored in the matrix.
For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix
class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class. The number of
matrices described is initialized to 1.
+ (__nonnull instancetype) matrixDescriptorWithRows: (NSUInteger) rows(NSUInteger) columns(NSUInteger) matrices(NSUInteger)
rowBytes(NSUInteger) matrixBytes(MPSDataType) dataType
Create a MPSMatrixDescriptor with the specified dimensions and data type.
Parameters:
rows The number of rows of a single matrix.
columns The number of columns of a single matrix.
matrices The number of matrices in the MPSMatrix object.
rowBytes The number of bytes between starting elements of consecutive rows. Must be a multiple of the element size.
matrixBytes The number of bytes between starting elements of consecutive matrices. Must be a multiple of rowBytes.
dataType The type of the data to be stored in the matrix.
For performance considerations the optimal row stride may not necessarily be equal to the number of columns in the matrix. The MPSMatrix
class provides a method which may be used to determine this value, see the rowBytesForColumns API in the MPSMatrix class.
+ (__nonnull instancetype) matrixDescriptorWithRows: (NSUInteger) rows(NSUInteger) columns(NSUInteger) rowBytes(MPSDataType) dataType
+ (size_t) rowBytesForColumns: (NSUInteger) columns(MPSDataType) dataType
+ (size_t) rowBytesFromColumns: (NSUInteger) columns(MPSDataType) dataType
Return the recommended row stride, in bytes, for a given number of columns.
Parameters:
columns The number of columns in the matrix for which the recommended row stride, in bytes, is to be determined.
dataType The type of matrix data values.
To achieve best performance the optimal stride between rows of a matrix is not necessarily equivalent to the number of columns. This method
returns the row stride, in bytes, which gives best performance for a given number of columns. Using this row stride to construct your array
is recommended, but not required (provided that the stride used is still large enough to allocate a full row of data).
Property Documentation
- columns [read], [write], [nonatomic], [assign]
The number of columns in a matrix.
- dataType [read], [write], [nonatomic], [assign]
The type of the data which makes up the values of the matrix.
- matrices [read], [nonatomic], [assign]
The number of matrices.
- matrixBytes [read], [nonatomic], [assign]
The stride, in bytes, between corresponding elements of consecutive matrices. Must be a multiple of rowBytes.
- rowBytes [read], [write], [nonatomic], [assign]
The stride, in bytes, between corresponding elements of consecutive rows. Must be a multiple of the element size.
- rows [read], [write], [nonatomic], [assign]
The number of rows in a matrix.
Author
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Version MetalPerformanceShaders-100 Thu Feb 8 2018 MPSMatrixDescriptor(3)