0

I have the first file with 1099 columns

#rnaseq/SNPID   hg19Location    Gene    TCGA-BH-A0C0-01A        TCGA-A2-A3XY-01A        TCGA-XX-A89A-01A   TCGA-B6-A0I2-01A TCGA-LL-A6FP-01A        TCGA-EW- 
rnaseq  -       ?|100133144     7.8666  9.6884  22.3240 1.8760  2.0161  7.8383  5.3991  0.0857  4.5513  15.4363     15.0035 4.3578  0.6809  2.5364  12.4086 11.5839 

the columns I want to compare starts with column 3

TCGA-BH-A0C0-01A        TCGA-A2-A3XY-01A        TCGA-XX-A89A-01A   TCGA-B6-A0I2-01A TCGA-LL-A6FP-01A        TCGA-EW- 

the second file is 1119 columns

 [1]#SNPID  hg19Location    Gene    AlleleA AlleleB dbSNP   nSample TCGA-AC-A3TN-01A-11D-A227-01    TCGA-V7-A7HQ-01A-11D-A33D-01    TCGA-BH-A18R-01A- 
[2]SNP_A-1780270   chr7:78599583:- MAGI2|ENSG00000187391.13        C       G      rs987435 2236    1_0.002700      1_0.006000      1_0.000300      

the columns I want to compare start with column 8

TCGA-AC-A3TN-01A-11D-A227-01    TCGA-V7-A7HQ-01A-11D-A33D-01    TCGA-BH-A18R-01A-

so that I want to match the columns names in first file to the second file so that the second file will have only the same column names as the first file

so basically I want the same column names in both files

0

Do you want to do it only for one file? Also, are columns separated by something standard, like a tab or a comma? If these are true, the simplest way would probably be too open the files in LibreOffice Calc, set the separator to whatever it is (e.g. tab), and copy the columns that you want from one file to another. If when opening the file with LibreOffice you don't get asked to set a separator, rename the files to .csv first.

  • will I need both to have the same columns names, match the both data file columns – Marwah Soliman Feb 15 '17 at 1:08
  • what I want just the columns not the columns vaules what i mean both have different values under the same column name – Marwah Soliman Feb 15 '17 at 1:10
  • You mean the names of the columns, right? The first line of the file – jackgu1988 Feb 15 '17 at 1:11
  • correct both should have the same column names – Marwah Soliman Feb 15 '17 at 1:13
  • Follow what I said above. Of course you can use a text editor as well, but LibreOffice is harder to make mistakes as columns are more clear. So, open both files, copy the values of the first line that you want from one file to the other and save the file. – jackgu1988 Feb 15 '17 at 1:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.