Please give me a grep command to get Gene IDS and TPM values from a stringtie output gtf file
2
0
Entering edit mode
20 months ago
sreelekha ▴ 10

Hi, Could anyone please give me a grep command to get gene_id and respective TPM values from a string tie output file.

My result output file looks like the following

Chr01   StringTie   transcript  133413  134899  1000    -   .   gene_id "STRG.1"; transcript_id "STRG.1.1"; reference_id "mRNA:HanXRQr2_Chr01g0000011"; ref_gene_id "gene:HanXRQr2_Chr01g0000011"; ref_gene_name "HanXRQr2Chr01g0000011"; cov "6.216543"; FPKM "0.818698"; TPM "0.915700"
grep Stringtie awk RNA-seq gtf • 1.2k views
ADD COMMENT
2
Entering edit mode
20 months ago
iraun 6.2k

Hi! And welcome to biostars :). Keep in mind for next time that generally is a good practice to provide some code showing your own efforts to fix the issue. Here a quick solution (not tested):

cut -f 9 your_file | cut -d';' -f1,8 | sed 's/gene_id "//g;s/"; TPM "/,/g;s/"//g'
ADD COMMENT
1
Entering edit mode

Thank you for the code. I will definitely keep in mind your advice.

ADD REPLY
1
Entering edit mode
20 months ago
cut -f 9 in.gtf | awk -F '[; "]+' '{i=1;while(i<=NF) {if($i=="gene_id" || $i=="TPM"){ printf("%s\t",$(i+1));} i++;}printf("\n");}'
ADD COMMENT
0
Entering edit mode

Thank you for the code. I used it to get my result.

ADD REPLY

Login before adding your answer.

Traffic: 1520 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6