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?