I'd like to align some FASTQs to an average mtDNA FASTA file that I have downloaded so I can have the human mtDNA isolated from those FASTQs. For that, I used bowtie2. Can I expect that after running the command bowtie2 -x ref_index -U seq.fastq.gz -S seq.sam
my seq.sam will only contain the DNA that I'm interested in (i.e., Human mtDNA)?
I have this example below from a class in which is supposed that the human DNA is discarded (Opposite of what I want). But I don't understand the roles of the line 3. Is it necessary to filter out undesired DNA?
bowtie2 -p $THREADS -x host_DB -1 $FW_READS -2 $RV_READS --un-conc-gz SAMPLE_host_removed > $STUDY-data.sam
samtools view -bS $STUDY-data.sam > $STUDY-data.bam
samtools view -b -f 12 -F 256 $STUDY-data.bam > $STUDY-data-no-human.bam
samtools sort -n -o $STUDY-sorted-data.bam $STUDY-data-no-human.bam 1>> $REPORTS_DIR/report_stdout.txt
samtools fastq -1 $STUDY-reads-r1.fq -2 $STUDY-reads-r2.fq $STUDY-sorted-data.bam 1>> $REPORTS_DIR/report_stdout.txt