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-Apul-sRNAseq-ShortStack-R1-reads.Rmd, but this analysis uses a customized miRBase database, created by Jill Ashley, which includes published cnidarian miRNAs:
The A.millepora genome will be used as the reference genome for A.pulchra, as A.pulchra does not currently have a sequenced genome and A.millepora had highest alignment rates for standard RNAseq data compared to other published genomes tested.
Inputs:
Requires trimmed sRNAseq files generated by 08.1-Dapul-sRNAseq-trimming-R1-only.Rmd
*fastp-R1-31bp-auto_adapters-polyG.fq.gz
A.millepora genome FastA. See 12-Apul-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}/DEF-cross-species/data"'
echo 'export output_dir_top=${deep_dive_dir}/D-Apul/output/13.1.1-Apul-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase'
echo 'export trimmed_fastqs_dir="${deep_dive_dir}/D-Apul/output/08.1-Dapul-sRNAseq-trimming-R1-only/trimmed-reads"'
echo ""
echo "# Input/Output files"
echo 'export genome_fasta_dir=${deep_dive_dir}/D-Apul/data/Amil/ncbi_dataset/data/GCF_013753865.1'
echo 'export genome_fasta_name="GCF_013753865.1_Amil_v2.1_genomic.fna"'
echo 'export shortstack_genome_fasta_name="GCF_013753865.1_Amil_v2.1_genomic.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=40'
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}/DEF-cross-species/data"
export output_dir_top=${deep_dive_dir}/D-Apul/output/13.1.1-Apul-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase
export trimmed_fastqs_dir="${deep_dive_dir}/D-Apul/output/08.1-Dapul-sRNAseq-trimming-R1-only/trimmed-reads"
# Input/Output files
export genome_fasta_dir=${deep_dive_dir}/D-Apul/data/Amil/ncbi_dataset/data/GCF_013753865.1
export genome_fasta_name="GCF_013753865.1_Amil_v2.1_genomic.fna"
export shortstack_genome_fasta_name="GCF_013753865.1_Amil_v2.1_genomic.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=40
# 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}"
echo ""
echo "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/D-Apul/data/Amil/ncbi_dataset/data/GCF_013753865.1/GCF_013753865.1_Amil_v2.1_genomic.fa
Already exists. Nothing to do.
-rw-r--r-- 1 sam sam 460M Nov 6 12:40 /home/shared/8TB_HDD_01/sam/gitrepos/deep-dive/D-Apul/data/Amil/ncbi_dataset/data/GCF_013753865.1/GCF_013753865.1_Amil_v2.1_genomic.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: 53m45.903s
# Load bash variables into memory
source .bashvars
tail -n 25 ${output_dir_top}/shortstack.log
Writing final files
Found a total of 38 MIRNA loci
Non-MIRNA loci by DicerCall:
N 19182
22 38
23 31
21 10
24 5
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
Thu 15 Feb 2024 13:23:12 -0800 PST
Run Completed!
real 53m45.903s
user 954m40.397s
sys 305m46.174s
ShortStack identified 38 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
NC_058066.1:152483-152906 Cluster_1 NC_058066.1 152483 152906 424 142 34 0.035211267605633804 - UAAGUACUUUAUCAACUAACUCUAGGCA 71 2 127 0 3 0 10 N N NA
NC_058066.1:161064-161674 Cluster_2 NC_058066.1 161064 161674 611 500 218 0.246 . UUUUAGCCUAGUGCGGGUUUCCAGACGU 42 26 439 13 1 3 18 N N NA
NC_058066.1:203241-203651 Cluster_3 NC_058066.1 203241 203651 411 109 48 0.6055045871559633 . UUCUGACUCUAUUAGCAACGAAGACUUU 26 1 106 0 0 2 0 N N NA
NC_058066.1:204533-205150 Cluster_4 NC_058066.1 204533 205150 618 316 160 0.7911392405063291 . UCCCAACACGUCUAGACUGUACAAUUUCU 30 1 304 1 1 3 6 N N NA
NC_058066.1:205739-206966 Cluster_5 NC_058066.1 205739 206966 1228 2006 415 0.3369890329012961 . CAAAAGAGCGGACAAAAUAGUCGACAGAUU 787 7 1953 11 6 15 14 N N NA
NC_058066.1:210855-211344 Cluster_6 NC_058066.1 210855 211344 490 1207 332 0.7514498757249378 . UAAUACUUGUAGUGAAGGUUCAAUCUCGA 99 12 1088 6 6 19 76 N N NA
NC_058066.1:349655-351297 Cluster_7 NC_058066.1 349655 351297 1643 3370 1222 0.8124629080118695 + UCAGCUUGGAAAUGACAGCUUUUGACGU 281 50 3210 13 20 21 56 N N NA
NC_058066.1:351491-353439 Cluster_8 NC_058066.1 351491 353439 1949 9099 1743 0.41938674579624136 . UUUCAAAUCAAAGAUCUUCGCAACGAUGA 786 111 8640 25 45 132 146 N N NA
NC_058066.1:368012-368427 Cluster_9 NC_058066.1 368012 368427 416 209 9 0.0 - AAAGGAUUCUAAUAAU 132 209 0 0 0 0 0 N N NA
----------------------------------------------------------
Nummber of potential loci:
19304
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:
38
----------------------------------------------------------
Number of loci _not_ characterized as miRNA:
19266
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:
39
----------------------------------------------------------
Number of loci _not_ matching miRBase miRNAs:
19266
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/D-Apul/output/13.1.1-Apul-sRNAseq-ShortStack-R1-reads-cnidarian_miRBase/
├── [ 22K] shortstack.log
└── [ 36K] ShortStack_out
├── [ 31K] alignment_details.tsv
├── [1.1M] Counts.txt
├── [ 20K] known_miRNAs.gff3
├── [ 35K] known_miRNAs_unaligned.fasta
├── [5.3M] merged_alignments_21_m.bw
├── [5.7M] merged_alignments_21_p.bw
├── [5.0M] merged_alignments_22_m.bw
├── [5.4M] merged_alignments_22_p.bw
├── [ 10M] merged_alignments_23-24_m.bw
├── [ 11M] merged_alignments_23-24_p.bw
├── [1.4G] merged_alignments.bam
├── [222K] merged_alignments.bam.csi
├── [ 72M] merged_alignments_other_m.bw
├── [ 75M] merged_alignments_other_p.bw
├── [ 48M] merged_alignments_sRNA-ACR-140-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 54M] merged_alignments_sRNA-ACR-145-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 51M] merged_alignments_sRNA-ACR-150-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 44M] merged_alignments_sRNA-ACR-173-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 45M] merged_alignments_sRNA-ACR-178-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bw
├── [ 11K] mir.fasta
├── [1.9M] Results.gff3
├── [2.9M] Results.txt
├── [261M] sRNA-ACR-140-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [227K] sRNA-ACR-140-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [299M] sRNA-ACR-145-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [227K] sRNA-ACR-145-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [311M] sRNA-ACR-150-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [230K] sRNA-ACR-150-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [275M] sRNA-ACR-173-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [228K] sRNA-ACR-173-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
├── [248M] sRNA-ACR-178-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam
├── [230K] sRNA-ACR-178-S1-TP2_R1_001.fastp-R1-31bp-auto_adapters-polyG.bam.csi
└── [4.0K] strucVis
├── [ 12K] Cluster_10352.ps
├── [ 34K] Cluster_10352.txt
├── [ 11K] Cluster_10499.ps
├── [5.9K] Cluster_10499.txt
├── [ 12K] Cluster_10801.ps
├── [ 11K] Cluster_10801.txt
├── [ 11K] Cluster_10993.ps
├── [7.6K] Cluster_10993.txt
├── [ 12K] Cluster_11046.ps
├── [2.2K] Cluster_11046.txt
├── [ 11K] Cluster_1560.ps
├── [ 11K] Cluster_1560.txt
├── [ 11K] Cluster_16426.ps
├── [1.9K] Cluster_16426.txt
├── [ 11K] Cluster_16427.ps
├── [1.6K] Cluster_16427.txt
├── [ 11K] Cluster_18046.ps
├── [1.4K] Cluster_18046.txt
├── [ 12K] Cluster_1950.ps
├── [9.8K] Cluster_1950.txt
├── [ 12K] Cluster_2059.ps
├── [ 36K] Cluster_2059.txt
├── [ 12K] Cluster_2119.ps
├── [8.9K] Cluster_2119.txt
├── [ 12K] Cluster_2137.ps
├── [ 45K] Cluster_2137.txt
├── [ 12K] Cluster_2613.ps
├── [ 45K] Cluster_2613.txt
├── [ 11K] Cluster_2614.ps
├── [ 31K] Cluster_2614.txt
├── [ 12K] Cluster_2645.ps
├── [ 25K] Cluster_2645.txt
├── [ 12K] Cluster_3133.ps
├── [5.2K] Cluster_3133.txt
├── [ 12K] Cluster_3207.ps
├── [7.5K] Cluster_3207.txt
├── [ 12K] Cluster_3210.ps
├── [3.8K] Cluster_3210.txt
├── [ 11K] Cluster_326.ps
├── [ 20K] Cluster_326.txt
├── [ 12K] Cluster_3814.ps
├── [ 18K] Cluster_3814.txt
├── [ 12K] Cluster_4132.ps
├── [ 21K] Cluster_4132.txt
├── [ 12K] Cluster_4411.ps
├── [ 31K] Cluster_4411.txt
├── [ 11K] Cluster_5044.ps
├── [ 16K] Cluster_5044.txt
├── [ 11K] Cluster_5188.ps
├── [1.1K] Cluster_5188.txt
├── [ 11K] Cluster_535.ps
├── [3.8K] Cluster_535.txt
├── [ 12K] Cluster_5436.ps
├── [ 65K] Cluster_5436.txt
├── [ 12K] Cluster_571.ps
├── [ 56K] Cluster_571.txt
├── [ 12K] Cluster_6590.ps
├── [ 22K] Cluster_6590.txt
├── [ 11K] Cluster_6661.ps
├── [ 46K] Cluster_6661.txt
├── [ 12K] Cluster_7188.ps
├── [ 47K] Cluster_7188.txt
├── [ 12K] Cluster_7195.ps
├── [ 13K] Cluster_7195.txt
├── [ 12K] Cluster_7207.ps
├── [ 80K] Cluster_7207.txt
├── [ 12K] Cluster_7267.ps
├── [ 15K] Cluster_7267.txt
├── [ 11K] Cluster_7327.ps
├── [ 26K] Cluster_7327.txt
├── [ 11K] Cluster_8739.ps
├── [4.7K] Cluster_8739.txt
├── [ 12K] Cluster_8810.ps
├── [ 30K] Cluster_8810.txt
├── [ 12K] Cluster_9747.ps
└── [ 31K] Cluster_9747.txt
2 directories, 109 files