Question: (Closed) blast alignemnt query coverage using perl
0
gravatar for sharmatina189059
20 months ago by
United States
sharmatina18905930 wrote:

Dear all I need to calculate query coverage using perl, for which I wrote my own code in perl as well as used -outfmt "6 std qcovs. my perl code is

#!/usr/bin/perl -w
use warnings;
use strict;
my $filename = 'gene_length_u';
my @fields;
open (FH, $filename);
#my $n = 0;
while ( <FH> ) {
 chomp;
 my @fields = split('\t', $_);
#print "$fields[0]\n";
#print "$fields[1]\n";
#print "$fields[2]\n";
#print "$fields[3]\n";
 print "$_";
#$n = $n+1;
#print "\n my line number $n \n";
 my $p = ($fields[2] - $fields[1])+1;
 my $q = $p/$fields[5] * 100;
 print "\t\t$q\n";
}
#foreach (<$filename>){
#print "$_";
#}
close FH;
exit;

Why I am getting different query coverage. I have calculated sequence length using infoseq and I have file (input ) like this.

gene_id                                gene_start  gene_end  gene_id                gene_length
lcl|NZ_CP018664.1_gene_1121 1   303     NZ_CP018664.1_gene_1121 303
lcl|NZ_CP018664.1_gene_1122 1   1053        NZ_CP018664.1_gene_1122 1053
lcl|NZ_CP018664.1_gene_1123 1   768     NZ_CP018664.1_gene_1123 768
lcl|NZ_CP018664.1_gene_1124 1   1698        NZ_CP018664.1_gene_1124 1698
lcl|NZ_CP018664.1_gene_1125 1   657     NZ_CP018664.1_gene_1125 657
blast • 420 views
ADD COMMENTlink modified 20 months ago by WouterDeCoster38k • written 20 months ago by sharmatina18905930

Hello sharmatina189059!

Questions similar to yours can already be found at:

We have closed your question to allow us to keep similar content in the same thread.

If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.

Cheers!

ADD REPLYlink written 20 months ago by WouterDeCoster38k

I added (code) 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:

101010 Button

ADD REPLYlink written 20 months ago by WouterDeCoster38k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2029 users visited in the last hour