Hello,
I'm trying to save de unmapped reads from STAR aligner and I have some issues.
I would like to save the unmapped reads in a different output file. According to STAR Manual it's possible to save the unmapped reads using -outSAMunmapped Within parameter. Then the unmapped reads will be saved within Alignment.out.sam
I also tried the --outReadsUnmapped Fastx parameter and got Unmapped.out.mate1 and Unmapped.out.mate2. However I didn't understand how can I handle with these files.
I'm not sure about the results and I would like to know if exists another way to perform it.
Could anyone please let me know how to do this?
Thank you in advance
Hey Your question is exactly what I'm looking for I also tried the --outReadsUnmapped Fastx parameter and got Unmapped.out.mate1 , Unmapped.out.mate2.... until Unmapped.out.mate6 Can you tell me if it's right to use it? And why was it divided into 6 files?
Do you know any other way to extract the unmapped reads from STAR ?
Thanks in advance
What's wrong with
samtools view -hf 4 Aligned.sortedByCoord.out.bam > unmapped.bam
. That's bam format, but you can change that to fastq easily enough.thx, I tried what you said but I got an error : "open: No such file or directory [main_samview] fail to open "Aligned.sortedByCoord.out.bam" for reading."
P.S. my file is Alignment.out.sam
Okay... what happens when you run that command line using the name of your file? And why are you keeping giant sam files around instead of bam files?
error: "[bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). [main_samview] fail to read the header from "Aligned.out.sam"."
As for the sam file, I do not know STAR well and just wrote the commands I saw in the manual