Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • frymor
    Senior Member
    • May 2010
    • 151

    junction bed file from STAR

    Hi everybody,

    I am trying to create a junction file from the SJ.out.tab file of the STAR aligner.
    I would like to see only those alignment in there, which have at least 5 reads covering the junction for canonical motives and 8 reads for non-canonical.

    To get the reads I have used the following parameters:
    Code:
    --outFilterType BySJout
    --outSJfilterCountTotalMin 10 8 8 8 
    --outSJfilterReads default: All
    --outSJfilterOverhangMin 30 12 12 12
    --alignSJoverhangMin 8 
    --alignSJDBoverhangMin 5
    --outFilterMultimapNmax 20
    I have than run STAR and modify the SJ.out.tab file in the following way:

    Code:
    awk {'if($4=="2") print "chr"$1"\t"$2-$9"\t"$3+$9"\tJUNC000"NR"\t"$7+$8"\t-\t"$2-$9"\t"$3+$9"\t255,0,0\t2\t"$9","$9"\t","0,"$3-$2+$9; else if($4=="1") print "chr"$1"\t"$2-$9"\t"$3+$9"\tJUNC000"NR"\t"$7+$8"\t+\t"$2-$9"\t"$3+$9"\t0,0,255\t2\t"$9","$9"\t","0,"$3-$2+$9'} $file >> $NEW
    so that I get a bed file structure.

    Code:
    track name="IFM16h_1.bed" description="IFM16h_1.STAR.SJ.out.tab" visibility=2 useScore=1
    chr2L	8082	8227	JUNC0001	26	+	8082	8227	0,0,255	2	35,35	 0,110
    chr2L	8105	8240	JUNC0002	1	+	8105	8240	0,0,255	2	12,12	 0,123
    chr2L	11330	11424	JUNC0003	2	-	11330	11424	255,0,0	2	15,15	 0,79
    But even though I have tried everything to set a threshold for the "score" (the columns 7 and 8 of the original SJ.out.tab file, $7 and $8 in the awk command) greater than 1 I still get the in my junction file.

    I would like to know if there is a way of making sure, that only splice junction with a coverage >=5 (or 8 ) will be in the SJ.out.tab file.

    Does it means that the junctions with a coverage below 5 are annotated junctions? (If I understand the parameters correctly)

    Thanks

    Assa
  • krespim
    Member
    • Jul 2012
    • 49

    #2
    Originally posted by frymor View Post
    Hi everybody,

    I am trying to create a junction file from the SJ.out.tab file of the STAR aligner.
    I would like to see only those alignment in there, which have at least 5 reads covering the junction for canonical motives and 8 reads for non-canonical.

    To get the reads I have used the following parameters:
    Code:
    --outFilterType BySJout
    --outSJfilterCountTotalMin 10 8 8 8 
    --outSJfilterReads default: All
    --outSJfilterOverhangMin 30 12 12 12
    --alignSJoverhangMin 8 
    --alignSJDBoverhangMin 5
    --outFilterMultimapNmax 20
    I have than run STAR and modify the SJ.out.tab file in the following way:

    Code:
    awk {'if($4=="2") print "chr"$1"\t"$2-$9"\t"$3+$9"\tJUNC000"NR"\t"$7+$8"\t-\t"$2-$9"\t"$3+$9"\t255,0,0\t2\t"$9","$9"\t","0,"$3-$2+$9; else if($4=="1") print "chr"$1"\t"$2-$9"\t"$3+$9"\tJUNC000"NR"\t"$7+$8"\t+\t"$2-$9"\t"$3+$9"\t0,0,255\t2\t"$9","$9"\t","0,"$3-$2+$9'} $file >> $NEW
    so that I get a bed file structure.

    Code:
    track name="IFM16h_1.bed" description="IFM16h_1.STAR.SJ.out.tab" visibility=2 useScore=1
    chr2L	8082	8227	JUNC0001	26	+	8082	8227	0,0,255	2	35,35	 0,110
    chr2L	8105	8240	JUNC0002	1	+	8105	8240	0,0,255	2	12,12	 0,123
    chr2L	11330	11424	JUNC0003	2	-	11330	11424	255,0,0	2	15,15	 0,79
    But even though I have tried everything to set a threshold for the "score" (the columns 7 and 8 of the original SJ.out.tab file, $7 and $8 in the awk command) greater than 1 I still get the in my junction file.

    I would like to know if there is a way of making sure, that only splice junction with a coverage >=5 (or 8 ) will be in the SJ.out.tab file.

    Does it means that the junctions with a coverage below 5 are annotated junctions? (If I understand the parameters correctly)

    Thanks

    Assa

    Hi Assa,

    if I understood you properly the issue is that you can't filter out junctions with less than N reads (let's say N = 5) from the junction files. You can do it with awk before the junction file is even created:

    Code:
    awk '{if ($7 > 6) print $0}' $file
    The condition {if ($5 > 6) print $0}' can be modified to include all sort of things, including the type site (canonical vs non-canonical)

    Code:
    awk '{if ($7 > 6 & $5 == 0) print $0}' $file
    and variations of thereof. Also be careful that the SJ.out.tab is one-based and bed files are zero based. So in the output of your awk command the 3' of the 1st exon is actually the first 5' base of the intron. See this for a better explanation.

    Comment

    Latest Articles

    Collapse

    • SEQadmin2
      Nine Things a Sample Prep Scientist Thinks About Before Sequencing
      by SEQadmin2


      I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

      Here are nine questions we think about, in roughly the order they matter, before...
      06-18-2026, 07:11 AM
    • SEQadmin2
      From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
      by SEQadmin2


      Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


      The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
      ...
      06-02-2026, 10:05 AM

    ad_right_rmr

    Collapse

    News

    Collapse

    Topics Statistics Last Post
    Started by SEQadmin2, 06-26-2026, 11:10 AM
    0 responses
    10 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-17-2026, 06:09 AM
    0 responses
    45 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-09-2026, 11:58 AM
    0 responses
    105 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 06-05-2026, 10:09 AM
    0 responses
    125 views
    0 reactions
    Last Post SEQadmin2  
    Working...