<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Allyson&#39;s Lab Notebook</title>
<link>https://ademerlis.github.io/</link>
<atom:link href="https://ademerlis.github.io/index.xml" rel="self" type="application/rss+xml"/>
<description>Allyson DeMerlis&#39; online lab notebook: coral transcriptomics, bioinformatics, and statistics in R and bash.</description>
<generator>quarto-1.10.18</generator>
<lastBuildDate>Thu, 08 Jan 2026 00:00:00 GMT</lastBuildDate>
<item>
  <title>Next steps with PSTR RT transcriptomics</title>
  <link>https://ademerlis.github.io/posts/2026-01-08-rt-transcriptomics-next-steps.html</link>
  <description><![CDATA[ 




<p>Some of the trimmed sequence files (&lt;2GB) were run on sortmeRNA using –blast, and the others were run more recently (using <a href="https://github.com/ademerlis/reciprocaltransplant/blob/main/gene_expression/6_sortmerna_redo.sh">the most up to date sortmeRNA code</a>), which did not include –blast.</p>
<p>This resulted in differing files (no singletons) – asking chatGPT, they said that sortmeRNA doesn’t change the filtering parameters for rRNA vs non_rRNA, it just doesn’t pull out paired vs singletons.</p>
<p>So in essence, I can use the “old” files and the “new” files together to assemble a transcriptome using trinity.</p>
<p>creating Trinity environment in conda: <code>conda create -n trinity -c conda-forge -c bioconda trinity</code></p>
<p>moved all the _non_rRNA and _rRNA files up, and then identified the _out_paired from the first round and renamed those to non_rRNA and moved those too</p>
<p>now identify samples to use for transcriptome assembly (i selected a subset across genotypes and time points, and then looked for ones that had fwd and rev sortmerna files &gt; 1 GB but less than 2 GB).</p>
<p>look for samples from sortmerna with &lt; 1 GB – rerun those (aka the one at 17 k)</p>
<p>samples to rerun (all at 17kb): - Pstr_Jul2023_006 - Pstr_Nov2023_180 - Pstr_Nov2023_181 - Pstr_Nov2023_190 - Pstr_Nov2023_191 - Pstr_Nov2023_195 - Pstr_Nov2023_196</p>
<p>Jan 9, 2026: I reran sortmeRNA on these and it worked, so now they are all ready to go.</p>
<p>This is what ended up working to install and activate trinity on pegasus (although some warnings and errors came up that may cause problems later):</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> update trinity</span>
<span id="cb1-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#to get mamba to work on pegasus:</span></span>
<span id="cb1-3"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">module</span> load mambaforge/1.5.8</span>
<span id="cb1-4"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">source</span> /share/apps/mambaforge/install/etc/profile.d/conda.sh</span>
<span id="cb1-5"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">source</span> /share/apps/mambaforge/install/etc/profile.d/mamba.sh</span>
<span id="cb1-6"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">mamba</span> install trinity</span>
<span id="cb1-7"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">mamba</span> update trinity</span>
<span id="cb1-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> activate /nethome/and128/anaconda3/envs/trinity</span>
<span id="cb1-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">which</span> Trinity</span>
<span id="cb1-10"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> env create <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--name</span> trinity <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--file</span> /nethome/and128/anaconda3/envs/trinity/environment.yml</span>
<span id="cb1-11"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> env export <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> environment.yml</span>
<span id="cb1-12"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> env create <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--name</span> trinity <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--file</span> environment.yml</span></code></pre></div></div>
<p>I ran this, and I keep running into errors:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">command</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Trinity --seqType fq --left pstr_fwd.fq.gz --right pstr_rev.fq.gz --CPU 10 --max_memory 100G --min_kmer_cov 2 --output /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/output"</span></span>
<span id="cb2-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-P</span> and_transcriptomics <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-q</span> bigmem <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-n</span> 10 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-R</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"rusage[mem=10000]"</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-W</span> 120:00 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-J</span> trin_pstr <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-e</span> trin_pstr.err <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-o</span> trin_pstr.out eval <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${command}</span></span></code></pre></div></div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/bin/bash</span></span>
<span id="cb3-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -P and_transcriptomics</span></span>
<span id="cb3-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -q bigmem</span></span>
<span id="cb3-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -n 10</span></span>
<span id="cb3-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -R "rusage[mem=10000]"</span></span>
<span id="cb3-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -W 120:00</span></span>
<span id="cb3-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -J trin_pstr</span></span>
<span id="cb3-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -e trin_pstr.err</span></span>
<span id="cb3-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -o trin_pstr.out</span></span>
<span id="cb3-10"></span>
<span id="cb3-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># from pegasus docs</span></span>
<span id="cb3-12"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">module</span> load miniforge3/24.3.0-0</span>
<span id="cb3-13"></span>
<span id="cb3-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Activate Trinity environment</span></span>
<span id="cb3-15"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> activate /nethome/and128/anaconda3/envs/trinity</span>
<span id="cb3-16"></span>
<span id="cb3-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Run Trinity</span></span>
<span id="cb3-18"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Trinity</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--seqType</span> fq <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-19">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--left</span> /scratch/projects/and_transcriptomics/reciprocaltransplant/sortmerna/trinity/pstr_fwd.fq.gz <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-20">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--right</span> /scratch/projects/and_transcriptomics/reciprocaltransplant/sortmerna/trinity/pstr_rev.fq.gz <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-21">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--CPU</span> 10 <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-22">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--max_memory</span> 100G <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-23">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--min_kmer_cov</span> 2 <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb3-24">  <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--output</span> /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/output</span></code></pre></div></div>
<p>The most recent errors are: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory This Perl not built to support threads Compilation failed in require at /nethome/and128/anaconda3/envs/trinity/bin/Trinity line 5. BEGIN failed–compilation aborted at /nethome/and128/anaconda3/envs/trinity/bin/Trinity line 5.</p>
<p>So i am trying this: <code>conda install -c bioconda -c conda-forge trinity samtools&gt;=1.10 perl-threaded</code></p>
<p>It still is having issues. I wonder if it is because I have another conda environment with BioPerl.</p>
<p><strong>Jan 23 2026</strong></p>
<p>I was able to run Trinity in the trinity conda environment, and got the job submitted using this directly in the command line:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">command</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Trinity --seqType fq --left /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/pstr_fwd.fq.gz --right /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/pstr_rev.fq.gz --CPU 10 --max_memory 100G --min_kmer_cov 2 --output /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/trinity"</span></span>
<span id="cb4-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-P</span> and_transcriptomics <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-q</span> bigmem <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-n</span> 10 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-R</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"rusage[mem=10000]"</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-W</span> 120:00 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-J</span> trin_pstr <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-e</span> trin_pstr.err <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-o</span> /scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/trinity/output eval <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${command}</span></span></code></pre></div></div>
<p>However, it quit after a bit and gave me 2 output files, which basically had the error message:</p>
<p><code>Argument "error" isn't numeric in numeric ne (!=) at /nethome/and128/anaconda3/envs/trinity/bin/Trinity line 3812. Error, need samtools installed that is at least as new as version 1.3 at /nethome/and128/anaconda3/envs/trinity/bin/Trinity line 3813.</code></p>
<p>Now i’m trying to install samtools again and I’m running into the same issue as before.</p>
<p><strong>Jan 28 2026</strong></p>
<p><code>samtools: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory</code></p>



 ]]></description>
  <category>Analysis</category>
  <category>Reciprocal Transplant</category>
  <category>Coding</category>
  <category>Pegasus</category>
  <category>rRNA</category>
  <category>De Novo Transcriptome Assembly</category>
  <guid>https://ademerlis.github.io/posts/2026-01-08-rt-transcriptomics-next-steps.html</guid>
  <pubDate>Thu, 08 Jan 2026 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Fish Predation GLMMs</title>
  <link>https://ademerlis.github.io/posts/2025-10-25-fish-predation-glmms.html</link>
  <description><![CDATA[ 




<p>So I’ve been diving into the RTT project data and trying to find the best pipeline to analyze different response variables. Since there are so many predictor variables, I’ve been struggling to come up with a way to test all of them and whether they’re important for each response variable I’m testing.</p>
<p>Here is the complete list of what I’m working with data-wise:</p>
<section id="response-variables-to-test" class="level4">
<h4 class="anchored" data-anchor-id="response-variables-to-test">Response variables to test:</h4>
<ul>
<li>alive vs.&nbsp;dead (binary)</li>
<li>predation occurrence (binary - fish bites + % live tissue due to predation &gt; 0)</li>
<li>time to mortality (binary)</li>
<li>proportion of live tissue (bounded 0-1)</li>
<li>number of predation events (count)</li>
</ul>
</section>
<section id="predictor-variables-to-test" class="level4">
<h4 class="anchored" data-anchor-id="predictor-variables-to-test">Predictor variables to test:</h4>
<ul>
<li>Region (categorical)</li>
<li>Site (categorical)</li>
<li>Strata (categorical)</li>
<li>Genotype (categorical)</li>
<li>Species (categorical)</li>
<li>Time point (could be continuous or categorical - depending on which column you use)</li>
<li>Fish abundance (counts)</li>
</ul>
<p>I also have been struggling with which to use, glm or glmer, and which variables to make fixed effects versus random effects.</p>
<p>When I look at Adam MacAnally’s original code, he uses glm exclusively and treats everything as a fixed effect. He uses days as a polynomial (both linear and quadratic) since the data aren’t linear.</p>
<p>But when doing something like repeated measures, you’re supposed to include time as a random effect.</p>
<p>But, do we want to test the significance of time point as a variable and get stats for it? like saying that there is a significant effect of time. If so, then time needs to be a fixed effect.</p>
</section>
<section id="predation-prevalence" class="level3">
<h3 class="anchored" data-anchor-id="predation-prevalence">Predation prevalence</h3>
<section id="model-1-monitoring-interval-as-random-effect" class="level5">
<h5 class="anchored" data-anchor-id="model-1-monitoring-interval-as-random-effect">Model 1 (monitoring interval as random effect)</h5>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#some variables are nested and need to be controlled for in the model, but can't be fixed effects (model becomes too complicated)</span></span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fixed effects for this test: Species, Region </span></span>
<span id="cb1-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># random effects: Source Nursery, Site, STRATA, Monitoring Interval (repeated measures)</span></span>
<span id="cb1-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># I can't really test genotype because there is very few replicates across sites and regions  </span></span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># step-wise add fixed effects and then look at top_models and see which fixed effects are important</span></span>
<span id="cb1-8"></span>
<span id="cb1-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Species and region are important</span></span>
<span id="cb1-10"></span>
<span id="cb1-11">glmm_global <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">glmer</span>(Experienced_Predation_num <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Species <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> Region <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span>SourceNursery) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span>Site) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span>STRATA) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> (<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span>MI_CORRECTED), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">family =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"binomial"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data =</span> outplant_monitoring_days_survival_glm)</span>
<span id="cb1-12"></span>
<span id="cb1-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">summary</span>(glmm_global)</span>
<span id="cb1-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># looking at the variance of random effects, MI_Corrected contributes the overwhelming majority</span></span>
<span id="cb1-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># source nursery contributes very little to the variance</span></span>
<span id="cb1-16"></span>
<span id="cb1-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fit candidate subsets of predictors</span></span>
<span id="cb1-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">options</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">na.action =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"na.fail"</span>)  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># required for dredge</span></span>
<span id="cb1-19"></span>
<span id="cb1-20">model_set <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> MuMIn<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dredge</span>(glmm_global, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">rank =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"AICc"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">REML =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span>)</span>
<span id="cb1-21"></span>
<span id="cb1-22"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># top models</span></span>
<span id="cb1-23">top_models <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> model_set <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as_tibble</span>() <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">arrange</span>(AICc) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">slice</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb1-24"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># best model with lowest AICc is the model that contains all fixed effects (global model) AICc = 12731.33   </span></span>
<span id="cb1-25"></span>
<span id="cb1-26">model_no_species <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">update</span>(glmm_global, . <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> . <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> Species)</span>
<span id="cb1-27">r2_full <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> MuMIn<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">r.squaredGLMM</span>(glmm_global)[, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"R2m"</span>]</span>
<span id="cb1-28">r2_no_species <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> MuMIn<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">r.squaredGLMM</span>(model_no_species)[, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"R2m"</span>]</span>
<span id="cb1-29">species_contrib <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> r2_full <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> r2_no_species</span>
<span id="cb1-30"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># R2 with both species and region is 0.233</span></span>
<span id="cb1-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># R2 with just region is 0.223</span></span>
<span id="cb1-32"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Species thus contributes only 0.01 to the explained variance</span></span>
<span id="cb1-33"></span>
<span id="cb1-34"></span>
<span id="cb1-35"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># residual diagnostics (DHARMA)</span></span>
<span id="cb1-36">sim_res <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">simulateResiduals</span>(glmm_global, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">n =</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000</span>)</span>
<span id="cb1-37"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot</span>(sim_res)</span>
<span id="cb1-38"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">testUniformity</span>(sim_res) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fits, not significant</span></span>
<span id="cb1-39"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">testDispersion</span>(sim_res) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fits, not significant</span></span>
<span id="cb1-40"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">testZeroInflation</span>(sim_res) <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fits, not significant</span></span>
<span id="cb1-41"></span>
<span id="cb1-42"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># make summary table </span></span>
<span id="cb1-43"></span>
<span id="cb1-44"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fixed effects</span></span>
<span id="cb1-45">fixed_tbl <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidy</span>(glmm_global, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">effects =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fixed"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">conf.int =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb1-46"></span>
<span id="cb1-47"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># random effects</span></span>
<span id="cb1-48">random_tbl <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidy</span>(glmm_global, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">effects =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ran_pars"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">conf.int =</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>)</span>
<span id="cb1-49"></span>
<span id="cb1-50"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># combine</span></span>
<span id="cb1-51">full_tbl <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">bind_rows</span>(</span>
<span id="cb1-52">  fixed_tbl <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">effect_type =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fixed"</span>),</span>
<span id="cb1-53">  random_tbl <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mutate</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">effect_type =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"random"</span>)</span>
<span id="cb1-54">)</span>
<span id="cb1-55"></span>
<span id="cb1-56"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Perform pairwise comparisons to look at the impact of treatments within MCAV</span></span>
<span id="cb1-57">pairwise_emmeans <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">emmeans</span>(glmm_global, pairwise <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> Species<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>Region, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">adjust =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tukey"</span>)</span>
<span id="cb1-58"></span>
<span id="cb1-59"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Anova</span>(glmm_global, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">type =</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>)</span>
<span id="cb1-60"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># significant effect of Species and Region</span></span>
<span id="cb1-61"></span>
<span id="cb1-62"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># View the pairwise comparisons results</span></span>
<span id="cb1-63"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">print</span>(pairwise_emmeans<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>contrasts)</span></code></pre></div></div>


</section>
</section>

 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>Fish Predation</category>
  <category>Reciprocal Transplant</category>
  <category>GLMM</category>
  <guid>https://ademerlis.github.io/posts/2025-10-25-fish-predation-glmms.html</guid>
  <pubDate>Sat, 25 Oct 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Using SortmeRNA</title>
  <link>https://ademerlis.github.io/posts/2025-09-22-sortme-rna.html</link>
  <description><![CDATA[ 




<section id="using-sortmerna-for-removing-rrna" class="level3">
<h3 class="anchored" data-anchor-id="using-sortmerna-for-removing-rrna">Using SortMeRNA for removing rRNA</h3>
<ul>
<li>Looking online, there seems to be some thoughts that removing rRNA reads is not required when Poly-A selection is performed during sequencing, as preferentially selecting polyA tails automatically creates a bias towards mRNA (see <a href="https://www.biostars.org/p/419845/">this article</a> and <a href="">this article</a>).</li>
<li>However, some suggest that removing rRNA would save computation time and lead to a cleaner assembly (<a href="https://www.researchgate.net/post/Should_I_remove_rRNAs_from_transcriptome_data_while_moving_on_to_Denovo_assembly">see here</a>).</li>
<li>This <a href="https://trhvidsten.com/docs/Delhomme-EpiGeneSysProtocol2015.pdf">tutorial/paper</a> is a good resource - it says that if GC content is abnormal, it could be a sign of high rRNA content (GC content of over 50% is typical for rRNA) and then SortMeRNA should be used. They also said “if there is any doubt, this step should be performed.”</li>
</ul>
<p>Based on the multiQC report of my trimmed reads, it looks like the average GC content is not normally distributed and is higher for some samples. To be safe, I’ll follow Brad’s code and run <strong>SortMeRNA</strong> on it.</p>
<p><img width="959" height="528" alt="Screenshot 2025-08-20 at 1 54 00 PM" src="https://github.com/user-attachments/assets/82bfdc4b-c67a-42c8-bafb-a946812b8e2f"></p>
<section id="update" class="level4">
<h4 class="anchored" data-anchor-id="update">Update</h4>
<p>So I ran SortMeRNA. Now what? I don’t want to do the BBSplit step because I’m not looking to see what aligns to members of the microbiome. I think I just want to skip to Trinity. But what files from SortMeRNA do I use to do that?</p>
<p>When I look at Brad’s next steps for BBSplit and Trinity, it looks like he renamed his fastq files from SortMeRNA.</p>
<p>The results of SortMeRNA are directories for each sample. <img width="351" height="31" alt="Screenshot 2025-09-13 at 5 47 17 PM" src="https://github.com/user-attachments/assets/ceaf224e-c0bf-4bf2-ba30-9ab45732cd43"></p>
<p>According to the <a href="https://sortmerna.readthedocs.io/en/latest/manual4.0.html#usage">SortMeRNA user manual</a>: - “kvdb” = “key-value datastore for alignment results” - idx = “index database” - “out” = “output files like aligned.blast”</p>
<p>It doesn’t mention the other folder I have, which is “readb”, and that’s the one I found .fq.gz files in, which look like what I would work with?</p>
<p>Ok I found on <a href="https://hpc.nih.gov/apps/sortmerna.html">this website</a> more info: it says that “readb” means “pre-processed reads/index”.</p>
<p>ChatGPT said that my code isn’t working because I didn’t assign it a name for the aligned versus unaligned reads. Idk… Working on trying a new code it suggested now:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define project directories and paths</span></span>
<span id="cb1-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb1-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb1-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb1-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">readsdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/trimmed_cutadapt"</span></span>
<span id="cb1-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/sortmeRNA"</span></span>
<span id="cb1-9"></span>
<span id="cb1-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb1-11"></span>
<span id="cb1-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 files</span></span>
<span id="cb1-13"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1.trimmed.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb1-14">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Extract sample base name (e.g., "Pstr-Dec2022-202")</span></span>
<span id="cb1-15">  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span>_R1.trimmed.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb1-16"></span>
<span id="cb1-17">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job directly</span></span>
<span id="cb1-18">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span></span>
<span id="cb1-19"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb1-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb1-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA</span></span>
<span id="cb1-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.err</span></span>
<span id="cb1-23"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.out</span></span>
<span id="cb1-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q bigmem</span></span>
<span id="cb1-25"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 10</span></span>
<span id="cb1-26"></span>
<span id="cb1-27"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb1-28"></span>
<span id="cb1-29"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/bin/sortmerna </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --ref </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/database/smr_v4.3_default_db.fasta </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-31"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-33"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --aligned </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --other </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_non_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-35"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --fastx </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-36"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --out2 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-37"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --sout </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-38"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --log </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb1-39"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --workdir </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span></span>
<span id="cb1-40"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb1-41"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p><strong>Update</strong>: this script sat in the job queue for 2 days. I don’t think it will work.</p>
<p>I also realized that I don’t think it’s using the files that sortmeRNA already made. I’m having chatGPT write a few versions to try to see what will work.</p>
<p><strong>Sept 17 2025 Update</strong>: - I realized in the original error files for sortmeRNA, I got “run time limit reached” flags for each job. So I think what happened was that they all timed out at around 6 hours. In an unrelated note, but may be related, the Pegasus technicians told me that I needed to start using pegasus2 rather than pegasus. I discovered this when I tried to check the status of my jobs, and the LSF “daemon” wasn’t responding.</p>
<ul>
<li>So I have done that, and I’m basically trying to re-run the original script that I got to work, but that timed out. I added the specific file names for –aligned and –other in the hopes that it would help. I also added a longer time limit request in the job submission, so hopefully that helps.</li>
</ul>
<p>The job I ran most recently is called “6_sortmerna.sh” on Pegasus and looks like this:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define project directories and paths</span></span>
<span id="cb2-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb2-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb2-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb2-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">readsdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/trimmed_cutadapt"</span></span>
<span id="cb2-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/sortmeRNA"</span></span>
<span id="cb2-9"></span>
<span id="cb2-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-11"></span>
<span id="cb2-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 files</span></span>
<span id="cb2-13"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1.trimmed.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb2-14">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Extract sample base name (e.g., "Pstr-Dec2022-202")</span></span>
<span id="cb2-15">  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span>_R1.trimmed.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-16"></span>
<span id="cb2-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Write the job script</span></span>
<span id="cb2-18">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmeRNA/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb2-19"></span>
<span id="cb2-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb2-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb2-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA</span></span>
<span id="cb2-23"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.err</span></span>
<span id="cb2-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRsNA.out</span></span>
<span id="cb2-25"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q bigmem</span></span>
<span id="cb2-26"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 10</span></span>
<span id="cb2-27"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 48:00</span></span>
<span id="cb2-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -R "rusage[mem=6000]"</span></span>
<span id="cb2-29"></span>
<span id="cb2-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-31"></span>
<span id="cb2-32"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/bin/sortmerna --ref </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/database/smr_v4.3_default_db.fasta </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-33"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-35"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--aligned --other --fastx --blast --out2 --sout </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-36"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--workdir </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span></span>
<span id="cb2-37"></span>
<span id="cb2-38"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb2-39"></span>
<span id="cb2-40">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job</span></span>
<span id="cb2-41">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmerna.job"</span></span>
<span id="cb2-42"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>but that last line about submitting the jobs doesn’t work, so I’ll need to manually submit all the jobs.</p>
<p>I ran this in the command line:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> f <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>.job<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb3-2">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$f</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb3-3"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>Ok, the “bigmem” queue ones never submitted and were still pending a day later, so I used <code>bjobs -p</code> to see why, and it said this: “Not enough processors to meet the job’s spanning requirement: 1 host;”</p>
<p>So I changed the parameters to “normal” queue and -8 processors, and it ran. But then all the jobs exited out because of the following issue: “Please, ensure the directory”/scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files/sortmerna/Pstr-Nov2023-198/kvdb” is Empty prior running ‘sortmerna’“.</p>
<p>According to chatGPT, having a pre-filled “kvdb” folder is the only one that sortmerna cares about and will refuse to rewrite over.</p>
<p>So now I’m running this script to erase those subfolders for all samples in advance, then trying again.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb4-2"></span>
<span id="cb4-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define project directories and paths</span></span>
<span id="cb4-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb4-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb4-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb4-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">readsdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/trimmed_cutadapt"</span></span>
<span id="cb4-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/sortmeRNA"</span></span>
<span id="cb4-9"></span>
<span id="cb4-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb4-11"></span>
<span id="cb4-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 files</span></span>
<span id="cb4-13"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1.trimmed.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb4-14">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Extract sample base name (e.g., "Pstr-Dec2022-202")</span></span>
<span id="cb4-15">  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span>_R1.trimmed.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb4-16"></span>
<span id="cb4-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Write the job script</span></span>
<span id="cb4-18">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmeRNA/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb4-19"></span>
<span id="cb4-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb4-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb4-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA</span></span>
<span id="cb4-23"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.err</span></span>
<span id="cb4-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRsNA.out</span></span>
<span id="cb4-25"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q normal</span></span>
<span id="cb4-26"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb4-27"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 48:00</span></span>
<span id="cb4-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -R "rusage[mem=6000]"</span></span>
<span id="cb4-29"></span>
<span id="cb4-30"></span>
<span id="cb4-31"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Clean up old SortMeRNA outputs for this sample</span></span>
<span id="cb4-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">rm -rf </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/kvdb</span></span>
<span id="cb4-33"></span>
<span id="cb4-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb4-35"></span>
<span id="cb4-36"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/bin/sortmerna --ref </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/database/smr_v4.3_default_db.fasta </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb4-37"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb4-38"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb4-39"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--aligned --other --fastx --blast --out2 --sout </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb4-40"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">--workdir </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span></span>
<span id="cb4-41"></span>
<span id="cb4-42"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb4-43"></span>
<span id="cb4-44">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job</span></span>
<span id="cb4-45">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmerna.job"</span></span>
<span id="cb4-46"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
</section>
</section>
<section id="sept-22-update" class="level3">
<h3 class="anchored" data-anchor-id="sept-22-update">Sept 22 update</h3>
<p>Just checked the log files from the most recent sortmerna run, and now there’s some fun new errors.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">[write_a_read:215]</span> ESC[0<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">31mERRORESC[0m:</span> Failed deflating readstring:</span>
<span id="cb5-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">[write_a_read:215]</span> ESC[0<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">31mERRORESC[0m:</span> zlib status: <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-1</span></span>
<span id="cb5-3"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">[append:328]</span> ESC[0<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">31mERRORESC[0m:</span> Failed deflating readstring:</span>
<span id="cb5-4"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">[append:328]</span> ESC[0<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">31mERRORESC[0m:</span> zlib status: <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-1</span></span></code></pre></div></div>
<p>ChatGPT gave some bs reasons why but I honestly am just starting to give up on this program.</p>
<p>Ok, I discovered that a subset of samples did work (24 out of 96):</p>
<p><img width="878" height="408" alt="Screenshot 2025-09-22 at 10 03 43 AM" src="https://github.com/user-attachments/assets/5dddd384-eeed-4dd2-9067-c77cba28966b"></p>
<p>Ok, I’m not sure why the rest didn’t work, I’m just going to rerun them now:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb6-2"></span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define directories</span></span>
<span id="cb6-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb6-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb6-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb6-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">readsdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/trimmed_cutadapt"</span></span>
<span id="cb6-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/sortmeRNA"</span></span>
<span id="cb6-9"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">sortdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna"</span></span>
<span id="cb6-10"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">scriptdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmerna"</span></span>
<span id="cb6-11"></span>
<span id="cb6-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Make sure scriptdir and logdir exist</span></span>
<span id="cb6-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mkdir</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-p</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${scriptdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb6-14"></span>
<span id="cb6-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 trimmed reads</span></span>
<span id="cb6-16"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">||</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">exit</span></span>
<span id="cb6-17"></span>
<span id="cb6-18"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1.trimmed.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb6-19">    <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span>_R1.trimmed.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb6-20"></span>
<span id="cb6-21">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check if the SortMeRNA out folder exists and has files</span></span>
<span id="cb6-22">    <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">out_folder</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/out"</span></span>
<span id="cb6-23">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">[</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-d</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out_folder</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">]</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">&amp;&amp;</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">[</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ls</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-A</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out_folder</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>/dev/null<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">]</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">then</span></span>
<span id="cb6-24">        <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Skipping </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> (output already exists)"</span></span>
<span id="cb6-25">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">continue</span></span>
<span id="cb6-26">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">fi</span></span>
<span id="cb6-27"></span>
<span id="cb6-28">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Write the LSF job script</span></span>
<span id="cb6-29">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${scriptdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb6-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb6-31"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb6-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA</span></span>
<span id="cb6-33"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.err</span></span>
<span id="cb6-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.out</span></span>
<span id="cb6-35"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q normal</span></span>
<span id="cb6-36"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb6-37"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 48:00</span></span>
<span id="cb6-38"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -R "rusage[mem=6000]"</span></span>
<span id="cb6-39"></span>
<span id="cb6-40"></span>
<span id="cb6-41"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Clean up old SortMeRNA outputs for this sample</span></span>
<span id="cb6-42"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">rm -rf </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/kvdb</span></span>
<span id="cb6-43"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb6-44"></span>
<span id="cb6-45"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/bin/sortmerna </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-46"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --ref </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/database/smr_v4.3_default_db.fasta </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-47"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-48"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-49"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --aligned </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-50"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --other </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_non_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-51"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --fastx --blast --out2 --sout </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb6-52"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --workdir </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span></span>
<span id="cb6-53"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb6-54"></span>
<span id="cb6-55">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job</span></span>
<span id="cb6-56">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${scriptdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb6-57"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>Ok, this didn’t work again. This time the error was “std::out_of_range / stoi”. Apparently, ChatGPT is saying that version 4.3.6 of SortMeRNA is known to have a bug to cause crashes if there are any differences between reads 1 and 2 that it can’t parse, I guess even if the length differ by 1 base pair. I checked my MultiQC report and I don’t think that’s the issue. But ChatGPT recommended removing these flags <code>--blast, --out2, --sout</code> and trying again. Otherwise, I may need to downgrade to a previous version of SortMeRNA.</p>
</section>
<section id="sept-22" class="level2">
<h2 class="anchored" data-anchor-id="sept-22">Sept 22</h2>
<p>Ok, I think now what’s happening is I maxed out the space quota on my Pegasus account. I was at 2 T of files. I deleted the Trim Galore folder because I am using the cutadapt trimmed version files now, and that freed up ~500 GB of space. Now I’m re-running sortmeRNA, but I’m having it also delete all the subfolders for the samples that didn’t work, because there could potentially be issues with having partial files written already in there.</p>
</section>
<section id="sept-23" class="level2">
<h2 class="anchored" data-anchor-id="sept-23">Sept 23</h2>
<p>I discovered this <a href="https://github.com/sortmerna/sortmerna/issues/379">open thread on the sortmerna GitHub</a> that has the error I keep getting. It looks like there is a bug. If the file is larger than 2 GB, it stops working.</p>
<p>Ok, I discovered anything greater than 20 million reads is not working in sortmerna. This equates to around 2 GB (see screenshot). Also, why is R2 larger than R1 if they have the same amount of reads?</p>
<p><img width="1000" height="444" alt="Screenshot 2025-09-23 at 10 31 10 AM" src="https://github.com/user-attachments/assets/510a5f70-a14e-4239-8528-a01bac673133"></p>
<p>Here are the other threads in sortmerna issues on GitHub: - <a href="https://github.com/sortmerna/sortmerna/issues/429" class="uri">https://github.com/sortmerna/sortmerna/issues/429</a> - <a href="https://github.com/sortmerna/sortmerna/issues/445" class="uri">https://github.com/sortmerna/sortmerna/issues/445</a> - <a href="https://github.com/sortmerna/sortmerna/issues/421" class="uri">https://github.com/sortmerna/sortmerna/issues/421</a> - <a href="https://github.com/sortmerna/sortmerna/issues/419" class="uri">https://github.com/sortmerna/sortmerna/issues/419</a> - <a href="https://github.com/sortmerna/sortmerna/issues/424" class="uri">https://github.com/sortmerna/sortmerna/issues/424</a> - <a href="https://github.com/sortmerna/sortmerna/issues/340" class="uri">https://github.com/sortmerna/sortmerna/issues/340</a> - <a href="https://github.com/sortmerna/sortmerna/issues/305" class="uri">https://github.com/sortmerna/sortmerna/issues/305</a> - <a href="https://github.com/sortmerna/sortmerna/issues/405" class="uri">https://github.com/sortmerna/sortmerna/issues/405</a> - <a href="https://github.com/sortmerna/sortmerna/issues/326" class="uri">https://github.com/sortmerna/sortmerna/issues/326</a></p>
<p>The last few are more related to resource allocation on HPCs.</p>
<p>So far, the only suggestion I see is to update to use sortmerna v4.3.7.</p>
<p>Someone talked about running it in parallel on several split up files: <a href="https://github.com/sortmerna/sortmerna/issues/413" class="uri">https://github.com/sortmerna/sortmerna/issues/413</a></p>
<p>On this thread they seem to have made a good script for doing the split: <a href="https://github.com/sortmerna/sortmerna/issues/336" class="uri">https://github.com/sortmerna/sortmerna/issues/336</a></p>
<p>One flag i saw that could be helpful is the “–no-best” function, since I’m just trying to see if any sequence aligns to any rRNA, not what specific rRNA it is (see this thread: <a href="https://github.com/sortmerna/sortmerna/issues/437" class="uri">https://github.com/sortmerna/sortmerna/issues/437</a>).</p>
<p>Also I saw this flag get suggested: -threads 8</p>
<p>And, I’m going to put this job back in bigmem instead of general because that could be an issue too.</p>
<p>Ok now nothing is working, not even the original scripts. It actually looks like I may have pre-emptively killed the jobs that were running, because it did look like things were happening in some of the folders.</p>
<p>In the original run where I got the samples with under 2 GB of data to work: - the script had the following flags: –fastx –blast –out2 –sout - they have /out directories - they have “aligned.blast.gz”, “aligned_paired_fwd.fq.gz”, and paired_rev, singleton, other_paired and other_singleton - their .out files (which have the weird RsNA in the name of the file) have something like “[writeReports:268] === done Reports in 2594.41 sec ===” - they have an aligned.log that has a date of completion at the very end</p>
<p>In my latest run, which it appears some worked: - I had removed –blast –out2 –sout. - they do not have /out directories - their .out files have [writeReports:268] === done Reports in 4303.29 sec === - they only have “_non_rRNA.fq.gz” and “_rRNA.fq.gz” - they don’t have an aligned.log, they have an _rRNA.log</p>
<p>Based on Brad’s code for next steps, he uses the other_paired_fwd.fq.gz and other_paired_rev files. So essentially i need the flags –out2 and -sout. I’m not sure if I need the –blast one. but the latest run i was doing only gave a _non_rRNA one.</p>
</section>
<section id="note" class="level2">
<h2 class="anchored" data-anchor-id="note">Note:</h2>
<p>I’m using the default database that sortmerna recommended for alignment: <strong>smr_v4.3_default_db.fasta</strong> - Original source databases (clustering parameters given below): - Silva 138 SSURef NR99 (16S, 18S) - Silva 132 LSURef (23S, 28S) - RFAM v14.1 (5S, 5.8S) bac-16S 90%, 5S &amp; 5.8S seeds, rest 95% (benchmark accuracy: 99.899%)</p>
</section>
<section id="nf-core" class="level2">
<h2 class="anchored" data-anchor-id="nf-core">nf-core</h2>
<p>This program is pre-built with scripts and uses sortmerna. There are a couple of versions: - rnaseq: <a href="https://github.com/nf-core/rnaseq/tree/3.21.0" class="uri">https://github.com/nf-core/rnaseq/tree/3.21.0</a> - denovotranscript: <a href="https://github.com/nf-core/denovotranscript/tree/main" class="uri">https://github.com/nf-core/denovotranscript/tree/main</a></p>
<p>If you go into their GitHub and look at the modules (in the main.nf doc), you’ll see the sortmerna parameters they use.</p>
<p>For denovotranscript:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">sortmerna</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-2">        <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">'--ref '+fastas.join(' --ref ')</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-3">        <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$reads_input</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-4">        <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">--threads</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$task</span>.cpus <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-5">        <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">--workdir</span> . <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-6">        <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">--aligned</span> rRNA_reads <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-7">        <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">--fastx</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-8">        <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">--other</span> non_rRNA_reads <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-9">        <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$paired_cmd</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-10">        <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out2_cmd</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb7-11">        <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$args</span></span></code></pre></div></div>
<p>For rnaseq:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb8-1"> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"""</span></span>
<span id="cb8-2"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">    sortmerna </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-3"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">'--ref '+fastas.join(' --ref ')</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-4"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$refs_input</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-5"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$reads_input</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-6"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        --threads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$task</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">.cpus </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-7"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        --workdir . </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-8"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$reads_args</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-9"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$paired_cmd</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-10"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out2_cmd</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb8-11"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">        </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$args</span></span></code></pre></div></div>
<p>This tells me that you don’t need sortmerna to separate the paire-end reads. You can just get the output file of “_non_rRNA.fq.gz” and “_rRNA.fq.gz” and then Trinity can use those.</p>
<p>only the nf denovotranscript one uses trinity, but it doesn’t give a format for the input file. I would assume its using “reads” as the _non_rRNA fq file. But I need to make sure.</p>
<p>Ok it looks like the sortmerna commands for paired end reads require: –fastx –aligned rRNA_reads –other non_rRNA_reads –paired_in –out2</p>
<p>Then, Trinity will take the _non_rRNA_reads files and use that for assembly.</p>
<p>Also note that nf-core denovotranscript uses fastQC after sortmeRNA to check them.</p>
<p>So in summary, I need to re-run my files because the most recent run did not separate forward and reverse reads. But I think I can keep the originals (&lt;2 GB files) that did work, becuase they have _other_paired fwd and rev files. I would assume that means non rRNA reads.</p>
<p>Ok, I got this script to start running (after removing all the base folders from the samples that didn’t work initially):</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb9-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb9-2"></span>
<span id="cb9-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define directories</span></span>
<span id="cb9-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb9-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb9-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb9-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">readsdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/trimmed_cutadapt"</span></span>
<span id="cb9-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/sortmeRNA"</span></span>
<span id="cb9-9"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">sortdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/sortmerna"</span></span>
<span id="cb9-10"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">scriptdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/sortmerna"</span></span>
<span id="cb9-11"></span>
<span id="cb9-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 trimmed reads</span></span>
<span id="cb9-13"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">||</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">exit</span></span>
<span id="cb9-14"></span>
<span id="cb9-15"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1.trimmed.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb9-16">    <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span>_R1.trimmed.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb9-17"></span>
<span id="cb9-18">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Check if the SortMeRNA out folder exists and has files</span></span>
<span id="cb9-19">    <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">out_folder</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/out"</span></span>
<span id="cb9-20">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">[</span> <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">-d</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out_folder</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">]</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">&amp;&amp;</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">[</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ls</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-A</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$out_folder</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>/dev/null<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">]</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">then</span></span>
<span id="cb9-21">        <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Skipping </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> (output already exists)"</span></span>
<span id="cb9-22">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">continue</span></span>
<span id="cb9-23">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">fi</span></span>
<span id="cb9-24"></span>
<span id="cb9-25">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Write the LSF job script</span></span>
<span id="cb9-26">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${scriptdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb9-27"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb9-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb9-29"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA</span></span>
<span id="cb9-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.err</span></span>
<span id="cb9-31"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.out</span></span>
<span id="cb9-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q bigmem</span></span>
<span id="cb9-33"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 10</span></span>
<span id="cb9-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 48:00</span></span>
<span id="cb9-35"></span>
<span id="cb9-36"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb9-37"></span>
<span id="cb9-38"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/bin/sortmerna </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-39"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --ref </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/sortmerna-4.3.6-Linux/database/smr_v4.3_default_db.fasta </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-40"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-41"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --reads </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${readsdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-42"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --aligned </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-43"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --other </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_non_rRNA </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-44"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --fastx --out2 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb9-45"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --workdir </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${sortdir}</span></span>
<span id="cb9-46"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb9-47"></span>
<span id="cb9-48">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job</span></span>
<span id="cb9-49">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${scriptdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_sortmeRNA.job"</span></span>
<span id="cb9-50"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<section id="update-1" class="level3">
<h3 class="anchored" data-anchor-id="update-1">update:</h3>
<p>the above script only worked for the first sample because there was no subdirectory for the sample folder name………….</p>
<p>and also then I tried to run it with sortmerna 4.3.7 and it failed. so it has to be 4.3.6</p>
<p><img width="456" height="294" alt="Screenshot 2025-09-26 at 1 49 28 PM" src="https://github.com/user-attachments/assets/e5a890e1-f4ee-48a8-9e77-22d1bd47120f"></p>
<p>so close to abandoning this</p>


</section>
</section>

 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>Reciprocal Transplant</category>
  <category>PSTR</category>
  <category>SortMeRNA</category>
  <category>Pegasus</category>
  <guid>https://ademerlis.github.io/posts/2025-09-22-sortme-rna.html</guid>
  <pubDate>Mon, 22 Sep 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Notes on Pstrigosa bioinformatics data analysis</title>
  <link>https://ademerlis.github.io/posts/2025-08-20-notes-on-pstrbioinformatics.html</link>
  <description><![CDATA[ 




<p>Dr.&nbsp;Brad Weiler’s new publication on diel transcriptomics of <em>Pseudodiploria strigosa</em> was just published on bioRxiv <a href="https://www.biorxiv.org/content/10.1101/2025.08.06.668741v1">here</a>, and his pipeline is available now on GitHub <a href="https://github.com/delCampoLab/diel_pstr/blob/main/pstr_diel_rnaseq_submit.Rmd">here</a>.</p>
<p>I want to go through his steps and follow his code since he constructed a <em>de novo</em> transcriptome for <em>P. strigosa</em>.</p>
<p>The sequencing he performed was “Poly-A capture/enrichment methodology by Novogene (Beijing, China) on the 158 Illumina NovaSeq PE 150bp. The methodology follows a standard workflow of fragmentation, reverse 159 transcription, cDNA synthesis, end-repair and A-tailing.”</p>
<p>3’ RNA-Seq doesn’t necessarily equate to Poly-A selection/capture/enrichment. 3’ RNA-Seq can be done with no selection, meaning that it would just sequence the 3’ends of RNA molecules but isn’t targeting molecules with polyA tails. Poly-A selection/capture/enrichment is performed to enrich mRNA molecules over other types or RNA (typically rRNA) that dominate total RNA content.</p>
<p>The question is, did my reciprocal transplant reads get any sort of selection? Looking back through my notes, I don’t see anything about Poly-A selection.</p>
<section id="his-pipeline" class="level2">
<h2 class="anchored" data-anchor-id="his-pipeline">His pipeline:</h2>
<ol type="1">
<li><strong>FastQC</strong></li>
<li>Adapter trimming using <strong>CutAdapt</strong> wrapper script TrimGalore</li>
<li>Ribosomal RNA partitioned from total RNA using <strong>SortMeRNA</strong> and default fasta reference database</li>
<li>Remaining RNA mapped to index of genomes (Ostreobium quekettii, Symbiodinium sp. 57, Breviolum sp. 58, Cladocopium sp. 57, Durusdinium sp. 59 183 , Eimeria tenella, Emitis 184 houghton, Sarcocystis neurona, Toxoplasma gondii, Malassezia restricta, Nitzschia putrida, Gracilaria gracilis, and Uronemita sp.) to isolate non-coral RNA reads using <strong>BBsplit</strong></li>
<li>Unmapped reads concaenated for <em>de novo</em> transcriptome assembly using <strong>Trinity</strong></li>
<li>Decontamination using Standard PlusPF reference database in <strong>Kraken2</strong></li>
<li>Reads aligned to transcriptome using <strong>Salmon</strong></li>
<li><strong>STAR</strong> used to align <em>Breviolum</em> binned reads</li>
<li>Gene transcripts were first predicted into longest open reading frames (ORFs) using <strong>transDecoder</strong></li>
<li>Annotations using <strong>EggNOG-mapper</strong></li>
<li>Gene ontology (GO) annotations supplemented using GoPredSim ProtT5 protein language model 65 195 derived topGO terms using <strong>FANTASIA</strong></li>
</ol>


</section>

 ]]></description>
  <category>Analysis</category>
  <category>Reciprocal Transplant</category>
  <category>Coding</category>
  <category>Pegasus</category>
  <category>rRNA</category>
  <category>De Novo Transcriptome Assembly</category>
  <guid>https://ademerlis.github.io/posts/2025-08-20-notes-on-pstrbioinformatics.html</guid>
  <pubDate>Wed, 20 Aug 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Redoing trimming of reciprocal transplant seqs</title>
  <link>https://ademerlis.github.io/posts/2025-08-04-redo-trimmingof-rtsamplesusing-cutadapt.html</link>
  <description><![CDATA[ 




<p>I realized that I didn’t follow the Lexogen guidelines for trimming sequences from samples that were prepped for cDNA libraries using QuantSeq.</p>
<section id="notes-june-19-2025" class="level3">
<h3 class="anchored" data-anchor-id="notes-june-19-2025">Notes (June 19, 2025)</h3>
<hr>
<ul>
<li>Michael added me to a Box folder from UM Genomics center back in December 2024 - it is called “ReciprocalTransplant_11122024”</li>
<li>each sample has two runs (R1=left and R2=right) which indicate that it’s paired-end reads.</li>
<li>I guess in March 2025 I downloaded the sequences already onto the “2TB” external hard drive and uploaded them to Pegasus. (https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2025-03-07-UploadingReciprocalTransplantSequencestoPegasus.md)</li>
<li>So my 3 different dissertation chapters were sequenced differently, so they need to be analyzed differently.
<ul>
<li>Ch 2 - Acer and Pcli stress-hardening; sequencing done at UT Austin via 3’ Tag-Seq, so I used Michael’s cutadapt trimming specific code to make sure I removed the headers correctly; single-end reads</li>
<li>Ch 3 - Acer; sequencing done at UM Genomics Center through Natalia and Lys’s plate, QuantSeq (3’ RNA-Seq?) — so I used Natalia’s TrimGalore code to ensure I trimmed it how she did it; single-end reads</li>
<li>Ch 4 - Pstr; sequencing done at UM Genomics Center; paired-end reads</li>
</ul></li>
<li>How do I know what to do for these Pstr reads?</li>
<li>Notes on sequencing from emails from Michael and Mia:
<ul>
<li>submit pooled RNA-Seq libraries for sequencing on 1 NovaSeq X PE150 lane per NOAA contract 1333MJ24P0082. Based on the pooling calculations, putting in 50 fmol per 96 samples will yield ~550 uL. 50 fmol per sample would result in a final pooled molarity of 8.72 nM in 550 uL.</li>
<li>the libraries were pooled and sequenced on an Illumina platform (Illumina NovaSeq X, PE150 mode)</li>
</ul></li>
<li>Notes from Lexogen (because cDNA libraries were prepared using QuantSeq FWD kit)
<ul>
<li>https://faqs.lexogen.com/faq/can-i-use-paired-end-sequencing-for-quantseq-fwd-l
<ul>
<li>“Paired-end (PE) sequencing is typically not recommended for QuantSeq FWD (Cat. No.&nbsp;191 - 196), as the quality of Read 2 is very low due to the poly(T) stretch at the beginning of Read 2.</li>
<li>Nevertheless, QuantSeq FWD libraries can be sequenced in PE mode (i.e., 150bp) but in this case, we recommend discarding Read 2 data and proceeding with Read 1 data only for downstream data analysis (i.e., use only Read 1 for trimming, alignment, read counting, and downstream analyses).”</li>
</ul></li>
<li>https://faqs.lexogen.com/faq/what-sequences-should-be-trimmed
<ul>
<li>they have specific cutadapt flags that they recommend</li>
</ul></li>
</ul></li>
</ul>
</section>
<section id="notes-from-chatgpt-august-4-2025" class="level3">
<h3 class="anchored" data-anchor-id="notes-from-chatgpt-august-4-2025">Notes from ChatGPT (August 4, 2025)</h3>
<hr>
<p>So my sequences were prepared using the cDNA libary kit from Lexogen (<strong>QuantSeq FWD kit</strong>), and were sequenced on an Illumina platform (<strong>NovaSeq X, PE150 mode</strong>).</p>
<p>ChatGPT said that there are trimming steps required for both QuantSeq and NovaSeq, which were not specifically captured in the TrimGalore script that I previously used (see below):</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#define variables for directories and files</span></span>
<span id="cb1-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb1-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb1-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics/reciprocaltransplant"</span></span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files"</span></span>
<span id="cb1-9"></span>
<span id="cb1-10"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">($(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ls</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>.fastq.gz<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">))</span></span>
<span id="cb1-11"></span>
<span id="cb1-12"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> samp <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[@]</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb1-13"></span>
<span id="cb1-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#build script</span></span>
<span id="cb1-15"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"making TrimGalore script for </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">..."</span></span>
<span id="cb1-16"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb1-17"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb1-18"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb1-19"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_trim</span></span>
<span id="cb1-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_trim.err</span></span>
<span id="cb1-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_trim.out</span></span>
<span id="cb1-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q general</span></span>
<span id="cb1-23"></span>
<span id="cb1-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\"</span></span>
<span id="cb1-25"></span>
<span id="cb1-26"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/programs/TrimGalore-0.6.10/trim_galore </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> --illumina --cores 4 --three_prime_clip_R1 12 --three_prime_clip_R2 12 --nextseq 30 --length 20</span></span>
<span id="cb1-27"></span>
<span id="cb1-28"></span>
<span id="cb1-29"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span>/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span>_trim.job</span>
<span id="cb1-30"></span>
<span id="cb1-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#submit script</span></span>
<span id="cb1-32"></span>
<span id="cb1-33"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span>/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span>_trim.job</span>
<span id="cb1-34"></span>
<span id="cb1-35"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>The flags <code>--illumina --cores 4 --three_prime_clip_R1 12 --three_prime_clip_R2 12 --nextseq 30 --length 20</code>are simple for trimming, but have a couple of limitations.</p>
<ul>
<li>The –illumina flag tells TrimGalore to look for Illumina adapters, but isn’t specific.</li>
<li>the –three_prime_clip hard-trims 12 bases from the 3’ ends, but doesn’t do a soft-trim.</li>
<li>–nextseq 30 trims G tails due to NextSeq chemistry, which creates a poly-G artifact from 2-color sequencing, using a Q30 cutoff. This is important for Illumina NextSeq/NovaSeq</li>
<li>–length just discards reads shorter than 20 bp.</li>
</ul>
<p>Lexogen’s trimming strategy does multiple passes, and is more specific with adapters.</p>
<p>Also, as per Lexogen’s suggestion, read 2 (R2) is pretty much useless for downstream analysis, so I am not going to work on trimming those anymore. I’m going to move them all into a subfolder in Pegasus and stop processing them. - But this begs the question then, do people use them in de novo transcriptome sequencing?? When they’re using paired-end reads, what kind of reads/sequencing were they doing to be able to do that?</p>
<p>I may need to complete my literature review before I keep going through this.</p>
<p>The lower-quality reads of R2 is in agreement with what is seen in the multiQC report even following trimming (see screenshot below and MultiQC report <a href="https://github.com/ademerlis/reciprocaltransplant/blob/main/gene_expression/multiqc_reports/multiqc_report_trimmedreads.html">here</a>), at least for the mean quality scores. The 97 green sequences are all the R1s.</p>
<p><img width="1453" height="668" alt="Screenshot 2025-08-04 at 4 10 57 PM" src="https://github.com/user-attachments/assets/a9bc84fe-225d-4788-92eb-c67400341fcd"></p>
</section>
<section id="new-trimming-script-using-lexogen-parameters" class="level2">
<h2 class="anchored" data-anchor-id="new-trimming-script-using-lexogen-parameters">New Trimming Script Using Lexogen Parameters</h2>
<hr>
<p>ChatGPT suggests using this script to specifically trim the QuantSeq + NovaSeq specific artifacts.</p>
<p>Lexogen QuantSeq FWD specific parameters: <a href="https://faqs.lexogen.com/faq/what-sequences-should-be-trimmed">link to their website</a></p>
<ul>
<li>Trims specific adapters</li>
<li>Soft-clipping of read ends</li>
<li>removing polyA (20 As) and polyG (20 Gs)</li>
<li>NextSeq trim of 10 (NovaSeq specific poly-G artifacts)</li>
</ul>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define project directories and paths</span></span>
<span id="cb2-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb2-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb2-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/reciprocaltransplant"</span></span>
<span id="cb2-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">rawdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/raw_seq_files/rawreads"</span></span>
<span id="cb2-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">logdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/trimming_cutadapt"</span></span>
<span id="cb2-9"></span>
<span id="cb2-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${rawdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-11"></span>
<span id="cb2-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Loop through R1 files</span></span>
<span id="cb2-13"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r1 <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>_R1_001.fastq.gz<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span></span>
<span id="cb2-14">  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Extract sample base name (e.g., "Pstr-Dec2022-202")</span></span>
<span id="cb2-15">  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">base</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-E</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/_S[0-9]+_L00[1-9]_R[12]_001\.fastq\.gz//'</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span></span>
<span id="cb2-16"></span>
<span id="cb2-17">  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">r2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1_</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>_R2_<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-18"></span>
<span id="cb2-19">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Creating cutadapt trim script for </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">..."</span></span>
<span id="cb2-20"></span>
<span id="cb2-21">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Write the job script</span></span>
<span id="cb2-22">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;&lt;EOF</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/trimming_cutadapt/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_cutadapt_trim.job"</span></span>
<span id="cb2-23"></span>
<span id="cb2-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#!/usr/bin/env bash</span></span>
<span id="cb2-25"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb2-26"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_cutadapt_trim</span></span>
<span id="cb2-27"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_cutadapt_trim.err</span></span>
<span id="cb2-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${logdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_cutadapt_trim.out</span></span>
<span id="cb2-29"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q general</span></span>
<span id="cb2-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 4</span></span>
<span id="cb2-31"></span>
<span id="cb2-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd "</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${rawdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-33"></span>
<span id="cb2-34"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Step 1: Remove polyA tails and G homopolymers</span></span>
<span id="cb2-35"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cutadapt -m 20 -O 20 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-36"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -a "polyA=A{20}" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-37"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -a "QUALITY=G{20}" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-38"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -n 2 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-39"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step1.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-40"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -p </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step1.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-41"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r1}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${r2}</span></span>
<span id="cb2-42"></span>
<span id="cb2-43"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Step 2: Trim NextSeq-specific poly-G tails and partial adapter sequences</span></span>
<span id="cb2-44"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cutadapt -m 20 -O 3 --nextseq-trim=10 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-45"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -a "r1adapter=A{18}AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC;min_overlap=3;max_error_rate=0.1" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-46"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -A "r2adapter=AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT;min_overlap=3;max_error_rate=0.1" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-47"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step2.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-48"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -p </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step2.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-49"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step1.fastq.gz </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step1.fastq.gz</span></span>
<span id="cb2-50"></span>
<span id="cb2-51"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Step 3: Remove full-length adapter contaminations</span></span>
<span id="cb2-52"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cutadapt -m 20 -O 20 </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-53"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -g "r1adapter=AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC;min_overlap=20" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-54"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -G "r2adapter=AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT;min_overlap=20" </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-55"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  --discard-trimmed </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-56"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-57"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  -p </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.trimmed.fastq.gz </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\\</span></span>
<span id="cb2-58"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">  </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step2.fastq.gz </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step2.fastq.gz</span></span>
<span id="cb2-59"></span>
<span id="cb2-60"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"># Clean up intermediate files (optional)</span></span>
<span id="cb2-61"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">rm </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step1.fastq.gz </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step1.fastq.gz</span></span>
<span id="cb2-62"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">rm </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R1.step2.fastq.gz </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_R2.step2.fastq.gz</span></span>
<span id="cb2-63"></span>
<span id="cb2-64"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">EOF</span></span>
<span id="cb2-65"></span>
<span id="cb2-66">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Submit the job</span></span>
<span id="cb2-67">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scripts/trimming_cutadapt/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${base}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_cutadapt_trim.job"</span></span>
<span id="cb2-68"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>Submitted this, and it seems to be working!</p>
<p>Update: this was submitted on 1 core for cutadapt rather than 4 cores (thanks ChatGPT…) so it’s taking a really long time. I’m debating killing the jobs and re-running it since it’s 3 passes too.</p>
<p>I killed it and rewrote it to use 4 cores. This just requires adding “-j 4” after “cutadapt”</p>
<p>Update: I don’t think this did anything because in the job script it already specified 4 nodes.</p>
<p>from job submission time to finished trimmed read for a sample = 67 minutes</p>
<p>It ended up finishing the last sample at 8:48 pm. so that took ~8 hours to complete.</p>


</section>

 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>Reciprocal Transplant</category>
  <category>RNA-Seq</category>
  <category>Trimming</category>
  <category>Cutadapt</category>
  <category>Pegasus</category>
  <guid>https://ademerlis.github.io/posts/2025-08-04-redo-trimmingof-rtsamplesusing-cutadapt.html</guid>
  <pubDate>Mon, 04 Aug 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>denovo Transcriptome Assembly for Pstr</title>
  <link>https://ademerlis.github.io/posts/2025-07-25-denovo-transcriptome-assembly-pstr.html</link>
  <description><![CDATA[ 




<p>I don’t have a reference genome or transcriptome to align the Chapter 3 reads of <em>P.strigosa</em> to for the reciprocal transplant study, so I need to generate a <em>de novo</em> transcriptome using the reads from the study.</p>
<p>However, I can’t find a consensus on how many samples from the study to use. I have 192 sequence files - a forward and reverse read for each sample, or which there is 96 of them.</p>
<p>Should I be using all of them? Won’t that be time/resource intensive? Is that even necessary?</p>
<section id="github-workflows" class="level2">
<h2 class="anchored" data-anchor-id="github-workflows">GitHub Workflows</h2>
<p>There are a few GitHub workflows I have been looking at for using Trinity: 1) <a href="https://github.com/hputnam/Apulchra_genome/blob/main/RNA_Seq_Info/2023-08-31-Acropora-pulchra-denovo-transcriptome.md">Dr.&nbsp;Jill Ashey</a> 2) <a href="https://robertslab.github.io/resources/bio_Transcriptome-assembly/">Roberts lab</a> 3) <a href="https://github.com/trinityrnaseq/trinityrnaseq/wiki/Transcriptome-Assembly-Quality-Assessment">Trinity GitHub Repository</a> 4) <a href="https://github.com/trinityrnaseq/RNASeq_Trinity_Tuxedo_Workshop/wiki/Trinity-De-novo-Transcriptome-Assembly-Workshop">Trinity de novo Transcriptome assembly workshop</a> 5) <a href="https://github.com/MaineINBRE/Trinity2.8.4Marconi/blob/master/assembly.md">Shrimp project</a></p>
<p>None of the above workflows specify if there is a min/max amount of sequence files to use. Dr.&nbsp;Jill Ashey used 12 samples (6 forward, 6 reverse). I emailed Jill and she recommended: &gt; “I think that for Trinity, the number of samples isn’t as important as the number of reads. Typically, RNAseq samples have about 20-50M reads per sample. If we are going off the Trinity recommendation that 50M is saturated, we would only need a few samples for the transcriptome. When creating a de novo transcriptome for a species that doesn’t have any genomic resources, I personally think that it’s better to include more samples across a range of conditions (n=3-5 per condition) so that more transcripts can be captured across the board and a proper meta-transcriptome can be assembled.”</p>
<p>From <a href="https://www.nature.com/articles/nbt.1883#MOESM13">Grabherr et al.&nbsp;2011 (the first Trinity publication)</a>, they state that 50 M pairs of reads is enough for Trinity to fully reconstruct 86% of annotated transcripts. The authors say that after 50 M paired reads, it is “saturated” or doesn’t require any more data.</p>
<p><a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC3875132/">Haas et al.&nbsp;2014 (the newer Trinity publication)</a> doesn’t talk about this.</p>
</section>
<section id="de-novo-transcriptome-assembly-publications" class="level2">
<h2 class="anchored" data-anchor-id="de-novo-transcriptome-assembly-publications"><em>de novo</em> transcriptome assembly publications</h2>
<ol type="1">
<li><a href="https://doi.org/10.1093/bib/bbab563">Raghavan et al.&nbsp;2022</a> -
<ul>
<li>this paper has good conceptual figures</li>
<li>recommends in-silico normalization</li>
<li>Trinity is De Bruijn graph-based</li>
<li>post-assembly QC is important
<ul>
<li>N50 value is a common sequence length statistic</li>
<li>however, N50 value should be used with caution - the ExN50 is a better modification for transcriptome assemblies because the recovery has been for short full-length sequences, rather than few, very long contigs</li>
<li>ExN50 = expression-weighted sum of corresponding isoform lengths</li>
<li>this metric is only implemented for Trinity</li>
<li>the fraction of all reads that map back to the assembly</li>
<li>proportion of reads that map to multiple sequences should be low</li>
<li>BUSCO (Benchmarking Universal Single-Copy Orthologs) is another good tool to determine if a large majority of orthologs are found to the assembled transcriptome. Looking for “universal” genes. General rule is a good BUSCO completeness score is &gt;80%</li>
<li>Tools for QC include TransRate, DETONATE, and rnaQUAST</li>
</ul></li>
</ul></li>
</ol>
</section>
<section id="coral-papers-that-construct-de-novo-transcriptomes" class="level2">
<h2 class="anchored" data-anchor-id="coral-papers-that-construct-de-novo-transcriptomes">Coral papers that construct <em>de novo</em> transcriptomes</h2>
<p>** Important note though - none of these used 3’ RNA-seq. Some did polyA enrichment, but total RNA seq (so better coverage of the transcriptome, not end-targeted).</p>
<ol type="1">
<li><a href="https://www.nature.com/articles/s41598-022-22604-3">Alderdice et al.&nbsp;2022</a> -
<ul>
<li>Paired end reads (150bp) from <em>Acropora</em></li>
<li>SOAPdenovo-Trans for 23-kmer length was used for de novo transcriptome assembly from <strong>all samples</strong>.</li>
<li>Number of samples: 32</li>
<li>Extraction protocol: Qiagen RNeasy mini kit</li>
<li>Sequencing: NovaSeq 6000</li>
</ul></li>
<li><a href="https://onlinelibrary.wiley.com/doi/full/10.1002/ece3.9345">Lock et al.&nbsp;2022</a> -
<ul>
<li>Paired end reads (150bp) from <em>Porites lobata</em></li>
<li>All reads combined and normalized using in-silico normalization from Trinity</li>
<li>All samples/reads used for de novo transcriptome assembly with Trinity</li>
<li>Number of samples: 60</li>
<li>Extraction protocol: NEBNext Ultra RNA Library Prep Kit (New England Biolabs)</li>
<li>Sequencing: NextSeq 500</li>
</ul></li>
<li><a href="https://doi.org/10.3389/fmars.2019.00121">Poquita-Du et al.&nbsp;2019</a> -
<ul>
<li><em>Pocillopora acuta</em></li>
<li>All sequence reads from the same genotype (so 12 samples?) were combined and assembled de novo using Trinity – each genotype got their own individual reference assembly</li>
<li>Number of samples: 36</li>
<li>Extraction protocol: TRIzol following Barshis et al.&nbsp;2013</li>
<li>Sequencing: Illumina-based cDNA library prep + Illumina HiSeq 2500</li>
</ul></li>
<li><a href="https://doi.org/10.1007/s00338-020-01902-0">Poquita-Du et al.&nbsp;2020</a> -
<ul>
<li>they used the same sequencing data as in #3, but this paper focuses on the symbiont reads (which they obtained from the same de novo assembly)</li>
</ul></li>
<li><a href="http://dx.doi.org/10.7717/peerj.1616">Anderson et al.&nbsp;2016</a> -
<ul>
<li><em>Orbicella faveolata</em></li>
<li>TRIzol extractions</li>
<li>Illumina GAIIx sequencing</li>
<li>Trinity used for de novo assembly</li>
<li>6 samples were used, with 3 of them being from diseased coral and 1 being from a bleached coral</li>
</ul></li>
<li>[Veglia et al.&nbsp;2018](https://doi.org/10.1016/j.margen.2018.08.003 -
<ul>
<li>high quality reference genome of <em>Agaricia lamarcki</em></li>
<li>TRIzol extraction</li>
<li>Total RNA sequenced on Illumina Highseq4000 for poly-A tail seelction and 150bp paired-end reads</li>
<li>They used a de novo transcriptome assembly pipeline (http://github.com/NCGAS/de-novo-transcriptome-assembly-pipeline) that tests all the different assembly softwares (Trinity, SOAPdenovo-Trans, Velvet, Oases, Trans-ABySS) - combines all those assemblies together. Then, a “clean consensus” transcriptome was generated using EvidentialGene.</li>
<li>Looks like it is just 1 tissue sample</li>
</ul></li>
</ol>


</section>

 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>De Novo Transcriptome Assembly</category>
  <category>Trinity</category>
  <category>Pseudodiploria strigosa</category>
  <category>Reciprocal Transplant</category>
  <guid>https://ademerlis.github.io/posts/2025-07-25-denovo-transcriptome-assembly-pstr.html</guid>
  <pubDate>Fri, 25 Jul 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Addressing reviewer comments for stress-hardening paper</title>
  <link>https://ademerlis.github.io/posts/2025-07-01-addressingreviewercommentsforstress-hardeningpaper.html</link>
  <description><![CDATA[ 




<p>A reviewer had a concern about the intra-genotypic variation in the Acer and Pcli stress-hardening manuscript that I submitted to Ecology and Evolution (see figure below).</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/3dc8fb77-0745-4bcc-b599-846f1012aa7a.png" class="img-fluid figure-img"></p>
<figcaption>image</figcaption>
</figure>
</div>
<p>At first I thought they were referring to genotypic variation in general, which I did report p-values for because genotype was a factor in the PERMANOVA. But, I think their concern is specifically for within a treatment, the samples of a given genotype are far apart on the PCoA.</p>
<p>So then I asked ChatGPT if there was a test to do that, and of course it had an answer - use “PERMDISP” to assess “multivariate homogeneity of group dispersions.” In the vegan package, there is a function called “betadisper” and you can select the grouping variable you want to assess. It’s kind of like the Levene’s test for multivariate analyses.</p>
<p>So I ran this for genotype for Acer host gene expression first:</p>
<p>First run the PCoA function to make sure it’s making the same PCoA as the manuscript and also to make sure the variables are all loaded.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">load</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rdata_files/host/initial_fullddsdesigncountsVsdcounts.RData"</span>)</span>
<span id="cb1-2">ad.pcoa<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pcoa</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dist</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">t</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">assay</span>(Vsd)),<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"manhattan"</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000</span>)</span>
<span id="cb1-3">scores<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span>ad.pcoa<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>vectors</span>
<span id="cb1-4">ad.pcoa<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>values <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># the % variation explained by each axis is the Relative_eig column</span></span>
<span id="cb1-5">conditions<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span>design</span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scale_color_manual</span>(<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">values =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FF3333"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#00CCCC"</span>))</span>
<span id="cb1-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#code by group</span></span>
<span id="cb1-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">pdf</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PCoA_Treatment_Genotype.pdf"</span>)</span>
<span id="cb1-10"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot</span>(scores[,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], scores[,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pch=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>)[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Genotype))], <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#00CCCC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FF3333"</span>)[<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.numeric</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.factor</span>(conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Treatment))], <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">xlab=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PC1: 20%"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">ylab=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PC2: 11%"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">main=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>)</span>
<span id="cb1-11"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ordispider</span>(scores[,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>], conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Treatment,<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">col=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#00CCCC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FF3333"</span>))</span>
<span id="cb1-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">legend</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"topright"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Initial"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variable"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">fill =</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#00CCCC"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"grey"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#FF3333"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">bty=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"n"</span>)</span>
<span id="cb1-13"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">legend</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"topleft"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">legend=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"BC-8b"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"MB-B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"SI-C"</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">pch=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">c</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>), <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">bty=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"n"</span>)</span>
<span id="cb1-14"></span>
<span id="cb1-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#analysis of variance </span></span>
<span id="cb1-16">ad<span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">adonis2</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">t</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">assay</span>(Vsd))<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span>Genotype<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span>Treatment,<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">data=</span>conditions,<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"manhattan"</span>, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">permutations=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e6</span>)</span>
<span id="cb1-17">ad</span>
<span id="cb1-18"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">as.data.frame</span>(ad) <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%&gt;%</span> </span>
<span id="cb1-19">  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">write_csv</span>(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PERMANOVA_Acer.csv"</span>)</span>
<span id="cb1-20"></span>
<span id="cb1-21"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#analysis of dispersion (within-group variation)</span></span>
<span id="cb1-22"></span>
<span id="cb1-23"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Test for differences in dispersion by genotype</span></span>
<span id="cb1-24">dist_mat <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> (<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dist</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">t</span>(<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">assay</span>(Vsd)),<span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">method=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"manhattan"</span>)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000</span>)</span>
<span id="cb1-25">dispersion_genotype <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">betadisper</span>(dist_mat, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">group =</span> conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Genotype)</span>
<span id="cb1-26"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(dispersion_genotype)</span>
<span id="cb1-27"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">permutest</span>(dispersion_genotype)</span>
<span id="cb1-28"></span>
<span id="cb1-29"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># You can also visualize</span></span>
<span id="cb1-30"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot</span>(dispersion_genotype)</span>
<span id="cb1-31"></span>
<span id="cb1-32"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">TukeyHSD</span>(dispersion_genotype)</span>
<span id="cb1-33"></span>
<span id="cb1-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Test for differences in dispersion by genotype within a treatment</span></span>
<span id="cb1-35">conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Geno_Treatment <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">paste</span>(conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Genotype, conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Treatment, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">sep=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"_"</span>)</span>
<span id="cb1-36">dispersion_geno_treatment <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">betadisper</span>(dist_mat, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">group =</span> conditions<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span>Geno_Treatment)</span>
<span id="cb1-37"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">anova</span>(dispersion_geno_treatment)</span>
<span id="cb1-38"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">permutest</span>(dispersion_geno_treatment)</span>
<span id="cb1-39"></span>
<span id="cb1-40"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># You can also visualize</span></span>
<span id="cb1-41"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">plot</span>(dispersion_geno_treatment)</span>
<span id="cb1-42"></span>
<span id="cb1-43"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">TukeyHSD</span>(dispersion_geno_treatment)</span></code></pre></div></div>
<p>When I just run genotype and don’t separate out treatments, it is not significant.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/247e38f1-fa60-44b3-a257-219945f23ad6.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-07-01 at 9 01 33 AM</figcaption>
</figure>
</div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/5defda68-220f-4fb6-b236-80c4da2bc611.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-07-01 at 9 02 01 AM</figcaption>
</figure>
</div>
<p>But then when I run the Tukey, while it is still not significant, you can see that is comparing the different groups - the different genotypes. So it isn’t actually assessing within-genotype differences, it’s comparing the dispersion between genotypes.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/8a3e08d4-2471-4d00-a232-e59b8f3045fe.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-07-01 at 9 02 14 AM</figcaption>
</figure>
</div>
<p>That’s not what I want. And I guess that’s also the point of the Levene’s test, is that you’re comparing the homogeneity of variation between groups - is the dispersion of one sample group similar to the dispersion of the other?</p>
<p>What the reviewer is asking is, within a sample group, why are the samples so different? Is that statistically significant?</p>
<p>So then I ask ChatGPT again, and this time it tells me to use “anosim” for within-group structure, or substructure, within a grouping variable (in this case, treatment).</p>
<p>But I don’t think that’s what I want either? Because that sounds like then it is testing whether treatment is significant within a given genotype.</p>
<p>The last option that ChatGPT gives me is to do a custom permutation test to evaluate whether a genotype is particularly dispersed, compared to a null expectation. I am wary of trying that because the code it provided me creates a random gene set based on the genes in my data set, and then compares dispersion of my genotypes to the random set. I could do that I guess, but 1) it’s time consuming and 2) I don’t think that will actually prove anything.</p>
<p>Essentially, there is going to be inherent variation between samples. I don’t know how to statistially show that, but that’s the point of having biological replicates so that you get a mean across all the samples. I think if someone was to even sample the same coral at the same time point, you would still get some sort of difference between samples on a PCoA. Obviously you would hope that it wouldn’t be more different than the treatment effect, but there will still be some difference. The samples won’t be right on top of each other.</p>
<p>I think I will attach the PCA graph as another visualization, which shows much less spread and may be what the reviewer is more used to seeing.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/3195827e-e1a4-467a-936a-f8a852befcee.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-07-01 at 9 13 04 AM</figcaption>
</figure>
</div>



 ]]></description>
  <category>Analysis</category>
  <category>Coding</category>
  <category>Ch2 Temp Variability</category>
  <category>Stress-Hardening</category>
  <category>DESeq2</category>
  <category>PCoA</category>
  <guid>https://ademerlis.github.io/posts/2025-07-01-addressingreviewercommentsforstress-hardeningpaper.html</guid>
  <pubDate>Tue, 01 Jul 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Using gitignore file for GitHub public repository</title>
  <link>https://ademerlis.github.io/posts/2025-04-10-using-gitignore-file-for-git-hub-public-repository.html</link>
  <description><![CDATA[ 




<p>I recently had to make all of my files for the <a href="https://github.com/ademerlis/temperaturevariabilityAcerPcli/tree/main">temperaturevariabilityAcerPcli</a> publicly available because I was making my repository public for publication, and I needed to transfer a bunch of the files from one computer to the other.</p>
<p>To do this, I deleted my .gitignore file on the old computer which had all the files saved locally, and then pushed everything to GitHub and downloaded it all to my new computer. But then I was having trouble removing those files listed in my .gitignore file again.</p>
<p>The code I ended up running (which worked) in the terminal was:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">nano</span> .gitignore</span>
<span id="cb1-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> ls-files <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--exclude-from</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>.gitignore <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-z</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">xargs</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-0</span> git rm <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--cached</span></span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> status</span>
<span id="cb1-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> commit <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-m</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Stop tracking files listed in .gitignore"</span></span>
<span id="cb1-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> push</span></code></pre></div></div>



 ]]></description>
  <category>Processing</category>
  <category>Coding</category>
  <category>Git</category>
  <category>GitHub</category>
  <guid>https://ademerlis.github.io/posts/2025-04-10-using-gitignore-file-for-git-hub-public-repository.html</guid>
  <pubDate>Thu, 10 Apr 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Downloading sequences from Box</title>
  <link>https://ademerlis.github.io/posts/2025-03-07-uploading-reciprocal-transplant-sequencesto-pegasus.html</link>
  <description><![CDATA[ 




<p>I tried some different methods for downloading the Chapter 3 Reciprocal Transplant experiment .fastq.gz sequences from Box, and realized that there isn’t a way to download/upload the raw sequences from Box without locally downloading them to my computer (which would take 100s of GBs of space). So, I think my best bet is to use the computer in the NTK lab to download them locally, then upload them to Pegasus.</p>
<p>Things that I tried that didn’t work: downloading some sort of Box CLI and trying to remotely access it via Pegasus.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1">curl <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>L https<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">//</span>downloads.boxcdn.net<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>boxcli<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>latest<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>BoxcliInstaller.run <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> bash\n</span>
<span id="cb1-2">brew install rclone\n</span>
<span id="cb1-3">nano <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.bash_profile</span>
<span id="cb1-4">source <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.bash_profile</span>
<span id="cb1-5">ls</span>
<span id="cb1-6">brew install rclone\n</span>
<span id="cb1-7">rclone config</span>
<span id="cb1-8">rclone lsd</span>
<span id="cb1-9">rclone lsd Box<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span></span>
<span id="cb1-10">less <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.config<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone.conf</span>
<span id="cb1-11">scp <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.config<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone.conf and128<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span>pegasus.ccs.miami.edu<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>scratch<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>projects<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>and_transcriptomics<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#tried moving the configuration file from my computer to pegasus</span></span>
<span id="cb1-12"></span>
<span id="cb1-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># on Pegasus</span></span>
<span id="cb1-14">module load rclone <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#rclone is already installed, but it doesn't have Box available</span></span>
<span id="cb1-15">module list</span>
<span id="cb1-16">rclone <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>V</span>
<span id="cb1-17">rclone config</span>
<span id="cb1-18">mv rclone.conf <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.config<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span></span>
<span id="cb1-19">rclone lsd box<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span></span>
<span id="cb1-20">touch <span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">/</span>.config<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span>rclone.conf</span></code></pre></div></div>
<p>There is a <a href="https://acs-docs.readthedocs.io/services/2-transfer.html">section about remote transferring on the Pegasus website</a>.</p>
<p>It also still says you can use FileZilla, but when I try going to the FileZilla website on the “UMiamiWireless” wifi on campus, the page is blocked. I need to be on this wifi to access Pegasus, so I don’t know a workaround for that.</p>
<p>(wait can’t I just download FileZilla locally when on a different wifi and then try it)…</p>
<p>Regardless, I think using FileZilla would still require locally downloaded files from Box.</p>
<section id="march-12-update" class="level2">
<h2 class="anchored" data-anchor-id="march-12-update">March 12 Update:</h2>
<p>I successfully downloaded sequences from Box drive to 2TB hard drive using the Cnidarian Immunity mini mac. It took about half a day (once I plugged in the ethernet cable).</p>
<p>I used “rsync” to have it give me updates in the terminal for each file, which i found really helpful.</p>
<p>this worked:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rsync</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-ah</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--progress</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--partial</span> . <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/Volumes/2TB/Ch3_RT"</span></span></code></pre></div></div>
<p>Today, I’m using rsync again to transfer all files from 2TB to Pegasus scratch space (and_transcriptomics).</p>
<p>this is working:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">rsync</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-ah</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--progress</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--partial</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-e</span> ssh <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/Volumes/2TB/Ch3_RT"</span> and128@pegasus.ccs.miami.edu:/scratch/projects/and_transcriptomics/reciprocaltransplant/raw_seq_files</span></code></pre></div></div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/be313172-dda8-4a7f-9690-a7eb8b15569b.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-03-12 at 2 34 36 PM</figcaption>
</figure>
</div>
<p>What’s weird is the .gz files on Pegasus are now green instead of red. But when i check the md5sum values for the original file and the transferred file, they match. So I guess there’s no loss in file integrity, idk what else it could be.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/user-attachments/assets/5a43ac23-53b2-4466-aa1d-b4070c1fd0d2.png" class="img-fluid figure-img"></p>
<figcaption>Screenshot 2025-03-12 at 2 35 06 PM</figcaption>
</figure>
</div>
<p>When I run this, I get this: “gzip compressed data, extra field”</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">file</span> Pstr-Dec2022-164_S46_L001_R1_001.fastq.gz</span></code></pre></div></div>
<p>So whatever, it’s fine I guess.</p>


</section>

 ]]></description>
  <category>Bioinformatics</category>
  <category>Pegasus</category>
  <guid>https://ademerlis.github.io/posts/2025-03-07-uploading-reciprocal-transplant-sequencesto-pegasus.html</guid>
  <pubDate>Fri, 07 Mar 2025 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Downloading sequences from Basespace and uploading sequences to NCBI</title>
  <link>https://ademerlis.github.io/posts/2024-10-18-downloading-sequences-from-basespace-uploadingto-ncbi.html</link>
  <description><![CDATA[ 




<p>NOTE: There is a great tutorial and overview from Danielle Becker in Dr.&nbsp;Hollie Putnam’s lab on their GitHub lab notebook <a href="https://github.com/Putnam-Lab/Lab_Management/blob/master/Bioinformatics_%26_Coding/Data_Mangament/SRA-Upload_Protocol.md">here</a>.</p>
<p>I got these errors for some of the sequence files when I tried to upload them to NCBI:</p>
<p><img width="500" alt="Screen Shot 2024-10-18 at 10 20 17 AM" src="https://github.com/user-attachments/assets/7c7d0ba2-cf22-48f5-9213-957fcc5ac44c"></p>
<p>And when I emailed NCBI, they said this:</p>
<p><img width="500" alt="Screen Shot 2024-10-18 at 10 20 52 AM" src="https://github.com/user-attachments/assets/165df4c8-9250-4c65-9307-3e7d586275f0"></p>
<p>Michael Studivan also ran into this issue when he was uploading files to NCBI for a project. He said what solved it was finding the original files and uploading them directly.</p>
<p>I tried that already from downloading them from the Basespace website to my local drive, then uploading them again. That didn’t help. But what did seem to do something was if i gunzipped the file, then changed the metadata table so the file name was <code>.fastq</code> instead of <code>.fastq.gz</code>, and then uploaded the file. However, now it looks like there is another file that doesn’t work anymore.</p>
<p><img width="500" alt="Screen Shot 2024-10-18 at 12 20 48 PM" src="https://github.com/user-attachments/assets/b20affa1-a8ff-4bec-a49c-794b8c14d244"></p>
<p>What’s annoying is it doesn’t seem to show me the full list of samples. So I really can’t tell if it’s all the Pcli samples, or just the ones listed there.</p>
<p>I’m going to try to download all the Pcli files directly from Basespace using Michael’s command line code (<a href="https://github.com/mstudiva/tag-based_RNAseq/blob/master/tagSeq_processing_README.txt">here</a>).</p>
<p>I think Michael’s code is outdated, so I found the BaseSpace CLI tutorial on Illumina <a href="https://developer.basespace.illumina.com/docs/content/documentation/cli/cli-overview">here</a>.</p>
<pre><code># if you have not previously, download BaseSpaceCLI
wget "https://api.bintray.com/content/basespace/BaseSpaceCLI-EarlyAccess-BIN/latest/\$latest/amd64-linux/bs?bt_package=latest" -O $HOME/bin/bs # this didn't work
chmod +x ~/bin/bs

#download via homebrew
brew tap basespace/basespace &amp;&amp; brew install bs-cli

export PATH="/opt/homebrew/bin:$PATH"

echo '#!/bin/bash' &gt; downloadReads.sh
echo 'bs download project --concurrency=high -q -n JA23031 -o . | grep "Pcli" ' &gt;&gt; downloadReads.sh
# -n is the BaseSpace project name and -o is the output directory

chmod +x downloadReads.sh

bs --version
# BaseSpaceCLI 1.6.1 -- built on 2024-07-23 at 09:33

bs auth
# has you go to the illumina website and sign in

./downloadReads.sh</code></pre>
<p>The grep Pcli part didn’t work but all the files are downloading very slowly. It looks like you can’t specify which files to download</p>
<pre><code>bs list datasets --filter-term=".*Pcli.*"
#this lists only the basespace files for Pcli

bs download project -n JA23031 --exclude '.*Acer.*'</code></pre>
<p>I also don’t have space on my computer to download them locally. I have about 10 GB left of space on my computer. I can’t decide whether it is worth it to try gunzipping and reuploading all the Pcli ones as fastq files to NCBI, or whether it is better to just try to redownload all the sample files from Illumina Basespace using the command line interface (CLI). I’m going to try to redownload all the files directly to an external hard drive and see how that goes.</p>
<hr>
<p><strong>Update:</strong> I think I successfully downloaded all 96 sequence files (.fastq.gz) onto the 2TB external hard drive on Nov 5. When they download from Basespace, each sequence file is in its own subdirectory. For uploading to NCBI, all the sequence files have to be in one directory, no subfolders. So, I ran these two lines of code from Michael to easily fix that:</p>
<pre><code>find . -name '*.gz' -exec mv {} . \;
rmdir SA*</code></pre>
<hr>
<section id="nov-25" class="level2">
<h2 class="anchored" data-anchor-id="nov-25">Nov 25:</h2>
<p>I finally finished uploading all the sequence files using ftp from the external hard drive, and I am still getting the same error on NCBI.</p>
<p><img width="500" alt="Screen Shot 2024-11-25 at 11 33 46 AM" src="https://github.com/user-attachments/assets/7a430a66-6dc9-4c5a-9e20-b9fcc9211838"></p>
<p>I have no idea what else to do besides gunzipping all the files and then re-uploading them as .fastq files instead. Maybe I should just try this for the Pcli first and see if it accepts the Acer as is.</p>
<hr>
</section>
<section id="december-2" class="level2">
<h2 class="anchored" data-anchor-id="december-2">December 2</h2>
<p>I started going through and running “gunzip” to each of the files that NCBI listed as an error in the screenshot above. It had me do this twice for a number of Pcli samples, and after re-uploading those as .fastq files, I got this list of flags (which I was anticipating at this point): (note that this is just a screenshot of the first few listed – all of the samples are listed on the NCBI website as having this same error)</p>
<p><img width="500" alt="Screen Shot 2024-12-02 at 2 17 09 PM" src="https://github.com/user-attachments/assets/f9f7455d-682b-4799-81e8-ab1c57498a5f"></p>
<p>aka all the files are “corrupted.”</p>
<p>Which I don’t understand since I downloaded them straight from Basespace. So now I’m running “gunzip” on all of the files, and seeing if I re-upload them all as .fastq files, whether they will be flagged. It looks like based on the recent list that the .fastq files for the PCli samples I recently did were successfully uploaded without an error. But we shall see once I do all the rest of them.</p>
<hr>
</section>
<section id="december-9" class="level2">
<h2 class="anchored" data-anchor-id="december-9">December 9</h2>
<p>I got it to work FINALLY!! What ended up working was turning them all into .fastq files on the external hard drive, then uploading them one by one using FileZilla. FileZilla ended up helping a lot because I could visualize which ones had been successfully uploaded completely by looking at the size of each file. I also had to update the metadata file on NCBI so that all the file names were now .fastq instead of .fastq.gz. The files are now on NCBI SRA here under <a href="https://submit.ncbi.nlm.nih.gov/subs/sra/SUB14778585/overview">“PRJNA1196005 : Temperature variability differentially alters gene expression of two Caribbean reef-building corals”</a>.</p>


</section>

 ]]></description>
  <category>Bioinformatics</category>
  <category>Basespace</category>
  <category>NCBI</category>
  <category>SRA</category>
  <guid>https://ademerlis.github.io/posts/2024-10-18-downloading-sequences-from-basespace-uploadingto-ncbi.html</guid>
  <pubDate>Fri, 18 Oct 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Notes on GLMs</title>
  <link>https://ademerlis.github.io/posts/2024-08-20-noteson-glms.html</link>
  <description><![CDATA[ 




<p>After reviewing some great tutorials, I think I understand the best steps for generalized linear models with fixed and random effects (I think).</p>
<p>Tutorials I found that were helpful: 1. <a href="https://r.qcbs.ca/workshop07/book-en/mixed-model-protocol.html" class="uri">https://r.qcbs.ca/workshop07/book-en/mixed-model-protocol.html</a> 2. <a href="https://r.qcbs.ca/workshop07/book-en/step-3.-model-validation.html" class="uri">https://r.qcbs.ca/workshop07/book-en/step-3.-model-validation.html</a> 3. <a href="https://r.qcbs.ca/workshop07/book-en/step-4.-interpretation-and-visualization.html" class="uri">https://r.qcbs.ca/workshop07/book-en/step-4.-interpretation-and-visualization.html</a> 4. <a href="https://ourcodingclub.github.io/tutorials/mixed-models/" class="uri">https://ourcodingclub.github.io/tutorials/mixed-models/</a> 5. <a href="https://rpubs.com/daharo_calpoly/502695" class="uri">https://rpubs.com/daharo_calpoly/502695</a></p>
<p>Some important takeaways: - “If your random effects are there to deal with pseudoreplication, then it doesn’t really matter whether they are “significant” or not: they are part of your design and have to be included.” - When doing model selection and comparing them, you cannot compare lmer models with lm models. Also, you need to make sure any of your mixed effects models are run with “REML=FALSE” so that the AIC can be correctly compared. But, once your final model is selected and it has fixed and random effects, you need to switch it back to “REML=TRUE”. - For post-hoc comparisons,</p>



 ]]></description>
  <category>Stats</category>
  <guid>https://ademerlis.github.io/posts/2024-08-20-noteson-glms.html</guid>
  <pubDate>Tue, 20 Aug 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Acer CCC KEGG Pathway analysis issues</title>
  <link>https://ademerlis.github.io/posts/2024-04-27-acer-ccckeggpathways.html</link>
  <description><![CDATA[ 




<p>I presented my data chapters 2 and 3 to NTK’s lab on Friday, and she pointed out something I hadn’t thought of - that even though the most significant KEGG pathway in my Acer CCC vs.&nbsp;Nursery analysis was estrogen signaling, the DGEs themselves that had KO terms which annotate to this KEGG pathway could also be involved in many other pathways. Looking at the full list of genes with the KEGG terms <a href="https://github.com/ademerlis/AcerCCC/blob/main/gene_expression/results/KEGG_CvN_results_withgenes.csv">here</a>, you can see that a lot of the genes are involved in many potential pathways. So why did the KEGG analysis give me the estrogen signaling pathway specifically?</p>
<p>When I take all the DGEs (p-adjusted&lt;0.05) from this dataset, and input their KO terms into KEGG mapper, I get this list of KEGG pathways:</p>
<p><img width="507" alt="Screen Shot 2024-04-27 at 3 45 25 PM" src="https://github.com/ademerlis/ademerlis.github.io/assets/56000927/94102489-c653-4a45-9735-3932aadc0c2a"></p>
<p>Then, when you click on estrogen signaling specifically, these are the genes and associated KEGG terms from my list of DGEs.</p>
<p><img width="559" alt="Screen Shot 2024-04-27 at 3 53 19 PM" src="https://github.com/ademerlis/ademerlis.github.io/assets/56000927/4010c271-7b81-4cc4-a123-e6d30d5c922b"></p>
<p>Which is the same as what I get from the results table linked above. Estrogen signaling doesn’t have the most KO terms in this list, but it ends up being the most significant. The significance test to obtain p-values is the hypergeometric test, which is essentially testing if the number of genes in a given pathway is more than what would be expected by chance. This number is determined based on the “universe,” which is the number of KEGG terms in your dataset from the total number of genes in your dataset. In my dataset, there were 12,344 KO terms from the <em>A.cervicornis</em> genome. Then, of my 819 DGEs, 413 of them had KO terms associated with them. The KO terms and individual genes, however, don’t exactly point to estrogen signaling. The annotations seem more related to heat-shock and cell signaling (i.e.&nbsp;calmodulin, calcium ion binding).</p>
<p>So why is it linking these to the estrogen signaling pathway?</p>
<p>I think perhaps what is happening is that the most significant DGEs in my dataset all happen to be a part of estrogen signaling, but they also are a part of many other pathways. Yes, all of these genes together are significantly enriched in estrogen signaling because they passed the criteria for being more highly expressed than due to chance. But, what gene specifically would point to estrogen signaling.</p>
<p>I think I need a lot more evidence to support the role of endocrine/hormonal signaling in Coral City Camera corals in comparison to the Nursery corals.</p>
<p>Since I’m running low on time to prepare my defense presentation, I’m going to not go down this path any further at this time. But, I compiled a list of papers to review later and look at which genes are specifically linked to endocrine signaling in these papers. If a lot of my genes are also mentioned, then I think that warrants further discussion about the potential role of this pathway. DO THIS LATER!</p>
<p>papers: - <a href="https://peerj.com/articles/1982/" class="uri">https://peerj.com/articles/1982/</a> - <a href="https://www.int-res.com/abstracts/meps/v269/p121-129/" class="uri">https://www.int-res.com/abstracts/meps/v269/p121-129/</a> - <a href="https://www.sciencedirect.com/science/article/abs/pii/S1095643321000167?via%3Dihub" class="uri">https://www.sciencedirect.com/science/article/abs/pii/S1095643321000167?via%3Dihub</a> - <a href="https://www.sciencedirect.com/science/article/abs/pii/S0048969722071194" class="uri">https://www.sciencedirect.com/science/article/abs/pii/S0048969722071194</a> - <a href="https://www.sciencedirect.com/science/article/abs/pii/S0166445X18305216?casa_token=XQuzXdc9at4AAAAA:QaPEECqFZxjvIwkzwiiaF9pyPDxnmWYYkRDmp2plorfIO4dBzt9s6I7hWEJWlr6h1LLKtqlC" class="uri">https://www.sciencedirect.com/science/article/abs/pii/S0166445X18305216?casa_token=XQuzXdc9at4AAAAA:QaPEECqFZxjvIwkzwiiaF9pyPDxnmWYYkRDmp2plorfIO4dBzt9s6I7hWEJWlr6h1LLKtqlC</a> - <a href="https://www.int-res.com/abstracts/meps/v269/p121-129/" class="uri">https://www.int-res.com/abstracts/meps/v269/p121-129/</a> - <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8910684/" class="uri">https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8910684/</a> - <a href="https://www.sciencedirect.com/science/article/pii/S0048969721037049#bb0665" class="uri">https://www.sciencedirect.com/science/article/pii/S0048969721037049#bb0665</a> - <a href="https://ehp.niehs.nih.gov/doi/10.1289/ehp.5233" class="uri">https://ehp.niehs.nih.gov/doi/10.1289/ehp.5233</a></p>



 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>Ch4 AcerCCC</category>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2024-04-27-acer-ccckeggpathways.html</guid>
  <pubDate>Sat, 27 Apr 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Take 2 with CRW DHW MMM</title>
  <link>https://ademerlis.github.io/posts/2024-03-21-take-2-with-crw-dhw-mmm.html</link>
  <description><![CDATA[ 




<p>I am revisiting this post from last year, where I was trying to download data from NOAA’s CRW to calculate MMM and DHW for my reef sites. <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-12-04-DownloadingSSTCoralWatchData.md">Post here</a></p>
<p>I found Dr.&nbsp;Ana Palacio’s code on <a href="https://github.com/anampc/DHW_Uva/tree/master">her GitHub</a> that documents really well her scripts for downloading the data from NOAA’s database.</p>
<p>First, I downloaded the .nc file here: <a href="https://www.star.nesdis.noaa.gov/pub/sod/mecb/crw/data/5km/v3.1_op/climatology/nc/" class="uri">https://www.star.nesdis.noaa.gov/pub/sod/mecb/crw/data/5km/v3.1_op/climatology/nc/</a></p>
<p>Then, I needed to download a package for the terminal that allows me to read .nc files.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">brew</span> update</span>
<span id="cb1-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">brew</span> install netcdf</span>
<span id="cb1-3"></span>
<span id="cb1-4"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">ncdump</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-h</span> ct5km_climatology_v3.1.nc</span></code></pre></div></div>
<p>I can see in the header that I think it includes all lat, lon coordinates.</p>
<p>Now, I read it into R using Ana’s code:</p>
<p>```r extract_oisst_data library(raster) library(parallel) library(ncdf4)</p>
<p># Read climatology file Climatology_MMM &lt;- “ct5km_climatology_v3.1.nc” MMM.data &lt;- brick(Climatology_MMM) #MMM.data</p>
<p># KB Nursery lat_KB &lt;- (25.6763) lon_KB &lt;- (-80.0987) extract.pts_KB &lt;- cbind(lon_KB,lat_KB)</p>
<p>#CCC lat.CCC &lt;- (25.766626) lon.CCC &lt;- (-80.144812) extract_CCC &lt;- cbind(lon.CCC, lat.CCC)</p>
<p>#MMM &lt;- raster::extract(MMM.data, extract.pts,method=“bilinear”) MMM &lt;- raster::extract(MMM.data, extract.pts_KB,method=“simple”) MMM_CCC &lt;- raster::extract(MMM.data, extract_CCC,method=“simple”)</p>
<p>write.csv(MMM, “KB_CRW_MMM_1985-2012.csv”, row.names=FALSE)</p>
<p>write.csv(MMM_CCC, “CCC_CRW_MMM_1985-2012.csv”, row.names=FALSE)</p>
<section id="mmm-for-both-sites-theyre-within-5-km-of-each-other-is-29.54" class="level1">
<h1>MMM for both sites (they’re within 5 km of each other) is 29.54</h1>
<p>```</p>


</section>

 ]]></description>
  <category>Analysis</category>
  <category>Processing</category>
  <category>Ch4 AcerCCC</category>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2024-03-21-take-2-with-crw-dhw-mmm.html</guid>
  <pubDate>Thu, 21 Mar 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>2024-02-12-noteaboutannotationfilesfromMS.md</title>
  <link>https://ademerlis.github.io/posts/2024-02-12-noteaboutannotationfilesfrom-ms.html</link>
  <description><![CDATA[ 




<p>I realized that when Michael re-annotated the Locatelli unpublished Acer genome in December, he updated the names of everything (which no longer match my counts matrix). Basically when we first started this pipeline, all the Acropora gene names were “Acropora_” before the gene number. But in the recent re-annotation, Michael named everything “Acervicornis” with no underscore. I ran into issues when I was trying to run the GO_MWU scripts because I was using the “Acervicornis_iso2go.tab” file but trying to match the “Acropora_” gene names (which none of them matched of course).</p>
<p>So I transformed the new iso2go.tab file so that everything was consistent and named like “Acropora_”.</p>
<p>Today I just realized that in the KOG MWU script and in the annotating DGEs scripts for Acer, I was still using the old files that Michael had made (I realized this because the iso2geneName.tab and iso2kogclass.tab names are Acropora_, not Acervicornis).</p>
<p>Okay but now looking back at his old commit versions on the Acer annotated transcriptome repository on his GitHub, it looks like the naming convention for gene names used to be “Acropora1921” for example, which means it didn’t have an underscore and it also didn’t have zeros before the numbers (which he then added when he changed it to Acervicornis).</p>
<p>Just to be safe, I’m going to redownload all the annotation files and rerun everything that uses those files so that way I can be completely sure its all updated.</p>



 ]]></description>
  <category>Analysis</category>
  <category>Ch2 Temp Variability</category>
  <category>Stress-Hardening</category>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2024-02-12-noteaboutannotationfilesfrom-ms.html</guid>
  <pubDate>Mon, 12 Feb 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Issue with FvFm code</title>
  <link>https://ademerlis.github.io/posts/2023-12-24-issuewith-fv-fmcode.html</link>
  <description><![CDATA[ 




<p>I was looking at the full dataset of all the IPAM data to see if there were any issues, because when I started trying to remove NAs from the GLM for FvFm treatment data, I started getting errors.</p>
<p>I noticed when I was looking at the different time points that six Acer are missing initial FvFm data, and when I look at the csv files that I exported from the IPAM, they have values that I guess weren’t imported into R using the <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-21-fixingIPAM2Rcode.md">IPAM2R code</a>. I did edit the code because it wasn’t working, maybe that’s why it is importing things in correctly?</p>
<p>Ok, upon further inspection, the Acer that are missing the initial time point fvfm are all from one photo: photo number 4 (“4.csv”) from 2022-03-16. All the Acer that are missing the final time point fvfm are from tank 7 (2022-04-20). For Pclivosa there are several final time point ones that are missing (2022-04-20). Some of them are actually blank in the original IPAM csv files, but some of them have values that should’ve been read in.</p>
<p>So what happened there? I guess let me screenshot to keep record of which ones were missing, and then re-import everything using the IPAM2R code and see if it corrects itself?</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://github.com/ademerlis/ademerlis.github.io/assets/56000927/d4da8990-c05a-41dd-9b2c-c826ce4cf5df.png" class="img-fluid figure-img"></p>
<figcaption>Screen Shot 2023-12-24 at 8 17 01 AM</figcaption>
</figure>
</div>
<p>UPDATE: I figured out the issue. The IPAM2R code has a line in it that uses the reshape2 function, and some of my csv files had two rows of identical IPAM data instead of one row - one row is what the IPAM2R code expects. I guess if you export your IPAM data twice on accident it will add another row to your csv file. But, when the function in R tries to reshape the data frame after tidying the AOI and other variable info, it basically extracts the wrong information and the Y(II) values end up being incorrect. For the Acer samples that were messed up, they had valuess of 2.00 instead of 0.646 etc that they were supposed to be. So I added a if-then statement within the IPAM2R data which basically removes the second row if there are two rows present in the csv file.</p>
<p>When I looked through the updated dataset that was created in R, I no longer had so many NAs as I did before. I cross-validated the values from the original csv files to make sure they matched, and they did. Yay problem solved!</p>



 ]]></description>
  <category>Coding</category>
  <category>IPAM</category>
  <guid>https://ademerlis.github.io/posts/2023-12-24-issuewith-fv-fmcode.html</guid>
  <pubDate>Sun, 24 Dec 2023 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Fv/Fm GLMMs</title>
  <link>https://ademerlis.github.io/posts/2023-12-23-fv-fm-glmms.html</link>
  <description><![CDATA[ 




<p>I am revisiting my Fv/Fm code for my Chapter 2 stress-hardening analysis. When I first started this, I tried to follow code from <a href="https://github.com/jrcunning/CBASS_FL_Acer">Cunning et al.&nbsp;2021</a>, who assessed A.cervicornis outplants using CBASS across Florida. However, I found other publications that applied different ways of analyzing this data that were more straightforward (I think because Cunning et al.&nbsp;2021 had a lot more variation to account for due to the different sites across space and time, and also the authors added corrections for light parameters in each CBASS tank and for use of a Diving PAM). I started playing around with other codes and eventually got really deep in the weeds of this.</p>
<p>My overall goals with my Fv/Fm data are to: 1. evaulate whether the variable temperature treatment impacted Fv/Fm in Acer and Pcli 2. evaluate thermal tolerance of temperature-treated versus untreated corals using CBASS and dose-response curve (DRC) modeliong</p>
<p>With that being stated, my move forward should be simple.</p>
<p>I think a couple obstacles that held me up were: 1. Do I / how do I normalize Fv/Fm data? Based on initial measurement (pre-treatment)? Based on pre-CBASS measurement? Do I incorporate number of days and create a rate of change and then statistically compare that? 2. Which statistical model do I use? I want to incorporate fixed (treatment, CBASS temperature) and random (genotype, tank) effects, so Generalized Linear Mixed Models is appropriate. However, I was stuck on using glmmTMB with the “beta” family distribution and the “logit” function. The major assumption of this type of distribution is that data are bound by 0 &lt; x &lt; 1. I originally thought fv/fm data would fit this best because it is a proportion that the IPAM is measuring. But, some of the values equal zero, and when I start doing time normalizations I get values greater than 1 or less than zero. So, for this reason I no longer think glmmTMB is appropriate. The next best GLMM would be the classic continuous response model using lme4::lmer. This is consistent with code I’ve seen from Klepac and Evensen.</p>
<p>See my previous GitHub posts for more confusions: 1. <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-11-06-TroubleWithFvFmData.md" class="uri">https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-11-06-TroubleWithFvFmData.md</a> 2. <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-31-GLMMsContinued.md" class="uri">https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-31-GLMMsContinued.md</a> 3. <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-29-GLMMs.md" class="uri">https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-29-GLMMs.md</a> 4. <a href="https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-10-LinearMixedModels_StressHardeningExp.md" class="uri">https://github.com/ademerlis/ademerlis.github.io/blob/main/_posts/2023-01-10-LinearMixedModels_StressHardeningExp.md</a></p>
<p>Moving forward, I’m going to collate notes from <a href="https://royalsocietypublishing.org/doi/10.1098/rspb.2021.1613">Cunning et al 2021</a>, <a href="https://royalsocietypublishing.org/doi/10.1098/rspb.2020.1379">Klepac and Barshis 2020</a>, and <a href="https://onlinelibrary.wiley.com/doi/full/10.1002/lno.11715">Evensen et al 2021</a> here.</p>
<section id="normalization-techniques" class="level3">
<h3 class="anchored" data-anchor-id="normalization-techniques">Normalization techniques:</h3>
<ol type="1">
<li><em>Cunning et al.&nbsp;2021</em> - <strong>no mention of normalization technique</strong>; there wasn’t a component of time in terms of repeated measures of indiviudal corals, so there wasn’t a need to normalize to initial Fv/Fm measurement.</li>
<li><em>Klepac and Barshis 2020</em> - <strong>Normalized CBASS Fv/Fm values (21–0 h)/0 h</strong> were used for statistical analyses to correct for between ramet variation in starting values. Fv/Fm values measured at the end of each assay were used for plotting for simplicity to allow for easy comparison to previous studies.</li>
<li><em>Evensen et al.&nbsp;2021</em> - <strong>no mention of normalization technique</strong>; each time point was analyzed separately.</li>
</ol>
</section>
<section id="statistical-model-used" class="level3">
<h3 class="anchored" data-anchor-id="statistical-model-used">Statistical model used:</h3>
<ol type="1">
<li><em>Cunning et al.&nbsp;2021</em> - Normality of ED50s was tested using Shapiro-Wilk test. Differences in ED50 among nurseries was tested using <strong>Welch ANOVA</strong> after Levene’s test indicated unequal variances. Wilcoxon rank-sum tests were used to test for pairwise differences between nurseries, with Bonferroni adjusted p-values and α = 0.01. Relationships between ED50adj and source colony locations, thermal regimes and symbiont abundances were tested using linear models.</li>
<li><em>Klepac and Barshis 2020</em> - Differences in normalized Fv/Fm were tested using a <strong>mixed model ANOVA</strong>, where time, a combined origin_destination site variable (owing to the unbalanced design (i.e.&nbsp;not all origins in each destination), and treatment were modelled as fixed factors, and colony identity was nested within experimental tank designation as a random factor. Multiple comparisons across factors and interaction terms were assessed post hoc using general linear hypothesis testing and multiple comparisons (<strong>glht</strong> function; [62]) for linear mixed-effects models, specifying Tukey’s test. To satisfy model assumptions, normality was examined using the shapiro.test and homoscedasticity via the bartlett.test in R, as well as plotting residuals.</li>
<li><em>Evensen et al.&nbsp;2021</em> - Individual response variables were analyzed using linear mixed effects (LME) models, with temperature and experiment as fixed effects, and genet and tank replicate as random effects to account for non-independence of fragments from the same colonies and any potential tank effects. Time points again were analyzed separately. Additionally, LMEs were conducted for each response variable to compare the 27C treatments to the field control and measurements at T0, using the same aforementioned model structure. Models were conducted in the **“lmerTest” package** (Kuznetsova et al.&nbsp;2017) in R. Model simplification was conducted by backwards elimination of predictor variables (step function), with F-tests used to compare full and reduced models upon removal of the fixed effects. For significant main effects, Tukey’s honestly significant difference (HSD) post hoc pairwise comparisons were conducted using the package <strong>”emmeans”</strong> (Lenth et al.&nbsp;2020).or all models, distributions of the residuals were plotted to ensure they fit a normal distribution and residuals were plotted against fitted values to confirm that the errors had constant variance. Data were log-transformed to help meet these assumptions when necessary. In order to produce a standardized and comparable proxy to quantitively determine the upper thermal limit of the corals in each experiment, we computed a critical temperature threshold using measurements of Fv/Fm. Measurements of Fv/Fm were fitted to <strong>log-logistic dose–response curves (DRCs) using the package ”drc”</strong> (Ritz et al.&nbsp;2015), with model selection based on Akaike’s Information Criterion (AIC; Table S2) and individual curves fit for each experiment. From these, an”ED50” parameter (effective dose 50) was obtained for each experiment, representing the x-value at the inflection point of the curve (in this case the temperature) where Fv/Fm values in the model fit were 50% lower in comparison to the starting values of the model. This provided a quantitative thermal threshold, designated as the Fv/Fm ED50, for S. pistillata in each experiment.</li>
</ol>


</section>

 ]]></description>
  <category>Coding</category>
  <category>IPAM</category>
  <guid>https://ademerlis.github.io/posts/2023-12-23-fv-fm-glmms.html</guid>
  <pubDate>Sat, 23 Dec 2023 00:00:00 GMT</pubDate>
</item>
<item>
  <title>installing and using reefmapmaker to create coral reef maps</title>
  <link>https://ademerlis.github.io/posts/2023-12-18-reefmapmaker.html</link>
  <description><![CDATA[ 




<p>I discovered a github repo for a conda package that helps produce high-quality coral reef maps using online data. The package is called <a href="https://github.com/didillysquat/reefMapMaker">reefmapmaker</a>.</p>
<p>Since my Pegasus environment is now conda, I just ran this in the command line after I logged in:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> install <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> didillysquat <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> conda-forge reefmapmaker</span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> create <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--name</span> reefmapmaker_env <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> didillysquat <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> conda-forge reefmapmaker</span>
<span id="cb1-4"></span>
<span id="cb1-5"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> activate reefmapmaker_env</span></code></pre></div></div>
<p>I downloaded locally the 2021 UNEP WCMC global distrubiton of warm-water coral reefs dataset from <a href="https://data.unep-wcmc.org/datasets/1">here</a>, then unzipped the file. You need this directory to be in the current working directory for the reefMapMaker commands. I’ll create a directory on Pegasus for this and then upload the dataset using scp.</p>
<p>In the installation instructions it says I should be able to run “reefmapmaker” in the directory and it will automatically do it. But i keep getting errors that basically say it can’t find the shape file in the dataset I downloaded.</p>
<p>I tried running this and got “Could not automatically find the reference reef dataset. Please specify the directory of the dataset on the command line using –ref-reef-dir”</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> 14_001_WCMC008_CoralReefs2021_v4</span></code></pre></div></div>
<p>Which one is the shape file?</p>
<p>I think it’s this: 01_Data/WCMC008_CoralReef2021_Py_v4_1.shp</p>
<p>I’m going to download their <a href="https://github.com/didillysquat/reefMapMaker/blob/main/config_sheet.tsv">config_sheet.tsv</a> and add my sites to a <a href="https://github.com/didillysquat/reefMapMaker/blob/main/site_sheet.tsv">site_sheet.tsv</a>.</p>
<p>I updated the bounds to fit my data: -84,-80,24,28 and added these sites to my tsv file: KBNursery: 25.6763, -80.0987 PcliCollection 25.77044 -80.15235</p>
<p>attempt #1 to run full code:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4/01_Data <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--config-sheet</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/map/config_sheet.tsv <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--site-sheet</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/map/site_sheet.tsv <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--fig-out-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--bounds</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>-84,-80,24,28</span></code></pre></div></div>
<p>I think I’m running into issues with the config sheet. I’m going to try running the code without it.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2018_v4/01_Data <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--site-sheet</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/map/site_sheet.tsv <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--fig-out-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--bounds</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>-84,-80,24,28</span></code></pre></div></div>
<p>Now it’s back to not being able to find the shapefile. I’m going to try to move the zip file onto pegasus first and then unzip it there.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4_1 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--site-sheet</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/map/site_sheet.tsv <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--fig-out-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--bounds</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>-84,-80,24,28</span></code></pre></div></div>
<p>Ok I found the issue. In the second of code of reefmapmaker.py (lines 439-452), it’s specifically looking for a shape file that starts with the string “WCMC008_CoralReef2018_Py”. However, when you download the dataset from the website link they provide, it’s a 2021 version, so all the file names start with “WCMC008_CoralReef2021”. ugh. I guess I need to manually edit the reefmapmaker.py code.</p>
<p>Can i do this in the command line? Yes, using sed.</p>
<p>First, navigate to where reefmapmaker was installed: /nethome/and128/anaconda3/envs/reefmapmaker_env/lib/python3.10/site-packages/reefmapmaker/</p>
<p>Then, run:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/WCMC008_CoralReef2018_Py/WCMC008_CoralReef2021_Py/g'</span> reefmapmaker.py</span>
<span id="cb6-2"></span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#make executable</span></span>
<span id="cb6-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">chmod</span> +x reefmapmaker.py </span></code></pre></div></div>
<p>Now, navigate to directory which has the WCMC008_CoralReefs2021 data and run:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4_1 <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--site-sheet</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/map/site_sheet.tsv <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--fig-out-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--bounds</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>-84,-80,24,28</span></code></pre></div></div>
<p>This didn’t work, and neither did running the baseline code:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb8-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reefmapmaker</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--ref-reef-dir</span> /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4_1</span></code></pre></div></div>
<p>this was the log and the errors that came up:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb9-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Shape</span> file found: /scratch/projects/and_transcriptomics/programs/reefMapMaker/14_001_WCMC008_CoralReefs2021_v4_1/01_Data/WCMC008_CoralReef2021_Py_v4_1.shp</span>
<span id="cb9-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Drawing</span> annotations on map</span>
<span id="cb9-3"></span>
<span id="cb9-4"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Annotations</span> complete</span>
<span id="cb9-5"></span>
<span id="cb9-6"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Annotating</span> reference reefs</span>
<span id="cb9-7"></span>
<span id="cb9-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">reading</span> in reference reefs</span>
<span id="cb9-9"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span>
<span id="cb9-10"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Traceback</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">most</span> recent call last<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">:</span></span>
<span id="cb9-11">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">File</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/nethome/and128/anaconda3/envs/reefmapmaker_env/lib/python3.10/site-packages/reefmapmaker/reefmapmaker.py"</span>, line 1002, in _add_reference_reefs</span>
<span id="cb9-12">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">self._handle_multipolygon</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">r</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span>
<span id="cb9-13">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">File</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/nethome/and128/anaconda3/envs/reefmapmaker_env/lib/python3.10/site-packages/reefmapmaker/reefmapmaker.py"</span>, line 1069, in _handle_multipolygon</span>
<span id="cb9-14">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> polygon <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> r.geometry:</span>
<span id="cb9-15"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">TypeError:</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'MultiPolygon'</span> object is not iterable</span>
<span id="cb9-16"></span>
<span id="cb9-17"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">During</span> handling of the above exception, another exception occurred:</span>
<span id="cb9-18"></span>
<span id="cb9-19"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">Traceback</span> <span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">most</span> recent call last<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">:</span></span>
<span id="cb9-20">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">File</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/nethome/and128/anaconda3/envs/reefmapmaker_env/bin/reefmapmaker"</span>, line 22, in <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span>module<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span></span>
<span id="cb9-21">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">mwif.draw_map()</span></span>
<span id="cb9-22">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">File</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/nethome/and128/anaconda3/envs/reefmapmaker_env/lib/python3.10/site-packages/reefmapmaker/reefmapmaker.py"</span>, line 911, in draw_map</span>
<span id="cb9-23">    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">self._add_reference_reefs()</span></span>
<span id="cb9-24">  <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">File</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/nethome/and128/anaconda3/envs/reefmapmaker_env/lib/python3.10/site-packages/reefmapmaker/reefmapmaker.py"</span>, line 1009, in _add_reference_reefs</span>
<span id="cb9-25">    <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">error_count</span> += 1</span>
<span id="cb9-26"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">UnboundLocalError:</span> local variable <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'error_count'</span> referenced before assignment</span></code></pre></div></div>
<p>I’m going to give up on this for now because I give up.</p>



 ]]></description>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2023-12-18-reefmapmaker.html</guid>
  <pubDate>Mon, 18 Dec 2023 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Annotating new Acer transcriptome</title>
  <link>https://ademerlis.github.io/posts/2023-12-07-annotating-new-acer-transcriptome.html</link>
  <description><![CDATA[ 




<p>I’m going to be following <a href="https://github.com/mstudiva/Acropora-cervicornis-annotated-transcriptome/blob/main/tagSeq_TranscriptomeAnnotation_README.txt">Michael Studivan’s code</a> for annotating the new Acer transcriptome.</p>
<p>Step 1 is installing bioperl. I had trouble doing this, but I didn’t realize I could activate it as a conda environment. It looks like it’s working so far.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># To install Bioperl as a conda environment</span></span>
<span id="cb1-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> create <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-y</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-n</span> bioperl perl-bioperl</span>
<span id="cb1-3"></span>
<span id="cb1-4"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> activate bioperl</span>
<span id="cb1-5"></span>
<span id="cb1-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> clone https://github.com/z0on/annotatingTranscriptomes.git</span>
<span id="cb1-7"></span>
<span id="cb1-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">git</span> clone https://github.com/z0on/emapper_to_GOMWU_KOGMWU.git</span>
<span id="cb1-9"></span>
<span id="cb1-10"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">seq_stats.pl</span> /scratch/projects/and_transcriptomics/genomes/Acer/Locatelli_2023/Acer_Genome/Acropora_cervicornis.mrna-transcripts.fa  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> seqstats_Acer.txt</span></code></pre></div></div>
<p>I had several issues running the seq_stats.pl script.</p>
<p>First, I had to update the shebang in the .pl script so that it was calling the right perl (within the bioperl environment).</p>
<p>Then, I also had to remove the line <code>use Bio::Perl;</code> because it was causing issues.</p>
<p>So the seq_stats.pl script beginning looks like this now:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode perl code-with-copy"><code class="sourceCode perl"><span id="cb2-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">#!/usr/anaconda3/envs/bioperl/bin/perl</span></span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">use</span> lib <span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">~/anaconda3/envs/bioperl</span><span class="ot" style="color: #003B4F;
background-color: null;
font-style: inherit;">"</span>;</span>
<span id="cb2-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">use</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">Bio::SeqIO</span>;</span></code></pre></div></div>
<p>Now I run this with the updated script:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">seq_stats.pl</span> /scratch/projects/and_transcriptomics/genomes/Acer/Locatelli_2023/Acer_Genome/Acropora_cervicornis.mrna-transcripts.fa  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> seqstats_Acer.txt</span></code></pre></div></div>
<p>Results:</p>
<p>36455 sequences. 1678 average length. 65308 maximum length. 61 minimum length. N50 = 2747 61.2 Mb altogether (61163689 bp). 0 ambiguous Mb. (100 bp, 0%) 0 Mb of Ns. (100 bp, 0%)</p>
<p>Next step is to get the uniprot annotations with blast.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># getting uniprot_swissprot KB database</span></span>
<span id="cb4-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">wget</span> ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz</span>
<span id="cb4-3"></span>
<span id="cb4-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">gunzip</span> uniprot_sprot.fasta.gz</span></code></pre></div></div>
<p>Then I created a script for the makedatabase part.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#!/usr/bin/bash</span></span>
<span id="cb5-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -P and_transcriptomics</span></span>
<span id="cb5-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb5-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -W 120:00</span></span>
<span id="cb5-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -o makedatabase.out</span></span>
<span id="cb5-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -e makedatabase.err</span></span>
<span id="cb5-7"></span>
<span id="cb5-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">module</span> load blast/2.2.29+</span>
<span id="cb5-9"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">makeblastdb</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-in</span> uniprot_sprot.fasta <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-dbtype</span> prot</span></code></pre></div></div>
<p>That ran.</p>
<p>Now, I need to split up the fasta file so the blast code runs quickly.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#navigate to wd where splitFasta.pl is located </span></span>
<span id="cb6-2"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#copy fasta file into this directory</span></span>
<span id="cb6-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cp</span> /scratch/projects/and_transcriptomics/genomes/Acer/Locatelli_2023/Acer_Genome/Acropora_cervicornis.mrna-transcripts.fa Acer2023.fasta</span>
<span id="cb6-4"></span>
<span id="cb6-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#run split Fasta code</span></span>
<span id="cb6-6"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> splitFasta.pl Acer2023.fasta 200</span></code></pre></div></div>
<p>This created 200 subset.fasta files. Now, need to create a script to submit a job to pegasus that blasts all 200 chunks to uniprot in parallel.</p>
<p>I think I’ll need to create a for-loop so it creates individual jobs for each chunk, so that they can run simultaneously.</p>
<p>This for loop worked:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -u your_email@miami.edu</span></span>
<span id="cb7-2"></span>
<span id="cb7-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#specify variables and paths</span></span>
<span id="cb7-4"></span>
<span id="cb7-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#define variables for directories and files</span></span>
<span id="cb7-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb7-7"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb7-8"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics/genomes/Acer/annotatingTranscriptomes-master"</span></span>
<span id="cb7-9"></span>
<span id="cb7-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span></span>
<span id="cb7-11"></span>
<span id="cb7-12"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">($(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ls</span> subset<span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">))</span></span>
<span id="cb7-13"></span>
<span id="cb7-14"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> file <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[@]</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb7-15"></span>
<span id="cb7-16"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#build script</span></span>
<span id="cb7-17"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"making blast uniprot script for </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">..."</span></span>
<span id="cb7-18"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb7-19"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb7-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb7-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_blast_uniprot</span></span>
<span id="cb7-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_blast_uniprot.err</span></span>
<span id="cb7-23"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_blast_uniprot.out</span></span>
<span id="cb7-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 12:00</span></span>
<span id="cb7-25"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb7-26"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q general</span></span>
<span id="cb7-27"></span>
<span id="cb7-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span></span>
<span id="cb7-29"></span>
<span id="cb7-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">module load blast/2.2.29+</span></span>
<span id="cb7-31"></span>
<span id="cb7-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">blastx -query </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> -db uniprot_sprot.fasta -evalue 0.0001 -num_threads 4 -num_descriptions 5 -num_alignments 5 -out </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">.br"</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span>/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span>_blast_uniprot.job</span>
<span id="cb7-33"></span>
<span id="cb7-34"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${projdir}</span>/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${file}</span>_blast_uniprot.job</span>
<span id="cb7-35"></span>
<span id="cb7-36"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>This took ~ l hr to complete.</p>
<p>To make sure it worked, run the following line and you should end up with the same number of queries as there are sequences from the seqstats_Acer.txt file (created from running seq_stats.pl).</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Query= "</span> subset<span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>.br <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">wc</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-l</span></span></code></pre></div></div>
<p>I get 36,455, which equals the number of sequences in the seqstats_Acer.txt file.</p>
<p>Next, combine all blast results:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb9-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> subset<span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>br <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> myblast.br</span></code></pre></div></div>
<p>Then, extract coding sequences and corresponding protein translations using the perl script <strong>CDS_extractor_v2.pl</strong>.</p>
<p>This is a really long script so I’m not going to paste it in here. I’m first going to try to run it as-is. It looks like it requires Bio::SeqIO so we’ll see how that goes.</p>
<p>I should probably create a job script and submit this as a job just in case it takes awhile.</p>
<p>Michael runs CDS_extractor_v2.pl on a file he made called “Acervicornis_iso.fasta”. It looks like he ran this code on the original fasta file:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb10-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> Acervicornis.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;Acropora(\d+)(\S+).+/&gt;Acropora$1$2 gene=Acropora$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_iso.fasta</span></code></pre></div></div>
<p>He had flagged this line of code for only being specific to Trinity-assembled transcriptomes.</p>
<p>The one I’m using was generating using “funannotate.” So, each header of the fasta file looks something like this:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb11-1"><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>FUN_000006-T1 <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">FUN_000006</span></span></code></pre></div></div>
<p>I can try to adapt Michael’s code so it does the same thing, which is basically substituting the trinity header to be named an arbitrary gene name (i.e.&nbsp;Acropora00001).</p>
<p><strong>update</strong>: actually i’m not sure I want to do that, because then I would also have to edit the enitre gff3 file (the gene IDs in there are FUN_#). I’m going to leave it as is and change the Acervicornis_seq2iso.tab code to grep and awk FUN instead of Acropora.</p>
<p>Remember the Acer_2023.fasta is the mrna_transcripts.fa file that I just copied over from the original genome download folder.</p>
<p>“Acervicornis_seq2iso.tab” is the necessary file for generating read counts per gene back in the tagSeq bioinformatics pipeline (which is the whole reason i’m running this annotatingTranscriptomes pipeline).</p>
<p>So i should run both lines to get both files: Acervicornis_seq2iso.tab and Acervicornis_iso.fasta.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb12" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb12-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> Acer2023.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;FUN(\d+)(\S+)\s.+/FUN$1$2\tFUN$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_seq2iso.tab</span>
<span id="cb12-2"></span>
<span id="cb12-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> Acer2023.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;FUN(\d+)(\S+).+/&gt;FUN$1$2 gene=FUN$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_iso.fasta</span></code></pre></div></div>
<p>Ok the second line doesn’t do anything because the original fasta file is already listed in this exact format. So i’m not sure if any of this code is actually useful.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb13-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># extracting coding sequences and corresponding protein translations:</span></span>
<span id="cb13-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">conda</span> activate bioperl <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#if not active already</span></span>
<span id="cb13-3"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"perl ~/bin/CDS_extractor_v2.pl Acervicornis_iso.fasta myblast.br allhits bridgegaps"</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>cds</span>
<span id="cb13-4"></span>
<span id="cb13-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb13-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -P and_transcriptomics</span></span>
<span id="cb13-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -J CDS_extractor</span></span>
<span id="cb13-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -e /scratch/projects/and_transcriptomics/genomes/Acer/annotatingTranscriptomes-master/CDS_extractor.err</span></span>
<span id="cb13-9"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -o /scratch/projects/and_transcriptomics/genomes/Acer/annotatingTranscriptomes-master/CDS_extractor.out</span></span>
<span id="cb13-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -W 12:00</span></span>
<span id="cb13-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb13-12"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#BSUB -q general</span></span>
<span id="cb13-13"></span>
<span id="cb13-14"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics/genomes/Acer/annotatingTranscriptomes-master"</span></span>
<span id="cb13-15"></span>
<span id="cb13-16"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> CDS_extractor_v2.pl Allyson_Created_Files/Acer2023.fasta Allyson_Created_Files/myblast.br allhits bridgegaps</span></code></pre></div></div>
<p>To run the above job script, I had to manually install the perl module “Bio::DB::Fasta:. I ran this:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb14" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb14-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">cpan</span> Bio::DB::Fasta</span></code></pre></div></div>
<p>But this doesn’t work because there are a ton of other dependencies it needs. I’m going to abandon this pipeline at this step because there is an annotation file that came with the Locatelli 2023 Acer genome and it has GO terms in it. I’ll just move forward with that for right now.</p>



 ]]></description>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2023-12-07-annotating-new-acer-transcriptome.html</guid>
  <pubDate>Thu, 07 Dec 2023 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Acer gene counts using samtools</title>
  <link>https://ademerlis.github.io/posts/2023-12-12-final-finalgenecountsfor-acer.html</link>
  <description><![CDATA[ 




<section id="finally-getting-the-gene-counts-for-acer-samples-from-chapter-2" class="level2">
<h2 class="anchored" data-anchor-id="finally-getting-the-gene-counts-for-acer-samples-from-chapter-2">Finally getting the gene counts for Acer samples from Chapter 2</h2>
<p>Following the last section of <a href="https://github.com/mstudiva/tag-based_RNAseq/blob/master/tagSeq_processing_README.txt">Michael Studivan’s code</a>.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># </span><span class="al" style="color: #AD0000;
background-color: null;
font-style: inherit;">NOTE</span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">: Must have a tab-delimited file giving correspondence between contigs in the transcriptome fasta file and genes</span></span>
<span id="cb1-2"></span>
<span id="cb1-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> Acer/Locatelli_2023/Acervicornis_seq2iso.tab Symbiodinium/Mstudiva_Symbiodinium_annotated_transcriptome_code/Symbiodinium_seq2iso.tab <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> Host_concat_seq2iso.tab</span></code></pre></div></div>
<p>Job: use sam tools and <a href="https://github.com/mstudiva/tag-based_RNAseq/blob/master/samcount.pl">samcount.pl</a>.</p>
<p>arg1: SAM file (by cluster, contig, or isotig) arg2: a table in the form ‘reference_seq<tab>gene_ID’, giving the correspondence of reference sequences to genes. With 454-deived transcriptome, the gene_ID would be isogroup; with Trinity-derived transcriptiome,it would be component.</tab></p>
<p>paths: 1. /scratch/projects/and_transcriptomics/Ch2_temperaturevariability2023/2_trimmed_reads/take_4/trimmed_files/Acer/bowtie2align_LocatelliShoguchi/sam_files/*.sam 2. /scratch/projects/and_transcriptomics/genomes/Host_concat_seq2iso.tab</p>
<p>I need to write a for-loop to each .sam file to do this: print “samcount.pl $file $tab aligner=bowtie2 &gt;$file.counts” but written in bash not perl.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb2-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb2-2"></span>
<span id="cb2-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#define variables for directories and files</span></span>
<span id="cb2-4"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">and</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics"</span></span>
<span id="cb2-5"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">project</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"and_transcriptomics"</span></span>
<span id="cb2-6"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">projdir</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span></span>
<span id="cb2-7"></span>
<span id="cb2-8"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">cd</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"/scratch/projects/and_transcriptomics/Ch2_temperaturevariability2023/2_trimmed_reads/take_4/trimmed_files/Acer/bowtie2align_LocatelliShoguchi/sam_files"</span></span>
<span id="cb2-9"></span>
<span id="cb2-10"><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">($(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">ls</span> <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>.sam<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">))</span></span>
<span id="cb2-11"></span>
<span id="cb2-12"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> samp <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[@]</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">;</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">do</span> <span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span></span>
<span id="cb2-13"></span>
<span id="cb2-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#build script</span></span>
<span id="cb2-15"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"making sam_counts script for </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">..."</span></span>
<span id="cb2-16"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">echo</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb2-17"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#! /usr/bin/env bash</span></span>
<span id="cb2-18"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -P </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${project}</span></span>
<span id="cb2-19"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -J </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_samcounts</span></span>
<span id="cb2-20"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -e </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/Ch2_temperaturevariability2023/3_genecounts/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_samcounts.err</span></span>
<span id="cb2-21"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -o </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/Ch2_temperaturevariability2023/3_genecounts/logs/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">_samcounts.out</span></span>
<span id="cb2-22"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -W 12:00</span></span>
<span id="cb2-23"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -n 8</span></span>
<span id="cb2-24"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">#BSUB -q general</span></span>
<span id="cb2-25"></span>
<span id="cb2-26"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">cd </span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\"</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">/scratch/projects/and_transcriptomics/Ch2_temperaturevariability2023/2_trimmed_reads/take_4/trimmed_files/Acer/bowtie2align_LocatelliShoguchi/sam_files</span><span class="dt" style="color: #AD0000;
background-color: null;
font-style: inherit;">\"</span></span>
<span id="cb2-27"></span>
<span id="cb2-28"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">module load samtools/1.3</span></span>
<span id="cb2-29"></span>
<span id="cb2-30"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">perl samcount.pl </span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;"> /scratch/projects/and_transcriptomics/genomes/Host_concat_seq2iso.tab aligner=bowtie2 &gt;</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">.counts</span></span>
<span id="cb2-31"></span>
<span id="cb2-32"><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span>/Ch2_temperaturevariability2023/3_genecounts/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span>_samcounts.job</span>
<span id="cb2-33"></span>
<span id="cb2-34"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">bsub</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${and}</span>/Ch2_temperaturevariability2023/3_genecounts/<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">${samp}</span>_samcounts.job</span>
<span id="cb2-35"></span>
<span id="cb2-36"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">done</span></span></code></pre></div></div>
<p>When I ran this though on Pegasus, the counts files came out with nothing in them. Moreover, all the .err files have errors like:</p>
<p><img width="959" alt="Screen Shot 2023-12-15 at 11 33 09 AM" src="https://github.com/ademerlis/ademerlis.github.io/assets/56000927/af05892b-22cd-4265-8d3f-d37aa7cd5e33"></p>
<p>Why didn’t any of this work? It looks like it maybe has to do with the isogroup assignment?</p>
<p>This is what Michael ran on his samples before making the seq2iso.tab file: (<a href="https://github.com/mstudiva/Acropora-cervicornis-annotated-transcriptome/blob/main/tagSeq_TranscriptomeAnnotation_README.txt">link</a>)</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb3-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Renaming gene identifiers for ease</span></span>
<span id="cb3-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/comp/Acropora/g'</span> Acervicornis.fasta</span>
<span id="cb3-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/isogroup/Acropora/g'</span> Acervicornis.fasta</span></code></pre></div></div>
<p>I didn’t initially run this on my fasta file but I’ll try it now and see if it helps.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb4-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Renaming gene identifiers for ease</span></span>
<span id="cb4-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/comp/Acropora/g'</span> Acropora_cervicornis.mrna-transcripts.fa <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> Acer2023_edited.fasta</span>
<span id="cb4-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/isogroup/Acropora/g'</span> Acropora_cervicornis.mrna-transcripts.fa <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> Acer2023_edited.fasta</span></code></pre></div></div>
<p>It doesn’t help because there is nothing labeled “comp” or “isogroup in the fasta file I’m using from Locatelli, which is called Acropora_cervicornis.mrna-transcripts.fa. I looked through the other file types (.gff3, protein.fa, scaffolds.fa) and none of them have the comp or isogroup headers.</p>
<p>I ended up running this code to create a seq2iso.tab file.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> Acropora_cervicornis.mrna-transcripts.fa <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;FUN(\d+)(\S+)\s.+/FUN$1$2\tFUN$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_seq2iso.tab</span></code></pre></div></div>
<p>This essentially just extracts the header line from each gene and puts it in a tab-delimited text file.</p>
<p><img width="384" alt="Screen Shot 2023-12-20 at 9 04 34 AM" src="https://github.com/ademerlis/ademerlis.github.io/assets/56000927/a07fbb1b-cc5b-4361-a87c-0d2949be5f32"></p>
<p>But then when I run samcount.pl using this seq2iso.tab file, I get no results.</p>
<p><strong>December 20 update:</strong></p>
<p>I had Michael take a look at the seq2iso.tab file, and the issue is that each line starts with “&gt;” but it shouldn’t. It’s messing up the gene names.</p>
<p>So two things I need to do: First, update the Acropora one to have the genes be named “Acropora_000001” instead of “FUN_000001”, and then update the Symbiodinium fasta file to say Symbiodinium_000001 for those genes. Then create the seq2iso.tab files for both species, concatenate them, then re-run the samcount.pl job.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Renaming gene identifiers for ease</span></span>
<span id="cb6-2"></span>
<span id="cb6-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#make new file</span></span>
<span id="cb6-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cp</span> Acropora_cervicornis.mrna-transcripts.fa Acer_edited.fasta</span>
<span id="cb6-5"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cp</span> syma_transcriptome_37.fasta Symbiodinium_edited.fasta</span>
<span id="cb6-6"></span>
<span id="cb6-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/FUN/Acropora/g'</span> Acer_edited.fasta</span>
<span id="cb6-8"></span>
<span id="cb6-9"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/comp/Symbiodinium/g'</span> Symbiodinium_edited.fasta</span>
<span id="cb6-10"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/isogroup/Symbiodinium/g'</span> Symbiodinium_edited.fasta</span>
<span id="cb6-11"></span>
<span id="cb6-12"></span>
<span id="cb6-13"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># making seq2iso.tab files</span></span>
<span id="cb6-14"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> Acer_edited.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;Acropora_(\d+)(\S+)\s.+/Acropora_$1$2\t Acropora_$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_seq2iso.tab</span>
<span id="cb6-15"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> Symbiodinium_edited.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;Symbiodinium(\d+)(\S+)\s.+/Symbiodinium$1$2\t Symbiodinium$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Symbiodinium_seq2iso.tab</span>
<span id="cb6-16"></span>
<span id="cb6-17"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># create combo file</span></span>
<span id="cb6-18"></span>
<span id="cb6-19"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> Acer/Locatelli_2023/Acer_Genome/Acervicornis_seq2iso.tab Symbiodinium/Symbiodinium_seq2iso.tab <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> Host_concat_seq2iso.tab</span></code></pre></div></div>
<p><del>Now i should be able to re-run this script with no changes:</del></p>
<p>Incorrect, the sam files are all named with the original gene names so nothing is going to match up.</p>
<p>I can do one of two things: either rename all the same files to have Acropora instead of FUN, or remake the seq2iso.tab files with the original names and then rename everything after the fact when its in the gene counts matrix.</p>
<p>The sam files are huge so I’m going to try to rename them after the fact.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb7-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># making seq2iso.tab files</span></span>
<span id="cb7-2"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> Acropora_cervicornis.mrna-transcripts.fa <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;FUN_(\d+)(\S+)\s.+/FUN_$1$2\t FUN_$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Acervicornis_seq2iso.tab</span>
<span id="cb7-3"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">grep</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"&gt;"</span> syma_transcriptome_37.fasta <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/&gt;comp(\d+)(\S+)\s.+/comp$1$2\t comp$1/'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span>Symbiodinium_seq2iso.tab</span>
<span id="cb7-4"></span>
<span id="cb7-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># create combo file</span></span>
<span id="cb7-6"></span>
<span id="cb7-7"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> Acer/Locatelli_2023/Acer_Genome/Acervicornis_seq2iso.tab Symbiodinium/Symbiodinium_seq2iso.tab <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> Host_concat_seq2iso.tab</span></code></pre></div></div>
<p>Ok I think that worked?! yay</p>
<p>I just ran this in the terminal and it worked fast.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb8-1"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> expression_compiler.pl <span class="pp" style="color: #AD0000;
background-color: null;
font-style: inherit;">*</span>.counts <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> allcounts.txt</span>
<span id="cb8-2"></span>
<span id="cb8-3"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># let's remove those annoying chains of extensions from sample names</span></span>
<span id="cb8-4"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> allcounts.txt <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/\.trim\.sam\.counts//g'</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> counts.txt</span>
<span id="cb8-5"></span>
<span id="cb8-6"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># i also need to remove sample name extensions "i.e. _S25_L001_R1_001"</span></span>
<span id="cb8-7"></span>
<span id="cb8-8"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">cat</span> counts.txt <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">|</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">perl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-pe</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/(_S\d+_L\d+_R\d+_\d+)//g'</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> count.txt</span>
<span id="cb8-9"></span>
<span id="cb8-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#and rename FUN -&gt; Acropora and comp -&gt; symbiodinium</span></span>
<span id="cb8-11"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/FUN/Acropora/g'</span> count.txt</span>
<span id="cb8-12"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sed</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-i</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'s/comp/Symbiodinium/g'</span> count.txt</span></code></pre></div></div>
<p>Ok now that it’s all tidied up, I used scp to move it onto my local drive. All done with Pegasus?!!?!!</p>


</section>

 ]]></description>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2023-12-12-final-finalgenecountsfor-acer.html</guid>
  <pubDate>Thu, 07 Dec 2023 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Downloading SST Data from CoralWatch</title>
  <link>https://ademerlis.github.io/posts/2023-12-04-downloading-sstcoral-watch-data.html</link>
  <description><![CDATA[ 




<p>Asking ChatGPT to define everything I need:</p>
<p>“Degree Heating Weeks (DHW) is a measure used to assess the thermal stress on coral reefs, which is a significant factor in coral bleaching events. It’s calculated by accumulating the amount of time sea surface temperatures exceed the long-term historical maximum mean temperature for a particular location. Here’s how you calculate DHW:</p>
<ol type="1">
<li><p><strong>Determine the Historical Maximum Mean Temperature (MMM):</strong> This is the highest average monthly sea surface temperature for a given location over a long-term period (usually over several decades). This temperature serves as a threshold.</p></li>
<li><p><strong>Monitor Daily Sea Surface Temperatures (SST):</strong> Obtain daily SST data for your location. This data is often available from satellite observations or oceanographic institutions.</p></li>
<li><p><strong>Calculate the Temperature Anomaly:</strong> For each day, determine how much the SST exceeds the MMM. This is the temperature anomaly. If the SST is lower than the MMM, the anomaly is considered zero for that day.</p></li>
<li><p><strong>Accumulate the Anomalies Over Time:</strong> Degree Heating Weeks are calculated over a rolling 12-week (84-day) period. For each day, add the temperature anomaly to a cumulative sum. Continue this process for each day in the 12-week period.</p></li>
<li><p><strong>Express the Total as Weeks:</strong> The total accumulated temperature anomaly is then divided by 7 to express it in terms of “degree heating weeks.” This unit represents the number of weeks the sea temperature has been above the MMM.</p></li>
<li><p><strong>Update Regularly:</strong> DHW is a rolling measure, so it’s updated regularly (daily or weekly) to reflect ongoing temperature conditions.</p></li>
</ol>
<p>DHW is a critical tool for marine scientists and environmental managers in monitoring and responding to the impacts of climate change on coral reef ecosystems. High DHW values indicate prolonged thermal stress, which can lead to coral bleaching and other ecological impacts.</p>
<p>Determining the Historical Maximum Mean Temperature (MMM) for a specific location involves analyzing long-term sea surface temperature data. The MMM is the highest average monthly sea surface temperature typically calculated over a baseline period of several decades. Here’s a step-by-step process to determine the MMM:</p>
<ol type="1">
<li><p><strong>Collect Long-term Sea Surface Temperature Data:</strong> Obtain historical sea surface temperature (SST) data for your location. This data is often available from meteorological organizations, oceanographic institutes, or satellite observations. The dataset should ideally span at least 20-30 years to capture climate variability.</p></li>
<li><p><strong>Select the Baseline Period:</strong> Choose a baseline period for your analysis. This period should be long enough to accurately reflect the range of natural temperature variability. Commonly, a 30-year period is used in climate studies.</p></li>
<li><p><strong>Calculate Monthly Averages:</strong> For each year in the baseline period, calculate the monthly average SST. This process involves averaging all daily temperature readings for each month.</p></li>
<li><p><strong>Identify the Maximum Monthly Average for Each Month:</strong> For each month of the year, identify the highest monthly average SST recorded during the baseline period. This gives you 12 values, each representing the highest monthly average SST for a specific month across the baseline period.</p></li>
<li><p><strong>Determine the MMM:</strong> The MMM is typically the highest of these 12 values. It represents the peak thermal threshold that the location experiences naturally.</p></li>
<li><p><strong>Consider Spatial Resolution:</strong> Depending on your study’s scale, you may need to consider the spatial resolution of your data. For large areas, you might need to calculate the MMM for different zones.</p></li>
<li><p><strong>Account for Climate Change and Variability:</strong> Be aware that climate change can affect the MMM over time. Periodically updating the MMM with recent data can ensure that your analysis reflects current climate conditions.</p></li>
<li><p><strong>Use of Remote Sensing and Models:</strong> In many cases, remote sensing data from satellites and oceanographic models are used to derive SST data, especially for remote or vast ocean areas.</p></li>
<li><p><strong>Verification and Validation:</strong> Validate your calculated MMM with any available in-situ measurements or compare it with results from other studies or datasets to ensure accuracy.</p></li>
</ol>
<p>By following these steps, you can determine the Historical Maximum Mean Temperature for a given location, which is crucial for assessing thermal stress on marine ecosystems, particularly coral reefs.”</p>
<p>The <a href="https://coralreefwatch.noaa.gov/product/5km/tutorial/crw05a_sst_product.php">NOAA CoralReefWatch</a> has tutorials on all their products.</p>
<p>I think the one I need to use is the <a href="https://www.ncei.noaa.gov/products/avhrr-pathfinder-sst">NCEI AVHRR Pathfinder SST</a>. The issue is, when I try to download the data files from 1985-2023, they are all .nc extensions. This is a NetCDF4 type file, which is not readable unless you use a code to convert it.</p>
<p>Some people in the field use MATLAB, but I’m going to try to use Python in the terminal.</p>
<p>ChatGPT:</p>
<p>“Working with NetCDF4 data, which is a common format for storing large, multi-dimensional scientific data such as sea surface temperature (SST), can be done using various software tools. Here’s a general guide on how to extract data from a NetCDF4 file into a more readable format:</p>
<section id="tools-and-libraries" class="level3">
<h3 class="anchored" data-anchor-id="tools-and-libraries">Tools and Libraries</h3>
<ol type="1">
<li><p><strong>Python Libraries:</strong> Python is a powerful tool for handling NetCDF4 data. Libraries like <code>netCDF4</code>, <code>xarray</code>, and <code>numpy</code> can be used to read, process, and visualize the data.</p></li>
<li><p><strong>GIS Software:</strong> Geographic Information System (GIS) software like QGIS or ArcGIS can import NetCDF4 files directly and visualize the data on maps.</p></li>
<li><p><strong>MATLAB:</strong> MATLAB is another popular tool for working with NetCDF4 data, especially in scientific and engineering fields.</p></li>
</ol>
</section>
<section id="steps-for-python-using-netcdf4-and-xarray" class="level3">
<h3 class="anchored" data-anchor-id="steps-for-python-using-netcdf4-and-xarray">Steps for Python (Using <code>netCDF4</code> and <code>xarray</code>)</h3>
<ol type="1">
<li><p><strong>Install Necessary Libraries:</strong></p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1">pip install netCDF4 xarray numpy matplotlib</span></code></pre></div></div></li>
<li><p><strong>Import Libraries:</strong></p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> netCDF4 <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> nc</span>
<span id="cb2-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> xarray <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> xr</span></code></pre></div></div></li>
<li><p><strong>Open the NetCDF4 File:</strong></p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1">dataset <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> xr.open_dataset(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'path_to_your_file.nc'</span>)</span></code></pre></div></div></li>
<li><p><strong>Explore the Data:</strong></p>
<ul>
<li>List variables: <code>print(dataset.variables)</code></li>
<li>Get info: <code>print(dataset.info())</code></li>
</ul></li>
<li><p><strong>Extract Data:</strong></p>
<ul>
<li>Select specific data (e.g., a variable like SST): <code>sst_data = dataset['SST']</code> (replace ‘SST’ with the actual variable name)</li>
</ul></li>
<li><p><strong>Convert to a Pandas DataFrame for Easier Reading (Optional):</strong></p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb4-2">df <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sst_data.to_dataframe()</span></code></pre></div></div></li>
<li><p><strong>Save to a CSV File (Optional):</strong></p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1">df.to_csv(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'output_filename.csv'</span>)</span></code></pre></div></div></li>
<li><p><strong>Visualize the Data (Optional):</strong></p>
<ul>
<li>Using <code>matplotlib</code> for plotting.</li>
</ul></li>
</ol>
</section>
<section id="using-gis-software" class="level3">
<h3 class="anchored" data-anchor-id="using-gis-software">Using GIS Software</h3>
<ol type="1">
<li><strong>Open the GIS software and import the NetCDF4 file.</strong></li>
<li><strong>Navigate through the layers and select the appropriate SST data.</strong></li>
<li><strong>GIS tools allow you to visualize and even export the data into different formats.</strong></li>
</ol>
</section>
<section id="matlab-approach" class="level3">
<h3 class="anchored" data-anchor-id="matlab-approach">MATLAB Approach</h3>
<ol type="1">
<li><strong>Use MATLAB functions like <code>ncdisp</code>, <code>ncread</code>, or <code>netcdf.open</code> to explore and extract data from NetCDF4 files.</strong></li>
<li><strong>MATLAB also offers visualization tools to plot and analyze the data.</strong></li>
</ol>
</section>
<section id="additional-tips" class="level3">
<h3 class="anchored" data-anchor-id="additional-tips">Additional Tips</h3>
<ul>
<li><strong>Documentation:</strong> Always refer to the documentation of the libraries or software you are using for specific functions and features.</li>
<li><strong>Handling Large Data:</strong> NetCDF4 files can be large; ensure your system has sufficient resources.</li>
<li><strong>Learning Resources:</strong> Online tutorials, forums, and community discussions can be helpful if you encounter specific issues or need advanced processing techniques.</li>
</ul>
<p>By using these tools and steps, you can effectively convert the NetCDF4 data from NOAA’s Coral Reef Watch into a more accessible and readable format for further analysis.”</p>
<p>My code in the terminal:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb6-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">python3</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--version</span></span>
<span id="cb6-2"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">pip3</span> install netCDF4 xarray numpy matplotlib <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#this line did not work because I need other packages (i.e. hdf5)</span></span>
<span id="cb6-3"></span>
<span id="cb6-4"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#install homebrew</span></span>
<span id="cb6-5"> <span class="ex" style="color: null;
background-color: null;
font-style: inherit;">/bin/bash</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-c</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">curl</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span></span>
<span id="cb6-6"></span>
<span id="cb6-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#install hdf5</span></span>
<span id="cb6-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">brew</span> install hdf5</span>
<span id="cb6-9"></span>
<span id="cb6-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#add this to ~/.bash_profile</span></span>
<span id="cb6-11"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">export</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">HDF5_DIR</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">brew</span> <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--prefix</span> hdf5<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">)</span></span>
<span id="cb6-12"></span>
<span id="cb6-13"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">export</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PATH</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>/Users/allysondemerlis/Library/Python/3.9/bin:<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">$PATH</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#command line told me to do this</span></span>
<span id="cb6-14"></span>
<span id="cb6-15"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">curl</span> https://www.ncei.noaa.gov/data/oceans/pathfinder/Version5.3/</span>
<span id="cb6-16"></span>
<span id="cb6-17"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">python3</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#activate python</span></span>
<span id="cb6-18"></span>
<span id="cb6-19"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">import</span> netCDF4 as nc</span>
<span id="cb6-20"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">import</span> xarray as xr</span>
<span id="cb6-21"></span>
<span id="cb6-22"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">dataset</span> = xr.open_dataset<span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'~/Downloads/19811231141339-NCEI-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.3_NOAA07_G_1981365_day-v02.0-fv01.0.nc'</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span>
<span id="cb6-23"></span>
<span id="cb6-24"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">sst_data</span> = dataset[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'sea_surface_temperature'</span></span>
<span id="cb6-25"></span>
<span id="cb6-26"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">sst_df</span> = sst_data.to_dataframe<span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span>
<span id="cb6-27"></span>
<span id="cb6-28"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">print</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">sst_df.head()</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Displays the first 5 row</span></span>
<span id="cb6-29"></span>
<span id="cb6-30"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#longitude boundaries: -80.001, -80.17</span></span>
<span id="cb6-31"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#latitude boundaries: 25.60, 25.80</span></span>
<span id="cb6-32"></span>
<span id="cb6-33"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Define your latitude and longitude range</span></span>
<span id="cb6-34"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">lat_range</span> = [26, 25]  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Replace with your desired range</span></span>
<span id="cb6-35"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">lon_range</span> = [-81, <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">-80]</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Replace with your desired range</span></span>
<span id="cb6-36"></span>
<span id="cb6-37"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Filter the data</span></span>
<span id="cb6-38"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">filtered_data</span> = sst_data.sel<span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lat</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>slice<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">*lat_range</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">,</span> lon=slice<span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">*lon_range</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">))</span></span>
<span id="cb6-39"></span>
<span id="cb6-40"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">print</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">filtered_data</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span>
<span id="cb6-41"></span>
<span id="cb6-42"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">import</span> pandas as pd</span>
<span id="cb6-43"><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">df</span> = filtered_data.to_dataframe<span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span>
<span id="cb6-44"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">df.to_csv</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'output_filename.csv'</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">)</span></span></code></pre></div></div>
<p><strong>unresolved issue</strong>: when I open this csv in R, it only contains data from 1981. WHY?</p>


</section>

 ]]></description>
  <category>Coding</category>
  <guid>https://ademerlis.github.io/posts/2023-12-04-downloading-sstcoral-watch-data.html</guid>
  <pubDate>Mon, 04 Dec 2023 00:00:00 GMT</pubDate>
</item>
</channel>
</rss>
