Merge Kraken2 & Bowtie2 classified reads

Goal: To merge classified reads from Kraken2 output with aligned reads from Bowtie2 output.

I first classified reads using the PlusPFP reference db with Kraken2 which produced 1) a collection of classified read pairs in fastqsanger.gz and 2)a separate collection of unclassified read pairs in fastqsanger.gz. Then, I used the collection of unclassified read pairs from Kraken2 output as my input for Braken2 to perform classification on a custom db created from NCBI (Refseq & GenBank) which produced 1) a collection of aligned BAM datasets, 2) a collection of unaligned reads (R) in fastqsanger.gz, 3) a collection of unaligned reads (L) astqsanger.gz, a collection of aligned reads (R) fastqsanger.gz, and a collection of aligned reads (L) fastqsanger.gz. I will use the unaligned outputs from Bowtie2 to run against other custom databases one at a time. I want to merge all aligned reads to continue with my analysis. What is the best way to accomplish this? I have found several tools and was considering possibly using FastqToSam on the Kraken2 classified read pairs then Merge BAM datasets or bedtools Convert from BAM to FastQ on the Bowtie2 BAM output then a Concatenate tool to append fastq but I am not sure either of these will exactly do what I need. Any ideas?

Hi @Laura_Peirson

Extracting or using all of the fastq data, then concatenating those fastq files is probably the best solution. Most tools will expect fastq as an input – and it sounds like you want to do more with them.

Once you have the data in fastq format, search the tool panel with the keyword “concat” to see the choices. Concatenate multiple datasets is the most flexible but they all work about the same.

Hope this helps! :slight_smile:

Hi jennaj |

  • |

Thank you. I think that is the route I will go. I am just experimenting with running MetaPhlAn on the unclassified reads from my initial Kraken2 run instead of Bowtie2 as I saw the Krakentools: convert kraken report file to MetaPlAn-style.

Best,
Laura