How can I calculate query coverage using perl If I have a file like this. I want to calculate it on my own using perl.
Query id, q. start, q. end, gene_id Q.length Calculated_q_coverage
lcl|NZ_CP018664.1_gene_1 1 1149 NZ_CP018664.1_gene_1 1149
lcl|NZ_CP018664.1_gene_2 1 837 NZ_CP018664.1_gene_2 837
lcl|NZ_CP018664.1_gene_3 1 606 NZ_CP018664.1_gene_3 606
lcl|NZ_CP018664.1_gene_4 1 327 NZ_CP018664.1_gene_4 327
lcl|NZ_CP018664.1_gene_5 1 471 NZ_CP018664.1_gene_5 471
lcl|NZ_CP018664.1_gene_6 1 363 NZ_CP018664.1_gene_6 363
lcl|NZ_CP018664.1_gene_7 1 645 NZ_CP018664.1_gene_7 645
I have these 4 fields. Query id, q. start, q. end, gene_id and want to calculate query coverage using perl.
Please use
ADD COMMENT/ADD REPLY
when responding to existing posts to keep threads logically organized. Additional information should be added to the original post by editing it.Also for reference, you should validate (up-vote or accept answers) comments/posts that help with your questions. That shows appreciation for those who help and also provides closure to open threads.
I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
want to calculate query coverage using perl <=== what that mean ? you already have coverage field 5 or you want the same result as field 5 ?
How is coverage defined in your case? Is it q.end-q.start? If so, you can do
extending a little more this;
Why did not you divide it by query length. I could not get the hang of it. Please elaborate.
Because in your example your coverage field = query length ....