Thanks.
I know it can be used for single ends.
$samtools view in.bam | awk '{printf "@%s\n%s\n+\n%s\n", $1,$10,$11}' > single.fastq
But how to do it with paired ends?
Thanks
I have a paired-ends RNA-seq fastq reads and it is too large.
I'd like to create a subset of reads only containing the reads mapping to chrX.
Firstly, I need to map all the reads to chrX.
Then how can I select the mapped reads?
Thanks a lot~~
1) You could map using tophat or bwa.
2) Then extract the mapped reads using samtools. See here - How To Filter Mapped Reads With Samtools
Best
Thanks.
I know it can be used for single ends.
$samtools view in.bam | awk '{printf "@%s\n%s\n+\n%s\n", $1,$10,$11}' > single.fastq
But how to do it with paired ends?
Thanks
For splitting FASTQ per chromosme : Split Fastq File Into Different Files Only Comprising One Chromosome Each
For splitting BAM per chromosome,something like : samtools view -b chr1:100-200 > small.bam
Thanks.
How to format the bam to fastq?
especially for paired ends?
This is a latest thread on this: A: Converting large (compressed and unsorted) BAM files to fastq
Log in to answer this question.
Just as a remark, it's not the best solution to map all your reads only to chrX. As such reads which map "suboptimally" to chrX but better to e.g. chr6 might still get mapped to chrX. An aligner doesn't necessarily find the correct position of a read, just the one best matching.