I have a bash script that takes ABI file as input and uses ANNOVAR for annotating the variants. A tab-delimited text file is produced that contains the annotated variants. So everytime the bash script is executed for different ABI files, the number of columns are fixed in the tab-delimited file but the number of rows as well as the individual annotations may vary for each resulting variant.
Attempts so far-->
I have tried to write a bash script that extracts [for the first variant] different fields from the tab-delimited text file, saves it as text file, combines all the resulting text individual files and using AWK script it assigns different variables to each of the fields in the Combined Text File. I have created HTML page using AWK and have used these variables in AWK script to print in respective tags in HTML and it works fine for a file that follows the same pattern in tab-delimited text file. But when a particular field is not present for other annotated results with different pattern, the script prints different fields than the variable it has been assigned for.
So in the above example, the first variant contains the Clinically significant mutation since there is annotation present in the "clinvar" column and thus it needs to be reported in a different section along with other details.
<caption>Combined Text File</caption>
The order of the combined text file is not the same for each variant, hence the report generated for it is not correct.
Since the format of the tab-delimited file is not uniform, is there any way that for each row I can set multiple conditions wherein for example If a specific column [for ex:clinvar] has a value, then print it in between HTML tags and if it is not present, then check for another column [for ex: rsID] and if a value is present then print it in some other HTML tags, and so on for other columns as well!
||Amino Acid Change
In a similar manner, when there is a novel variant wherein the ExonicFunc.refGene column contains "non-synonymous" and there is no value in the snp138 column, then it should print the SIFT_score along with other details in between HTML tags. These are just some of the conditions that are needed, but if anyone can give an idea as to how to go about all this, it will be really helpful!!!
Thank you for reading such a long issue and any help on this problem would be greatly appreciated.