Add double qoutes around transcript_id in gtf file
1
0
Entering edit mode
5.3 years ago
BioBaby ▴ 20

I am trying to add double quotes around transcript_id column in gtf file by following command but did not work

awk '{ if ($0 ~ "transcript_id") print $0; else print $0" transcript_id \"\";"; }' inputfile > outfile

and input file looks like this:

SL3.0ch00       StringTie       transcript      548415  552574  1000    +       .       gene_id STRG.6; transcript_id STRG.6.1; cov 2.472455; FPKM 1.523706; TPM 1.143045;
SL3.0ch00       StringTie       transcript      570552  575378  1000    -       .       gene_id STRG.11; transcript_id STRG.11.2; cov 9.309154; FPKM 5.736975; TPM 4.303733;

please kindly help me out.

RNA-Seq AWK GTF STRINGTie • 1.5k views
ADD COMMENT
0
Entering edit mode

Hello BioBaby ,

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

ADD REPLY
1
Entering edit mode
5.3 years ago

Use sed:

$ sed 's/transcript_id \([^;]\+\)/transcript_id \"\1\"/g' input.gtf > output.gtf

fin swimmer

ADD COMMENT
0
Entering edit mode

thanks finswimmer...it works!

ADD REPLY

Login before adding your answer.

Traffic: 1868 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