Hi Michael, thanks! But the joine data all appear in 1 column rather than separated columns. Is there a way that I can do to separate them? Thank you !
Sorry if this question is really basic, but I'm at loss of trying to find a simple way to join / merge data of 2 cuffdiff output files
in one of the tracking output file, the columns listed are: (let's call this file 1)
tracking_id condition replicate raw_frags internal_scaled_frags external_scaled_frags FPKM effective_length status
In the other file containing differential gene expression analysis, the columns listed are: (let's call this file 2)
test_id gene_id gene locus sample_1 sample_2 status value_1 value_2 log2(fold_change) test_stat p_value q_value significant
I would like to analyse the data from file 1, however the columns only give the gene ID (ENSG00000xxx) format without the gene name. I would like to have a way to merge the test ID (identical as tracking_id in file 1) and gene_id from file 2 with file 1.
What is the terminal command to do this please? I also need to retain the information and format of the remaining columns of file 1 for further analysis.
I tried the command 'join' However, my joined file contains all the columns from tracking_id to gene_id and rest all merged into a SINGLE column. Is there a way I can stop terminal from doing this please?
2 answers
Best way is to use the R terminal here for. Use the function merge
Check the manual page with:
?merge
Hi Genosa,
You can specify in the join command on which columns you want to join:
join -1 1 -2 2 file1 file2
If you only need selected columns in your output, you can control this by -o (here joining-column, second column of first file and 5th column of second file):
join -1 1 -2 2 -0 0,1.2,2.5 file1 file2
Stackoverflow has a couple of nice examples like this one.
Cheers,
Michael
AFAIK, the standard delimiter of join is a blank space rather than a tab. With -t, you can change it.
Log in to answer this question.
I have never worked with cuffdiff output files,maybe you can use {paste}?