Quantcast
Channel: Post Feed
Viewing all articles
Browse latest Browse all 41826

Can't access individual attributes of tabular outfmt 6 blast output while parsing

$
0
0
Hi ... I'm trying to parse a blast tabular format file (outfmt 6) to access it's individual elements for further manipulation . I need to retrieve the qseqid, qstart, qend, qlen, qseq, sseqid, sstart, send, slen, sseq and pident for each hit and here's the script : blast_qresult=SearchIO.parse('Aegilops_Brachypodium.txt','blast-tab') for i,blast_hit in enumerate(blast_qresult) : for m,blast_hsp in enumerate(blast_hit): for n in range(len(blast_hsp)): print("Query ID: %s"%blast_hit.id)             print("Query start: %s"%blast_hsp[n].query_start)             print("Query end: %s"%blast_hsp[n].query_end)             print("Query seq: %s"%blast_hsp[n].query)             print("Hit ID: %s"%blast_hit[m].id)             print("Hit start: %s"%blast_hsp[n].hit_start)             print("Hit end: %s"%blast_hsp[n].hit_end)             print("Hit seq: %s"%blast_hsp[n].hit)             print("Identity: %s"%blast_hsp[n].ident_pct) Till here it does produce some results , and halts at certain hit throwing this error : builtins.ValueError: Hit 'BRADI2G54940.1' already present in this QueryResult. And when I try to access the other individual values like : print(blast_hsp[n].seq_len) print(blast_hit[m].seq_len) They give these errors respectively : builtins.AttributeError: 'HSP' object has no attribute 'seq_len' builtins.AttributeError: 'Hit' object has no attribute 'seq_len' My questions are : 1. How can I access the ...

Viewing all articles
Browse latest Browse all 41826

Trending Articles