Last active
October 7, 2022 02:52
-
-
Save fabiolib/ffb21853e3eb3780150074aeffc54901 to your computer and use it in GitHub Desktop.
Short bash script to convert STAR SJ.out.tab into BED format similar to TopHat junctions.bed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##run from results directory | |
##Output BED file is sorted for indexing and loading into IGV | |
##awk for converting SJ.out.tab to bed12 format | |
##based on code originally published by frymor at http://seqanswers.com/forums/showthread.php?t=62896 | |
for sj in */*SJ.out.tab | |
do | |
echo ${sj} | |
echo "Converting..." | |
awk \ | |
{'if($4=="2") print ""$1"\t"$2-$9-1"\t"$3+$9"\tJUNC000"NR"\t"$8"\t-\t"$2-$9-1"\t"$3+$9"\t255,0,0\t2\t"$9","$9"\t","0,"$3-$2+$9+1; \ | |
else \ | |
if($4=="1") print ""$1"\t"$2-$9-1"\t"$3+$9"\tJUNC000"NR"\t"$8"\t+\t"$2-$9-1"\t"$3+$9"\t0,0,255\t2\t"$9","$9"\t","0,"$3-$2+$9+1'} \ | |
${sj} > ${sj%.*}.bed12 | |
echo "Sorting..." | |
sort -V -o ${sj%.*}.sort.bed ${sj%.*}.bed12 | |
done | |
echo "Complete" |
For my purposes at least, yes. I was using the generated bed file as an input to the dSpliceType tool or to load into IGV.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, did this script work for you?