Convert Galaxy MegaBlast Output to MEGAN Format

I have run a MegaBlast alignment on Galaxy of an NCBI SRA dataset and now want to bring it into MEGAN to analyze further.

Galaxy NGS Mapping MegaBlast produces a 13 column tabular file of hits. Each hit has a gi number associated with it.

"Output of this tool contains 13 columns delimited by Tabs:

  1. Id of your sequence
  2. GI of the database hit
  3. Length of the database hit
  4. % identity
  5. Alignment length
  6. mismatches

  7. gaps

  8. Start position in your sequence
  9. End position in your sequence
  10. Start position in database hit
  11. End position in database hit
  12. E-value
  13. Bit score"

How would I take this dataset and convert it into a format that MEGAN can use? I have tried to import into MEGAN as a text file, but I get errors

Execute failed: java.io.IOException: File not a BLASTX file in text format:
Execute failed: java.io.IOException: File not a BLASTN file in text format:

Or

As BlastTab

Execute failed: java.io.IOException: Too many errors

Is there a way to convert this file to a format that MEGAN can use?

MEGAN only supports “-m 8” tabular format, which has the following 12 tab separated fields:

1 Query The query sequence id string
2 Subject The matching subject sequence id string
3 percent identity
4 alignment length
5 number of mismatches
6 number of gap openings
7 query start
8 query end
9 subject start
10 subject end
11 e-value
12 bit score

So you need to massage your files accordingly.