West Coast Green Crab Experiment Part 96
Processing EnTAP output
Overview of EnTAP output
My EnTAP run finished! I checked the error log for confirmation:
Thu Nov 5 06:43:18 2026: Pipeline finished! Calculating final statistics… Thu Nov 5 06:43:18 2026: Alignment file started: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated Thu Nov 5 06:43:18 2026: Alignment file started: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/unannotated Thu Nov 5 06:43:18 2026: Alignment file started: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated_contam Thu Nov 5 06:43:18 2026: Alignment file started: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated_without_ contam Thu Nov 5 06:43:18 2026: Alignment file started: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/entap_results Thu Nov 5 06:43:29 2026: Alignment file ended: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated Thu Nov 5 06:43:29 2026: Alignment file ended: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated_contam Thu Nov 5 06:43:29 2026: Alignment file ended: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/annotated_without_co ntam Thu Nov 5 06:43:29 2026: Alignment file ended: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/entap_results Thu Nov 5 06:43:29 2026: Alignment file ended: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/unannotated
I then had to figure out how to parse the output. I started by looking at the EnTAP documentation, which is very helpful! From that, I learned the following:
- There is a
transcriptomesdirectory, but it’s essentially just 2 copies of the same transcriptome I put in because there’s no filtering done byEnTAP - There is output in the
final_resultsdirectory that I will use to remove the contaminated sequences from the transcriptome - There is a very detailed log file with information about transcriptome processing. For each database, it breaks down the contaminant species, alignment species, then compiled the alignment results.
Here are the transcriptome statistics from the log file:
Transcriptome Statistics —————————————————— Nucleotide sequences found Total sequences: 79814 Total length of transcriptome(bp): 39819275 Average sequence length(bp): 498.00 n50: 519 n90: 253 Longest sequence(bp): 23163 (TRINITY_DN4190_c0_g1) Shortest sequence(bp): 220 (TRINITY_DN40_c1_g2)
Total unique contaminants: 1566(1.96% of total retained sequences):
Final Annotation Statistics
Total Input Sequences: 79814 Similarity Search Total unique sequences with an alignment: 12631 (15.83% of total input sequences) Total alignments flagged as a Similarity Search contaminant: 1566 (12.40% of total unique sim search alignments) Total alignments NOT flagged as a Similarity Search contaminant: 11065 (87.60% of total unique sim search alignments) Total unique sequences without an alignment: 67183 (84.17% of total input sequences) Gene Families Total unique sequences with family assignment: 16333 (20.46% of total input sequences) Total unique sequences without family assignment: 63481 (79.54% of total input sequences) Total unique sequences with at least one GO term: 11248 (14.09% of total input sequences) Total unique sequences with at least one pathway (KEGG) assignment: 7883 (9.88% of total input sequences) Total unique sequences flagged as an EggNOG contaminant: 457 (2.80% of EggNOG assignments) Total unique sequences NOT flagged as an EggNOG contaminant: 15876 (97.20% of total unique family assignments) Totals EnTAP files written to: /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles Total retained sequences (after filtering and/or frame selection): 79814 Final transcriptome written to directory: transcriptomes/ Total unique sequences annotated (similarity search alignments only): 2036 (2.55% of total retained) Total unique sequences annotated (gene family assignment only): 5738 (7.19% of total retained) Total unique sequences annotated (gene family and/or similarity search): 18369 (23.01% of total retained) Written to: final_results/annotated Total annotated sequences flagged as a contaminant from either Similarity Search or EggNOG: 1647 (8.97% of total annotated) Written to: final_results/annotated_contam Total annotated sequences NOT flagged as a contaminant: 16722 (91.03% of total annotated) Written to: final_results/annotated_without_contam Total unique sequences unannotated (gene family and/or similarity search): 61445 (76.99% of total retained) Written to: final_results/unannotated
Removing contaminated sequences
Now that I familiarized myself with the output, it was time to remove the contaminated sequences from the transcriptome. I knew I could do this with the FASTA subsetter script I used previously. Reviewing Zac’s code, I saw that he used awk to get the first column of information (sequence ID) and create a new file to use as input to the FASTA subsetter script. I did the same thing and pulled the sequence IDs from annotated_contam.tsv, which contained the list of contaminant sequences:
echo "Remove contaminated sequences"
# Remove contaminated sequences from the transcriptome
awk 'FNR>1 ' ${OUTPUT_DIR}/entap_outfiles/final_results/annotated_contam.tsv > ${OUTPUT_DIR}/entap_outfiles/final_results/contam_list.txt
python ${HOME_DIR}/06d-fasta_subsetter.py ${OUTPUT_DIR}/entap_outfiles/transcriptomes/filtered_transcripts_min_exp_1_final.fasta ${OUTPUT_DIR}/contam_list.txt REMOVE
mv ${OUTPUT_DIR}/entap_outfiles/final_results/contam_lis_REMOVE.fasta ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta
echo "Contaminated sequence removal complete"
Read in 1647 lucky loci to REMOVE from a subset file. Subset file is complete! Share and enjoy. /scratch/yaamini.venkataraman/wc-green-crab/output/06e-entap/entap_outfiles/final_results/contam_lis_REMOVE.fasta Contaminated sequence removal complete
New transcriptome statistics and count matrix
I now had a clean file! Yay! Even though very few contaminant sequences were removed, I need to re-do my transcriptome statistics and revise my count matrix. I pulled code from my trinity script to do just that:
# TRANSCRIPTOME ASSEMBLY STATISTICS FOR FILTERED TRANSCRIPTOME
#Load module, activate the shell hook, and load environment
module load mambaforge
eval "$(conda shell.bash hook)"
conda activate trinity_env
echo "Start transcript assembly statistic calculations"
# Create new TPM matrix for filtered transcriptome
#Parse the input files and extract matching IDs
#Only retain lines if they are in the filtered FASTA file
awk '
NR==FNR {
if (/^>/) {
sub(/^>/, "")
ids[$1] = 1
}
next
}
FNR==1 || ($1 in ids)
' ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta \
${TRINITY_DIR}/supertranscript_output/salmon.isoform.TPM.not_cross_norm \
> ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta_salmon.TPM.not_cross_norm
# Calculate Ex50 statistics
contig_ExN50_statistic.pl ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta_salmon.TPM.not_cross_norm \
${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta \
| tee ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved_ExN50.stats
# Calculate N50 statistics
TrinityStats.pl ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved.fasta \
> ${OUTPUT_DIR}/entap_outfiles/final_results/transcriptome_entapContamRemoved_N50.txt
echo "Completed transcript assembly statistic calculations"
echo "Ready to proceed to the next analytical step"
Of course, it couldn’t be that easy and my job failed immediately because there was no mambaforge module:
Lmod has detected the following error: The following module(s) are unknown: “mambaforge” Please check the spelling or version number. Also try “module spider …” It is also possible your cache file is out-of-date; it may help to try: $ module –ignore_cache load “mambaforge”
Looks like hydra does not have a mambaforge module, so I activated a miniconda module instead (module load miniconda/25.9) interactively and confirmed I could activate my conda environment. I then updated my script and ran it again. I ended up getting my new count matrix, ExN50 stats, and N50 stats! The E90N50 is 519, with 4,528 transcripts contributing.
Moving files off hydra
The last part of my task: moving files off hydra. I wanted to move the following files into my user directory off of scratch:
- the supertranscipt-level transcriptome created by
trinity - the transcriptome after TPM < 1 filtering
- the transcriptiome after
EnTAPcontamination removal - the count matrix after
EnTAPcontamination removal - the ExN50 and N50 statistics after
EnTAPcontamination removal - annotations for non-contaminated sequences from
EnTAP
Once I moved the documents off of scratch, I mounted vast on my computer. I then moved all of the smaller files into my Github repository. I’ll need to eventually move the larger files to FigShare or something similar, now that OSF is shutting down.
Going forward
- Create count matrix for clean transcriptome
- Calculate Ex50 and N50 statistics for clean transcriptome
- Repeat analysis with clean transcriptome and fuller annotations in
edgeR - Identify temperature- and genotype-specific differentially expressed genes at the end of the experiment
- Identify genes influenced by both temperature and time
- Determine methods for functional analysis
- Additional strand-specific analysis in the supergene region
- Examine HOBO data from 2023 experiment
- Demographic data analysis for 2023 paper