Use ShortStack (Axtell 2013; Shahid and Axtell 2014; Johnson et al. 2016)to perform alignment of sRNAseq data and annotation of sRNA-producing genes.
This is the same ShortStack analysis as seen in 13.1-Pmea-sRNAseq-ShortStack-R1-reads.Rmd, but this analysis uses a customized miRBase database, created by Jill Ashley, which includes published cnidarian miRNAs:
The P.meandrina genome will be used as the reference genome.
Inputs:
Requires trimmed sRNAseq files generated by 08.1-Pmea-sRNAseq-trimming-R1-only.Rmd
*fastp-R1-31bp-auto_adapters-polyG.fq.gz
P.meandrina genome FastA. See 12-Pmea-sRNAseq-MirMachine.Rmd for download info if needed.
Outputs:
Software requirements:
Replace with name of your ShortStack environment and the path to the corresponding conda installation (find this after you’ve activated the environment).
E.g.
# Activate environment
conda activate ShortStack4_env
# Find conda path
which conda
shortstack_conda_env_name <- c("ShortStack-4.0.3_env")
shortstack_cond_path <- c("/home/sam/programs/mambaforge/condabin/conda")
This allows usage of Bash variables across R Markdown chunks.
{
echo "#### Assign Variables ####"
echo ""
echo "# Trimmed FastQ naming pattern"
echo "export trimmed_fastqs_pattern='*fastp-R1-31bp-auto_adapters-polyG.fq.gz'"
echo "# Data directories"
echo 'export deep_dive_dir=/home/shared/8TB_HDD_01/sam/gitrepos/deep-dive'
echo 'export deep_dive_data_dir="${deep_dive_dir}/data"'
echo 'export output_dir_top=${deep_dive_dir}/F-Pmea/output/13.1.1-Pmea-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase'
echo 'export trimmed_fastqs_dir="${deep_dive_dir}/F-Pmea/output/08.1-Pmea-sRNAseq-trimming-R1-only/trimmed-reads"'
echo ""
echo "# Input/Output files"
echo 'export genome_fasta_dir=${deep_dive_dir}/F-Pmea/data'
echo 'export genome_fasta_name="Pocillopora_meandrina_HIv1.assembly.fasta"'
echo 'export shortstack_genome_fasta_name="Pocillopora_meandrina_HIv1.assembly.fa"'
echo 'export mirbase_mature_fasta_version=cnidarian_miRNAs.fasta'
echo 'export genome_fasta="${genome_fasta_dir}/${shortstack_genome_fasta_name}"'
echo ""
echo "# Set number of CPUs to use"
echo 'export threads=46'
echo ""
echo "# Initialize arrays"
echo 'export trimmed_fastqs_array=()'
} > .bashvars
cat .bashvars
#### Assign Variables ####
# Trimmed FastQ naming pattern
export trimmed_fastqs_pattern='*fastp-R1-31bp-auto_adapters-polyG.fq.gz'
# Data directories
export deep_dive_dir=/home/shared/8TB_HDD_01/sam/gitrepos/deep-dive
export deep_dive_data_dir="${deep_dive_dir}/data"
export output_dir_top=${deep_dive_dir}/F-Pmea/output/13.1.1-Pmea-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase
export trimmed_fastqs_dir="${deep_dive_dir}/F-Pmea/output/08.1-Pmea-sRNAseq-trimming-R1-only/trimmed-reads"
# Input/Output files
export genome_fasta_dir=${deep_dive_dir}/F-Pmea/data
export genome_fasta_name="Pocillopora_meandrina_HIv1.assembly.fasta"
export shortstack_genome_fasta_name="Pocillopora_meandrina_HIv1.assembly.fa"
export mirbase_mature_fasta_version=cnidarian_miRNAs.fasta
export genome_fasta="${genome_fasta_dir}/${shortstack_genome_fasta_name}"
# Set number of CPUs to use
export threads=46
# Initialize arrays
export trimmed_fastqs_array=()
If this is successful, the first line of output should show that the Python being used is the one in your [ShortStack](https://github.com/MikeAxtell/ShortStack conda environment path.
E.g.
python: /home/sam/programs/mambaforge/envs/mirmachine_env/bin/python
use_condaenv(condaenv = shortstack_conda_env_name, conda = shortstack_cond_path)
# Check successful env loading
py_config()
python: /home/sam/programs/mambaforge/envs/ShortStack-4.0.3_env/bin/python
libpython: /home/sam/programs/mambaforge/envs/ShortStack-4.0.3_env/lib/libpython3.10.so
pythonhome: /home/sam/programs/mambaforge/envs/ShortStack-4.0.3_env:/home/sam/programs/mambaforge/envs/ShortStack-4.0.3_env
version: 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0]
numpy: /home/sam/programs/mambaforge/envs/ShortStack-4.0.3_env/lib/python3.10/site-packages/numpy
numpy_version: 1.26.4
NOTE: Python version was forced by use_python() function
# Load bash variables into memory
source .bashvars
# Check for FastA file first
# Then create rename file if doesn't exist
if [ -f "${genome_fasta_dir}/${shortstack_genome_fasta_name}" ]; then
echo "${genome_fasta_dir}/${shortstack_genome_fasta_name} already exists. Nothing to do."
echo ""
else
# Copy genome FastA to ShortStack-compatible filename (ending with .fa)
cp ${genome_fasta_dir}/${genome_fasta_name} ${genome_fasta_dir}/${shortstack_genome_fasta_name}
fi
# Confirm
ls -lh ${genome_fasta_dir}/${shortstack_genome_fasta_name}
/home/shared/8TB_HDD_01/sam/gitrepos/deep-dive/F-Pmea/data/Pocillopora_meandrina_HIv1.assembly.fa already exists. Nothing to do.
-rw-r--r-- 1 sam sam 360M Feb 16 10:28 /home/shared/8TB_HDD_01/sam/gitrepos/deep-dive/F-Pmea/data/Pocillopora_meandrina_HIv1.assembly.fa
Uses the --dn_mirna
option to identify miRNAs in the genome, without relying on the --known_miRNAs
.
This part of the code redirects the output of time
to the end of shortstack.log
file.
; } \ 2>> ${output_dir_top}/shortstack.log
# Load bash variables into memory
source .bashvars
# Make output directory, if it doesn't exist
mkdir --parents "${output_dir_top}"
# Create array of trimmed FastQs
trimmed_fastqs_array=(${trimmed_fastqs_dir}/${trimmed_fastqs_pattern})
# Pass array contents to new variable as space-delimited list
trimmed_fastqs_list=$(echo "${trimmed_fastqs_array[*]}")
###### Run ShortStack ######
{ time \
ShortStack \
--genomefile "${genome_fasta}" \
--readfile ${trimmed_fastqs_list} \
--known_miRNAs ${deep_dive_data_dir}/${mirbase_mature_fasta_version} \
--dn_mirna \
--threads ${threads} \
--outdir ${output_dir_top}/ShortStack_out \
&> ${output_dir_top}/shortstack.log ; } \
2>> ${output_dir_top}/shortstack.log
# Load bash variables into memory
source .bashvars
tail -n 3 ${output_dir_top}/shortstack.log \
| grep "real" \
| awk '{print "ShortStack runtime:" "\t" $2}'
ShortStack runtime: 49m15.895s
# Load bash variables into memory
source .bashvars
tail -n 25 ${output_dir_top}/shortstack.log
Writing final files
Found a total of 36 MIRNA loci
Non-MIRNA loci by DicerCall:
N 7713
23 37
22 31
24 14
21 9
Creating visualizations of microRNA loci with strucVis
<<< WARNING >>>
Do not rely on these results alone to annotate new MIRNA loci!
The false positive rate for de novo MIRNA identification is low, but NOT ZERO
Insepct each mirna locus, especially the strucVis output, and see
https://doi.org/10.1105/tpc.17.00851 , https://doi.org/10.1093/nar/gky1141
Fri 16 Feb 2024 13:39:56 -0800 PST
Run Completed!
real 49m15.895s
user 919m37.072s
sys 320m22.844s
ShortStack identified 36 miRNAs.
Results.txt
# Load bash variables into memory
source .bashvars
head ${output_dir_top}/ShortStack_out/Results.txt
echo ""
echo "----------------------------------------------------------"
echo ""
echo "Nummber of potential loci:"
awk '(NR>1)' ${output_dir_top}/ShortStack_out/Results.txt | wc -l
Locus Name Chrom Start End Length Reads DistinctSequences FracTop Strand MajorRNA MajorRNAReads Short Long 21 22 23 24 DicerCall MIRNA known_miRNAs
Pocillopora_meandrina_HIv1___Sc0000000:9092-9521 Cluster_1 Pocillopora_meandrina_HIv1___Sc0000000 9092 9521 430 11202 411 0.9999107302267453 + GGGGGUAUAGCUCAGUGGUAGA 3782 1923 3712 696 4266 173 432 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:53578-53997 Cluster_2 Pocillopora_meandrina_HIv1___Sc0000000 53578 53997 420 439 30 0.9977220956719818 + GCCUAAGUUGCUUGGAACA 141 437 2 0 0 0 0 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:150243-150718 Cluster_3 Pocillopora_meandrina_HIv1___Sc0000000 150243 150718 476 2664 283 0.0007507507507507507 - UGGCUAUGAUGAAAAUGACU 327 1005 356 629 369 138 167 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:173728-174150 Cluster_4 Pocillopora_meandrina_HIv1___Sc0000000 173728 174150 423 1253 72 0.9960095770151636 + UUUGAUUGCUGUGAUCUGGUUG 369 120 2 43 623 435 30 22 N apa-mir-2050_Exaiptasia_pallida_Baumgarten_et_al._2017_miR-2050;_Nve;_Spis;_Adi
Pocillopora_meandrina_HIv1___Sc0000000:187562-188072 Cluster_5 Pocillopora_meandrina_HIv1___Sc0000000 187562 188072 511 178 35 0.43820224719101125 . AUAAAUGUCACUACAAGAAACCUGAAAUCGU 25 2 170 1 1 2 2 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:485727-486254 Cluster_6 Pocillopora_meandrina_HIv1___Sc0000000 485727 486254 528 325 146 0.9969230769230769 + GAUGGGUGUUAUUACUCCUCAGACAGAC 48 109 180 7 11 3 15 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:525310-527341 Cluster_7 Pocillopora_meandrina_HIv1___Sc0000000 525310 527341 2032 14563 3089 0.18347867884364485 - UUUUCGUCACUUUCUUCAGCCUCAGAGU 947 217 13387 53 107 313 486 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:541262-541723 Cluster_8 Pocillopora_meandrina_HIv1___Sc0000000 541262 541723 462 679 131 0.07216494845360824 - UUGGACGAAAUUUCGAGGUUCACACUCGUU 85 0 675 0 2 0 2 N N NA
Pocillopora_meandrina_HIv1___Sc0000000:551887-552690 Cluster_9 Pocillopora_meandrina_HIv1___Sc0000000 551887 552690 804 844 270 0.21208530805687204 . UUCAAGGAGGAUGUAUCCACUGUCAUU 91 21 766 9 4 17 27 N N NA
----------------------------------------------------------
Nummber of potential loci:
7840
Column 20 of the Results.txt
file identifies if a cluster is a miRNA or not (Y
or N
).
# Load bash variables into memory
source .bashvars
echo "Number of loci characterized as miRNA:"
awk '$20=="Y" {print $0}' ${output_dir_top}/ShortStack_out/Results.txt \
| wc -l
echo ""
echo "----------------------------------------------------------"
echo ""
echo "Number of loci _not_ characterized as miRNA:"
awk '$20=="N" {print $0}' ${output_dir_top}/ShortStack_out/Results.txt \
| wc -l
Number of loci characterized as miRNA:
36
----------------------------------------------------------
Number of loci _not_ characterized as miRNA:
7804
Column 21 of the Results.txt
file identifies if a cluster aligned to a known miRNA (miRBase) or not (Y
or NA
).
Since there are no miRNAs, the following code will not print any output.
The echo
command after the awk
command is simply there to prove that the chunk executed.
# Load bash variables into memory
source .bashvars
echo "Number of loci matching miRBase miRNAs:"
awk '$21!="NA" {print $0}' ${output_dir_top}/ShortStack_out/Results.txt \
| wc -l
echo ""
echo "----------------------------------------------------------"
echo ""
echo "Number of loci _not_ matching miRBase miRNAs:"
awk '$21=="NA" {print $0}' ${output_dir_top}/ShortStack_out/Results.txt \
| wc -l
Number of loci matching miRBase miRNAs:
30
----------------------------------------------------------
Number of loci _not_ matching miRBase miRNAs:
7811
Although there are loci with matches to miRBase miRNAs, ShortStack did not annotate these clusters as miRNAs likely because they do not also match secondary structure criteria.
Many of these are large (by GitHub standards) BAM files, so will not be added to the repo.
Additionally, it’s unlikely we’ll utilize most of the other files (bigwig) generated by ShortStack.
# Load bash variables into memory
source .bashvars
tree -h ${output_dir_top}/
/home/shared/8TB_HDD_01/sam/gitrepos/deep-dive/F-Pmea/output/13.1.1-Pmea-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase/
├── [ 22K] shortstack.log
└── [ 20K] ShortStack_out
├── [ 31K] alignment_details.tsv
├── [657K] Counts.txt
├── [ 20K] known_miRNAs.gff3
├── [ 38K] known_miRNAs_unaligned.fasta
├── [6.9M] merged_alignments_21_m.bw
├── [7.0M] merged_alignments_21_p.bw
├── [6.6M] merged_alignments_22_m.bw
├── [6.8M] merged_alignments_22_p.bw
├── [ 12M] merged_alignments_23-24_m.bw
├── [ 13M] merged_alignments_23-24_p.bw
├── [1.1G] merged_alignments.bam
├── [149K] merged_alignments.bam.csi
├── [ 53M] merged_alignments_other_m.bw
├── [ 54M] merged_alignments_other_p.bw
├── [ 24M] merged_alignments_sRNA-POC-47-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 34M] merged_alignments_sRNA-POC-48-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 26M] merged_alignments_sRNA-POC-50-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 41M] merged_alignments_sRNA-POC-53-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 56M] merged_alignments_sRNA-POC-57-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 13K] mir.fasta
├── [997K] Results.gff3
├── [1.6M] Results.txt
├── [183M] sRNA-POC-47-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [175K] sRNA-POC-47-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [206M] sRNA-POC-48-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [171K] sRNA-POC-48-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [184M] sRNA-POC-50-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [174K] sRNA-POC-50-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [250M] sRNA-POC-53-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [171K] sRNA-POC-53-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [247M] sRNA-POC-57-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [161K] sRNA-POC-57-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
└── [4.0K] strucVis
├── [ 12K] Cluster_1020.ps
├── [ 35K] Cluster_1020.txt
├── [ 12K] Cluster_1125.ps
├── [ 36K] Cluster_1125.txt
├── [ 11K] Cluster_1184.ps
├── [4.0K] Cluster_1184.txt
├── [ 11K] Cluster_1196.ps
├── [ 11K] Cluster_1196.txt
├── [ 12K] Cluster_1248.ps
├── [8.4K] Cluster_1248.txt
├── [ 12K] Cluster_1443.ps
├── [ 28K] Cluster_1443.txt
├── [ 13K] Cluster_1449.ps
├── [ 78K] Cluster_1449.txt
├── [ 13K] Cluster_1963.ps
├── [ 50K] Cluster_1963.txt
├── [ 12K] Cluster_2125.ps
├── [ 40K] Cluster_2125.txt
├── [ 12K] Cluster_2144.ps
├── [ 44K] Cluster_2144.txt
├── [ 12K] Cluster_2145.ps
├── [ 34K] Cluster_2145.txt
├── [ 12K] Cluster_21.ps
├── [ 33K] Cluster_21.txt
├── [ 12K] Cluster_3047.ps
├── [ 10K] Cluster_3047.txt
├── [ 12K] Cluster_3096.ps
├── [5.7K] Cluster_3096.txt
├── [ 12K] Cluster_3098.ps
├── [8.4K] Cluster_3098.txt
├── [ 11K] Cluster_3117.ps
├── [ 15K] Cluster_3117.txt
├── [ 11K] Cluster_3260.ps
├── [6.5K] Cluster_3260.txt
├── [ 11K] Cluster_3699.ps
├── [ 33K] Cluster_3699.txt
├── [ 11K] Cluster_4011.ps
├── [ 15K] Cluster_4011.txt
├── [ 12K] Cluster_402.ps
├── [ 47K] Cluster_402.txt
├── [ 11K] Cluster_42.ps
├── [3.8K] Cluster_42.txt
├── [ 11K] Cluster_436.ps
├── [ 15K] Cluster_436.txt
├── [ 12K] Cluster_4428.ps
├── [5.5K] Cluster_4428.txt
├── [ 12K] Cluster_4529.ps
├── [ 15K] Cluster_4529.txt
├── [ 12K] Cluster_4876.ps
├── [ 41K] Cluster_4876.txt
├── [ 12K] Cluster_4878.ps
├── [ 56K] Cluster_4878.txt
├── [ 12K] Cluster_4879.ps
├── [ 27K] Cluster_4879.txt
├── [ 12K] Cluster_4880.ps
├── [ 34K] Cluster_4880.txt
├── [ 12K] Cluster_5016.ps
├── [ 71K] Cluster_5016.txt
├── [ 12K] Cluster_5210.ps
├── [7.2K] Cluster_5210.txt
├── [ 12K] Cluster_5282.ps
├── [ 33K] Cluster_5282.txt
├── [ 12K] Cluster_5735.ps
├── [4.8K] Cluster_5735.txt
├── [ 12K] Cluster_6124.ps
├── [ 19K] Cluster_6124.txt
├── [ 12K] Cluster_6263.ps
├── [ 18K] Cluster_6263.txt
├── [ 12K] Cluster_6998.ps
├── [ 23K] Cluster_6998.txt
├── [ 12K] Cluster_848.ps
└── [ 33K] Cluster_848.txt
2 directories, 105 files