Skip to content

Instantly share code, notes, and snippets.

@gatoravi
Created September 26, 2015 17:51
Show Gist options
  • Save gatoravi/ed52caac2b7f3f12a723 to your computer and use it in GitHub Desktop.
Save gatoravi/ed52caac2b7f3f12a723 to your computer and use it in GitHub Desktop.
Create the test files for 'regtools junctions annotate'
#Generate the FASTA
rm -f test.fa; samtools faidx ../../regtools-test/chr22.fa 22:41475000-41585000 > test.fa
sed "1s/.*/>22/" test.fa > new_test.fa; rm -f test.fa; mv new_test.fa test.fa #fix the header
samtools faidx test.fa
#Generate the GTF
rm -f test.gtf; awk -F"\t" '$4> 41480000 && $5 < 41580000 { OFS = "\t"; $4 = $4 - 41475000 + 1; $5 = $5 - 41475000 + 1; print }' ../../regtools-test/genes_chr22.gtf > test.gtf
#Create the junctions.bed
rm -f test_junctions.bed; awk '$1==22 && $2> 41480000 && $3 < 41580000 { OFS = "\t"; $2=$2 - 41475000 + 1; $3 = $3 - 41475000 + 1; $7=$2; $8=$3; print }' hcc1395_junctions.bed > test_junctions.bed
#Run regtools on these
./regtools junctions annotate test_junctions.bed test.fa test.gtf 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment