1
$\begingroup$

I have downloaded harmonised the TCGA-HNSC dataset and extracted it. It has 546 samples in total, so what I see in it are FPKM normalised values. The first column remains the same with 60000 rows and 2 columns that is first column ENSEMBL ID and second column FPKM value.

So now the issue is I want to join all the 546 txt file into one where the first column remains the same and rest 546 column would be joined. I'm using this command:

paste -d " " *txt > merged_file.txt

This is joining the all the data sets as ENSEMBL ID and FPKM value..

But I want 1st column as the ENSEMBLE ID and rest the sample FPKM any suggestion or help would be appreciated

$\endgroup$
2
$\begingroup$

In R:

flist = list.files("*.txt", path=".")
fl = lapply(flist, function(x) read.delim(x, header=F))
m = sapply(fl, function(x) x$V2)
row.names(m) = fl[[1]]$V1
colnames(m) = flist

That will give you an appropriately formatted matrix named m in R, which is probably where you want to continue processing things anyway.

$\endgroup$
1
  • $\begingroup$ Let me try thanks for the quick solution , i was trying shell script based but couldn't able $\endgroup$
    – kcm
    Jan 23 '18 at 11:18

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.