STAR alignment

681 views
Skip to first unread message

Ehsan Hajiramezanali

unread,
Aug 16, 2016, 6:38:24 PM8/16/16
to rna-star
Hi

I want to use STAR for alignment and I have the following requirements:

1- Can we tune STAR in which for the single end, first n bp only allowed m mismatch?
2- Can we use STAR without the junction alignment?

I wonder if you could help me with these.

Thanks in advance.
Best regards,
Ehsan

Alexander Dobin

unread,
Aug 17, 2016, 12:23:56 PM8/17/16
to rna-star
Hi Ehsan,

>>>1- Can we tune STAR in which for the single end, first n bp only allowed m mismatch?
No, this is not possible.

>>>2- Can we use STAR without the junction alignment?
Yes, with --alignIntronMax 1 at the mapping step and no GTF at the genome generation step.

Cheers
Alex

Ehsan Hajiramezanali

unread,
Aug 17, 2016, 11:04:37 PM8/17/16
to rna-star
Thank you for the kind reply.


>>>1- Can we tune STAR in which for the single end, first n bp only allowed m mismatch?
No, this is not possible.

Can we tune STAR in which for a single end only m mismatch allowed?

Alexander Dobin

unread,
Aug 18, 2016, 12:29:01 PM8/18/16
to rna-star
Hi Ehsan,

if you have single-end reads, you can control the number of mismatches with --outFilterMismatchNmax (10 by default).
Note, that by default STAR will do soft-clipping, and soft-clipped bases are not counted as mismatches.
If you want end-to-end alignments, you would need to use --alignEndsType EndToEnd .

For PE reads, you can only control the total number of mismatches for the whole read (with the same parameter), not for each end separately.

Cheers
Alex

Ehsan Hajiramezanali

unread,
Aug 20, 2016, 4:59:12 PM8/20/16
to rna-...@googlegroups.com
Thank you very much for the help.

- Is there any way to get the unmapped reads as a separate output in STAR?

- Do you have any suggestion for the number of mismatches for small reads? The default is 10 and it is not proper.

Ehsan Hajiramezanali

unread,
Aug 21, 2016, 11:39:32 AM8/21/16
to rna-star
>>>2- Can we use STAR without the junction alignment?
Yes, with --alignIntronMax 1 at the mapping step and no GTF at the genome generation step.

I created the following example and test --alignIntronMax 1, but I have another conclusion. Based on my example,  by setting --alignIntronMax as 1, STAR will allow junction alignment. Would you please let me know I am in a right track?

~~~

#!/usr/bin/env bash

# vim: set noexpandtab tabstop=2:


tmpdir=$(mktemp -d)


ref=GCACTGTCCGCCAGCCGGTGGATGTGCGGCAACAACATGTCCGCTCCGA

query=${ref:0:14}${ref:20}


ref_fa=$tmpdir/ref.fa

query_fa=$tmpdir/query.fa


cat > "$ref_fa" <<EOF 

>chr

$ref

EOF


cat > "$query_fa" <<EOF 

>seq

$query

EOF


cd "$tmpdir"

mkdir -p genomeDir

source trapdebug.sh

STAR --runMode genomeGenerate --genomeDir genomeDir --genomeFastaFiles "$ref_fa"


outdir1=$tmpdir/outdir1

mkdir -p "$outdir1"

cd "$outdir1"

STAR --genomeDir "$tmpdir/genomeDir" --readFilesIn "$query_fa"


outdir2=$tmpdir/outdir2

mkdir -p "$outdir2"

cd "$outdir2"

STAR --genomeDir "$tmpdir/genomeDir" --readFilesIn "$query_fa" --alignIntronMax 1


function filter {

grep 'Uniquely mapped reads number'

}


diff <(filter < "$outdir1"/Log.final.out) <(filter < "$outdir2"/Log.final.out)

~~~


>>>


~~~

bash> diff <(filter < "$outdir1"/Log.final.out) <(filter < "$outdir2"/Log.final.out)

1c1

<                    Uniquely mapped reads number | 0

---

>                    Uniquely mapped reads number | 1

~~~

Ehsan Hajiramezanali

unread,
Aug 21, 2016, 12:04:29 PM8/21/16
to rna-star
Thanks Alex,

Would you please let me know that two options --outFilterMismatchNoverLmax and --outFilterMismatchNmax have a same meaning?


On Thursday, August 18, 2016 at 11:29:01 AM UTC-5, Alexander Dobin wrote:

Alexander Dobin

unread,
Aug 22, 2016, 4:25:47 PM8/22/16
to rna-star
Hi Ehsan,

to get unmapped reads as fasta(q) file: --outReadsUnmapped Fastx

--outFilterMismatchNmax is the max number of mismatches, while --outFilterMismatchNoverLmax is the max ratio of the number of mismatches to the mapped length

It looks like in your example the read could be mapped with splicing (look for N in the CIGAR), but when splicing is prohibited. no good (unspliced) alignment is found.

Cheers
Alex

Ehsan Hajiramezanali

unread,
Aug 22, 2016, 5:20:03 PM8/22/16
to rna-star
Hi Alex,

Thank you so much to help.

I got my answers about the first two questions, but I am not sure about the third one  


It looks like in your example the read could be mapped with splicing (look for N in the CIGAR), but when splicing is prohibited. no good (unspliced) alignment is found.

Based on my example, I should set  --alignIntronMax (as default) to unspliced alignment and splicing will be prohibited. And --alignIntronMax 1 is for spliced alignment.
Is it correct? 
Actually, I want to do non-spliced alignment and I am searching for this option.

Alexander Dobin

unread,
Aug 24, 2016, 5:18:58 PM8/24/16
to rna-star
Hi Ehsan,

if you set --alignIntronMax 1 , the splicing will be prohibited - i.e. no spliced alignments will be output.
For some reads, this will result in other (non-spliced) alignments reported, often soft-clipped, and for some reads - in complete loss of alignments.

Cheers
Alex
Reply all
Reply to author
Forward
0 new messages