Be careful about recommending the -i option which edits file in place. It may mess up the file and need someone to repeat the analysis again. In this case making a separate file would be the prudent choice.
Hello everyone, I am using Annovar for variant annotation but as you may know Annovar outputs shows all possible transcripts in a single line such as:
SMPD1:NM_000543:exon3:c.1148A>G:p.N383S,SMPD1:NM_001318087:exon3:c.1148A>G:p.N383S,SMPD1:NM_001318088:exon3:c.227A>G:p.N76S,SMPD1:NM_001007593:exon3:c.1145A>G:p.N382S
Is it possible to annotate variants for each transcript such as:
SMPD1:NM_000543:exon3:c.1148A>G:p.N383S
SMPD1:NM_001318087:exon3:c.1148A>G:p.N383S
SMPD1:NM_001318088:exon3:c.227A>G:p.N76S
SMPD1:NM_001007593:exon3:c.1145A>G:p.N382S
All other columns such as frequency will remain same. We are not using canonical transcripts for each sample and having all possible transcripts in a single row causes some mistakes. An Annovar option or another tool would be a nice solution if there is.
Thank you in advance.
1 answer
Hi,
you can basically use sed command in bash.
sed 's/,/\n/g' your_annovar_file > your_new_annovar_file
This command transfers the changes in the existing file to the new file. So your previous file still exists.
PS. I just modified my answer based on GenoMax suggestion. Thank you for the warning !
the old version
sed '-i s/,/\n/g' your_annovar_file
This command makes changes to the existing file.
Thank you for your answer. Actually, my mistake, I did not mention some details. Annovar output is a CSV file and it has multiple columns. I want to modify base on only one column in this case
You can extract the the column you want from csv file of your annovar result and have them in separate lines for each transcript as follows-
awk -F"," '{print $YOUR_COLUMN}' your_new_annovar_file.csv | sed 's/,/\n/g' >your_result_file
Log in to answer this question.