#Supplemental Code

####PacBio Processing

#The codes for PacBio processing are mainly from Dr Yu Sun's github repository (https://github.com/LiLabZhaohua/PacBioWorkflow). And these scripts have been used for his another PacBio paper:

Sun, Y.H., Wang, A., Song, C., Shankar, G., Srivastava, R.K., Au, K.F. and Li, X.Z. Single-molecule long-read sequencing reveals a conserved intact long RNA profile in sperm. Nature Communications 12, 1361 (2021)., https://doi.org/10.1038/s41467-021-21524-6

####Stranded RNAseq

#The codes for RANseq analysis are mainly from https://github.com/sunyumail93/PipeRNAseq. These codes have been used for many related works, such as:
1. Ye, X. et al, 2022. Genomic signatures associated with maintenance of genome stability and venom turnover in two parasitoid wasps. Communications 12, 1361, 13, 6417

#bulid index files
ConvertBED12toGTF.sh Ppup.RefSeq.reduced.bed12
RefSeqGTF_NameAdder.sh Ppup.RefSeq.reduced.bed12.gtf Ppup.uniqMatching.txt Ppup.RefSeq.reduced.bed12.geneid.gtf

mkdir STARIndex
STAR --runMode genomeGenerate --genomeDir STARIndex --genomeFastaFiles ../Sequence/Ppup.fa --sjdbGTFfile ../Annotation/Ppup.RefSeq.reduced.bed12.geneid.gtf --sjdbOverhang 100 --genomeSAindexNbases 13

mkdir bowtieIndex
bowtie-build ../Sequence/Ppup.fa bowtieIndex/bowtieIndex

conda install -c bioconda salmon   #Didn't work. 
#I used the binary version from Github salmon release page: https://github.com/COMBINE-lab/salmon/releases
wget "https://github.com/COMBINE-lab/salmon/releases/download/v1.7.0/salmon-1.7.0_linux_x86_64.tar.gz"

salmon index -t ../Sequence/Ppup.RefSeq.reduced.bed12.fa -i SalmonIndex --type puff -k 31 --keepDuplicates

#Run
PipeRNAseq.sh -l Ppuparum.Carcass.Stranded.rep1.RNAseq.R1.fastq.gz -r Ppuparum.Carcass.Stranded.rep1.RNAseq.R2.fastq.gz -g Ppup -p 20
PipeRNAseq.sh -l Ppuparum.Carcass.Stranded.rep2.RNAseq.R1.fastq.gz -r Ppuparum.Carcass.Stranded.rep2.RNAseq.R2.fastq.gz -g Ppup -p 20
PipeRNAseq.sh -l Ppuparum.Carcass.Stranded.rep3.RNAseq.R1.fastq.gz -r Ppuparum.Carcass.Stranded.rep3.RNAseq.R2.fastq.gz -g Ppup -p 20

PipeRNAseq.sh -l Ppuparum.Venom.Stranded.rep1.RNAseq.R1.fastq.gz -r Ppuparum.Venom.Stranded.rep1.RNAseq.R2.fastq.gz -g Ppup -p 20
PipeRNAseq.sh -l Ppuparum.Venom.Stranded.rep2.RNAseq.R1.fastq.gz -r Ppuparum.Venom.Stranded.rep2.RNAseq.R2.fastq.gz -g Ppup -p 20
PipeRNAseq.sh -l Ppuparum.Venom.Stranded.rep3.RNAseq.R1.fastq.gz -r Ppuparum.Venom.Stranded.rep3.RNAseq.R2.fastq.gz -g Ppup -p 20

####Suppa, please find details in https://github.com/comprna/SUPPA.
#SUPPA2 paper: Trincado, J.L., Entizne, J.C., Hysenaj, G. et al. SUPPA2: fast, accurate, and uncertainty-aware differential splicing analysis across multiple conditions. Genome Biol 19, 40 (2018). https://doi.org/10.1186/s13059-018-1417-1

#To generate the events from the GTF file
#The command line to generate local AS events will be of the form:
python /home/yexinhai/Documents/software/SUPPA-master/suppa.py generateEvents -i Ppup.RefSeq.reduced.bed12.geneid.gtf -o Ppup.events -f ioe -e SE SS MX RI FL

#The command to generate the transcript "events" would be of the form:
python /home/yexinhai/Documents/software/SUPPA-master/suppa.py generateEvents -i Ppup.RefSeq.reduced.bed12.geneid.gtf -o Ppup.events -f ioi

awk 'FNR==1 && NR!=1 { while (/^<header>/) getline; } 1 {print}' *.ioe > Ppup.all.events.ioe

#PSI calculation for Transcripts and Events
#PSI per transcript Isoform
python /home/yexinhai/Documents/software/SUPPA-master/suppa.py psiPerIsoform -g Ppup.RefSeq.reduced.bed12.geneid.gtf -e iso_tpm.txt -o psiPerIsoform

#PSI per local event
python /home/yexinhai/Documents/software/SUPPA-master/suppa.py psiPerEvent -i Ppup.all.events.ioe -e iso_tpm.txt -o psiPerEvent


####IsoformSwitchAnalyzeR (https://github.com/kvittingseerup/IsoformSwitchAnalyzeR)
IsoformSwitchAnalyzeR paper: Vitting-Seerup K, Sandelin A. IsoformSwitchAnalyzeR: analysis of changes in genome-wide patterns of alternative splicing and its functional consequences. Bioinformatics. 2019;35(21):4469-4471. doi: 10.1093/bioinformatics/btz247.
