This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to take the subset of fastq reads in one specific chromosome

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~~

rna-seq

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.

2 answers

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?

Log in to answer this question.