{ "cells": [ { "cell_type": "markdown", "id": "2949abe4-dfa6-4c4a-a395-a3a1db92b5e7", "metadata": {}, "source": [ "# Compare E5 coral sRNA-seq trimming options\n", "\n", "Simple adapter trimming vs. adapter trimming and trimming to expect sRNA lengths.\n" ] }, { "cell_type": "markdown", "id": "ee0ebae6-d54c-4d18-88bd-3d3456a8b1e6", "metadata": {}, "source": [ "### List computer specs" ] }, { "cell_type": "code", "execution_count": 1, "id": "9f60016c-d6b6-4b6d-86d3-5ee68b55464c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "TODAY'S DATE:\n", "Wed May 24 10:44:03 PDT 2023\n", "------------\n", "\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "No LSB modules are available.\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Distributor ID:\tUbuntu\n", "Description:\tUbuntu 18.04.6 LTS\n", "Release:\t18.04\n", "Codename:\tbionic\n", "\n", "------------\n", "HOSTNAME: \n", "raven\n", "\n", "------------\n", "Computer Specs:\n", "\n", "Architecture: x86_64\n", "CPU op-mode(s): 32-bit, 64-bit\n", "Byte Order: Little Endian\n", "CPU(s): 48\n", "On-line CPU(s) list: 0-47\n", "Thread(s) per core: 2\n", "Core(s) per socket: 24\n", "Socket(s): 1\n", "NUMA node(s): 1\n", "Vendor ID: GenuineIntel\n", "CPU family: 6\n", "Model: 85\n", "Model name: Intel(R) Xeon(R) Gold 5220R CPU @ 2.20GHz\n", "Stepping: 7\n", "CPU MHz: 1000.108\n", "CPU max MHz: 4000.0000\n", "CPU min MHz: 1000.0000\n", "BogoMIPS: 4400.00\n", "Virtualization: VT-x\n", "L1d cache: 32K\n", "L1i cache: 32K\n", "L2 cache: 1024K\n", "L3 cache: 36608K\n", "NUMA node0 CPU(s): 0-47\n", "Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities\n", "\n", "------------\n", "\n", "Memory Specs\n", "\n", " total used free shared buff/cache available\n", "Mem: 247G 9.5G 76G 672K 161G 235G\n", "Swap: 99G 583M 99G\n" ] } ], "source": [ "%%bash\n", "echo \"TODAY'S DATE:\"\n", "date\n", "echo \"------------\"\n", "echo \"\"\n", "#Display operating system info\n", "lsb_release -a\n", "echo \"\"\n", "echo \"------------\"\n", "echo \"HOSTNAME: \"; hostname \n", "echo \"\"\n", "echo \"------------\"\n", "echo \"Computer Specs:\"\n", "echo \"\"\n", "lscpu\n", "echo \"\"\n", "echo \"------------\"\n", "echo \"\"\n", "echo \"Memory Specs\"\n", "echo \"\"\n", "free -mh" ] }, { "cell_type": "markdown", "id": "19866f68-bfad-4a83-adb5-24e271e29d06", "metadata": {}, "source": [ "### Set variables\n", "- `%env` indicates a bash variable\n", "\n", "- without `%env` is Python variable" ] }, { "cell_type": "code", "execution_count": 2, "id": "7293bcb0-581c-4ad2-8f1e-09dd98352aaf", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "env: data_dir=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq\n", "env: analysis_dir=/home/shared/8TB_HDD_01/sam/analyses/20230524-E5-coral-sRNAseq_trimmings_comparisons\n", "env: R1_fastq=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq/sRNA-ACR-140-S1-TP2_R1_001.fastq.gz\n", "env: R2_fastq=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq/sRNA-ACR-140-S1-TP2_R2_001.fastq.gz\n", "env: threads=40\n", "env: max_read_length=50\n", "env: fastqc=/home/shared/FastQC/fastqc\n", "env: flexbar=/home/shared/flexbar-3.5.0-linux/flexbar\n", "env: break_line=--------------------------------------------------------------------------\n" ] } ], "source": [ "# Set directories, input/output files\n", "%env data_dir=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq\n", "%env analysis_dir=/home/shared/8TB_HDD_01/sam/analyses/20230524-E5-coral-sRNAseq_trimmings_comparisons\n", "analysis_dir=\"/home/shared/8TB_HDD_01/sam/20230524-E5-coral-sRNAseq_trimmings_comparisons\"\n", "\n", "%env R1_fastq=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq/sRNA-ACR-140-S1-TP2_R1_001.fastq.gz\n", "%env R2_fastq=/home/shared/8TB_HDD_01/sam/data/A_pulchra/sRNAseq/sRNA-ACR-140-S1-TP2_R2_001.fastq.gz\n", "\n", "# Set CPU threads\n", "%env threads=40\n", "\n", "# Max read length\n", "%env max_read_length=50\n", "\n", "# Set program locations\n", "%env fastqc=/home/shared/FastQC/fastqc\n", "%env flexbar=/home/shared/flexbar-3.5.0-linux/flexbar\n", "\n", "# Set some formatting stuff\n", "%env break_line=--------------------------------------------------------------------------" ] }, { "cell_type": "markdown", "id": "7f204c16-2d1f-4837-93b0-1fb0e3d00d64", "metadata": {}, "source": [ "### Create analysis directory" ] }, { "cell_type": "code", "execution_count": 3, "id": "8f275e34-c56e-4754-abf7-3279667434bb", "metadata": {}, "outputs": [], "source": [ "%%bash\n", "# Make analysis and data directory, if doesn't exist\n", "mkdir --parents \"${analysis_dir}\"\n", "\n", "mkdir --parents \"${data_dir}\"" ] }, { "cell_type": "markdown", "id": "f11a55a2-f40f-4341-98f8-6af2f5c1c4c0", "metadata": { "tags": [] }, "source": [ "# Adapter only trimming" ] }, { "cell_type": "markdown", "id": "ec3f4273-c642-4f03-828c-a5aca6788e83", "metadata": {}, "source": [ "### Inspect NEB Adapter FastA\n", "\n", "Adapter sequences are in the NEB sRNA kit protocol used by Azenta for library construction." ] }, { "cell_type": "code", "execution_count": 4, "id": "b79fbff5-e5fa-48fa-a9eb-339090d486f6", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ ">first\n", "AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC\n", ">second\n", "GATCGTCGGACTGTAGAACTCTGAACGTGTAGATCTCGGTGGTCGCCGTATCATT\n" ] } ], "source": [ "%%bash\n", "cat \"${data_dir}/NEB-adapters.fasta\"" ] }, { "cell_type": "markdown", "id": "197bc08b-8a5e-4c6d-94b7-77c6d1bf509a", "metadata": {}, "source": [ "### Trim adapters\n", "\n", "Options:\n", "\n", "- `-ap`: For paired-end analysis; recommended by NEB\n", "\n", "- `-qf il.8`: Sets quality type as Illumina v1.8\n", "\n", "- `qt`: Mean quality score of 25\n", "\n", "- `--target`: Sets output filename\n", "\n", "- `--zip-output GZ`: Sets gzip compression for trimmed files" ] }, { "cell_type": "code", "execution_count": 5, "id": "699c2a9c-504d-4993-8a78-fa4e3264f05d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "total 633M\n", "-rw-rw-r-- 1 sam sam 311M May 24 10:48 sRNA-ACR-140-S1-TP2_R1_001-adapter_trim_only_1.fastq.gz\n", "-rw-rw-r-- 1 sam sam 322M May 24 10:48 sRNA-ACR-140-S1-TP2_R1_001-adapter_trim_only_2.fastq.gz\n", "-rw-rw-r-- 1 sam sam 2.6K May 24 10:48 sRNA-ACR-140-S1-TP2_R1_001-adapter_trim_only.log\n" ] } ], "source": [ "%%bash\n", "cd ${analysis_dir}\n", "\n", "${flexbar} \\\n", "-r ${R1_fastq} \\\n", "-p ${R2_fastq} \\\n", "-a ${data_dir}/NEB-adapters.fasta \\\n", "-ap ON \\\n", "-qf i1.8 \\\n", "-qt 25 \\\n", "--threads ${threads} \\\n", "--target sRNA-ACR-140-S1-TP2_R1_001-adapter_trim_only \\\n", "--zip-output GZ\n", "\n", "ls -lh" ] }, { "cell_type": "markdown", "id": "db485f1e-5e01-4744-a636-8bc76deb2c4e", "metadata": {}, "source": [ "### Check log file" ] }, { "cell_type": "code", "execution_count": 6, "id": "df8ab7a2-edd7-4b09-9f7c-abc8f5218b29", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " ________ __ \n", " / ____/ /__ _ __/ /_ ____ ______\n", " / /_ / / _ \\| |/ / __ \\/ __ `/ ___/\n", " / __/ / / __/> = read start\n", " LTAIL: consider first n bases of reads in alignment\n", " RTAIL: use only last n bases, see tail-length options\n", "\n", "EXAMPLES\n", " flexbar -r reads.fq -t target -q TAIL -qf i1.8\n", " flexbar -r reads.fq -b barcodes.fa -bt LTAIL\n", " flexbar -r reads.fq -a adapters.fa -ao 3 -ae 0.1\n", " flexbar -r r1.fq -p r2.fq -a a1.fa -a2 a2.fa -ap ON\n", " flexbar -r r1.fq -p r2.fq -aa TruSeq -ap ON\n", "\n", "VERSION\n", " Last update: May 2019\n", " flexbar version: 3.5.0\n", " SeqAn version: 2.4.0\n", "\n", "Available on github.com/seqan/flexbar\n", "\n" ] } ], "source": [ "%%bash\n", "${flexbar} -hh" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.10" } }, "nbformat": 4, "nbformat_minor": 5 }