Output Multimapped reads

55 views
Skip to first unread message

Nikelle Petrillo

unread,
Dec 12, 2017, 3:17:30 PM12/12/17
to rna-star
Is there a way to get STAR to output multimapped reads into a separate fastq file?

Thanks!
Nikelle 

Alexander Dobin

unread,
Dec 14, 2017, 12:30:31 PM12/14/17
to rna-star
Hi Nikelle,

this cannot be done not directly from STAR. You can do it using Picard SamToFastq:
$ samtools view -h -F0x100 Aligned.out.bam | awk 'substr($1,1,1)=="@" || substr($12,6)+0 > 1 {print}'  > a.sam
$ java -jar SamToFastq.jar I=a.sam F=r1.fq F2=r2.fq 

Cheers
Alex

Nikelle Petrillo

unread,
Dec 15, 2017, 1:58:18 PM12/15/17
to rna-...@googlegroups.com
Hi Alex, 

Im having a bit of trouble understanding your code. So, first, it skips all the reads marked as not primary alignments?

Thanks, Nikelle

Alexander Dobin

unread,
Dec 16, 2017, 3:21:30 PM12/16/17
to rna-star
Hi Nikelle,

right, samtools view -h -F0x100 only outputs primary alignments, i.e. one alignment per read.
awk 'substr($1,1,1)=="@" || substr($12,6)+0 > 1 outputs either the header lines (start with @), or those that have the 12th field HI:i:N with N>1 . HI:i:N is 12th field by default, but you may change that with --outSAMattributes option.

Cheers
Alex
Reply all
Reply to author
Forward
0 new messages