Generating Pseudo-Replicates for ONT Methylation Analysis: Splitting POD5 Files vs. BAM Subsampling for nf-core/methylong (Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans)

To create pseudo-replicates for statistical analysis, splitting the POD5 files is the best approach. This ensures that each replicate is processed independently from basecalling to alignment, which better simulates technical variability and avoids biases introduced by splitting already-aligned BAM files (which might have mapping dependencies).

Here is the strategy:

  1. Split POD5s: For each sample, split the original pod5_pass directory into two subsets (Replicate 1 and Replicate 2).To create pseudo-replicates for statistical analysis, splitting the POD5 files is the best approach. This ensures that each replicate is processed independently from basecalling to alignment, which better simulates technical variability and avoids biases introduced by splitting already-aligned BAM files (which might have mapping dependencies).

Here is the strategy:

  1. Split POD5s: For each sample, split the original pod5_pass directory into two subsets (Replicate 1 and Replicate 2). We will use a simple script to randomly assign ~50% of reads to each replicate.
  2. Adapt generate_mapped_modbam.sh: Modify the script to process these split POD5 directories.
  3. Update Samplesheets: Create new samplesheets that list the pseudo-replicates.

Step 1: Script to Split POD5 Files

First, let’s create a helper script to split your POD5 files. Save this as split_pod5.sh.

#!/bin/bash
# split_pod5.sh - Splits POD5 files into two pseudo-replicates
set -euo pipefail

# Configuration
BASE_DIR="/home/jhuang/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans"
POD5_BASE="${BASE_DIR}/X101SC26036392-Z01-J004/Release-X101SC26036392-Z01-J004-20260625_01/Data-X101SC26036392-Z01-J004"

# List of sample folders relative to POD5_BASE
SAMPLES=("S2_Light" "S2_Dark" "T" "O" "WT_Trans" "O_Trans" "WT")

for SAMPLE in "${SAMPLES[@]}"; do
    echo "Processing ${SAMPLE}..."

    # Define source directory
    SRC_DIR="${POD5_BASE}/${SAMPLE}/1732_2B_PBK77125_17f5982a/${SAMPLE}_pod5_pass"

    # Define output directories for replicates
    REP1_DIR="${SRC_DIR}_rep1"
    REP2_DIR="${SRC_DIR}_rep2"

    # Create output dirs if they don't exist
    mkdir -p "${REP1_DIR}" "${REP2_DIR}"

    # Get all pod5 files
    FILES=("${SRC_DIR}"/*.pod5)
    TOTAL=${#FILES[@]}

    if [ "$TOTAL" -eq 0 ]; then
        echo "No POD5 files found for ${SAMPLE}. Skipping."
        continue
    fi

    echo "Found ${TOTAL} POD5 files. Splitting..."

    # Shuffle and split
    # Note: shuf is part of coreutils on Linux
    SHUFFLED=($(shuf -e "${FILES[@]}"))

    MID=$((TOTAL / 2))

    # Copy first half to rep1, second half to rep2
    for i in "${!SHUFFLED[@]}"; do
        FILE="${SHUFFLED[$i]}"
        BASENAME=$(basename "${FILE}")

        if [ "$i" -lt "$MID" ]; then
            cp "${FILE}" "${REP1_DIR}/${BASENAME}"
        else
            cp "${FILE}" "${REP2_DIR}/${BASENAME}"
        fi
    done

    echo "✅ ${SAMPLE} split complete: ${MID} files in rep1, $((TOTAL - MID)) files in rep2"
done

echo "🎉 All POD5 files split successfully!"

Run this script once:

chmod +x split_pod5.sh
./split_pod5.sh

Step 2: Adapted generate_mapped_modbam_rep.sh

This updated script now processes the _rep1 and _rep2 directories created above. It generates separate BAM files for each replicate.

#!/bin/bash
#===============================================================================
# generate_mapped_modbam_pseudo_reps_rep.sh - Local Dorado generation for pseudo-replicates
#===============================================================================
set -euo pipefail

# === Configuration ===
DORADO="/home/jhuang/Tools/dorado-2.0.0-linux-x64/bin/dorado"  # Your local Dorado path
BASE_DIR="/home/jhuang/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans"
OUTDIR="${BASE_DIR}"

# Reference genome paths
REF_S2_LIGHT="${BASE_DIR}/S2_Light-trycycler-medaka_polished_genome.fa"
REF_S2_DARK="${BASE_DIR}/S2_Dark-trycycler-medaka_polished_genome.fa"
REF_T="${BASE_DIR}/T-trycycler-medaka_polished_genome.fa"
REF_O="${BASE_DIR}/O-trycycler-medaka_polished_genome.fa"
REF_WT_TRANS="${BASE_DIR}/WT_Trans-trycycler-medaka_polished_genome.fa"
REF_O_TRANS="${BASE_DIR}/O_Trans-trycycler-medaka_polished_genome.fa"
REF_WT="${BASE_DIR}/WT-trycycler-medaka_polished_genome.fa"

# POD5 data paths (Updated to point to split replicas)
POD5_BASE="${BASE_DIR}/X101SC26036392-Z01-J004/Release-X101SC26036392-Z01-J004-20260625_01/Data-X101SC26036392-Z01-J004"

# Helper function to get pod5 path
get_pod5_path() {
    local SAMPLE=$1
    local REP=$2
    echo "${POD5_BASE}/${SAMPLE}/1732_2B_PBK77125_17f5982a/${SAMPLE}_pod5_pass_${REP}"
}

# Dorado model
MODEL="dna_r10.4.1_e8.2_400bps_sup@v5.0.0"

# Ensure all reference genomes are indexed
echo "📚 Indexing reference genomes..."
for REF in "${REF_S2_LIGHT}" "${REF_S2_DARK}" "${REF_T}" "${REF_O}" "${REF_WT_TRANS}" "${REF_O_TRANS}" "${REF_WT}"; do
    if [ ! -f "${REF}.fai" ]; then
        echo "   Indexing: $(basename ${REF})"
        samtools faidx "${REF}"
    fi
done

# === Function: Generate modBAM ===
generate_modbam() {
    local SAMPLE_NAME=$1
    local REF=$2
    local POD5_DIR=$3
    local MOD_BASES=$4

    echo "🚀 Generating ${SAMPLE_NAME} ${MOD_BASES} modBAM (aligned)..."

    # Check if pod5 dir exists
    if [ ! -d "${POD5_DIR}" ]; then
        echo "❌ Error: POD5 directory not found: ${POD5_DIR}"
        return 1
    fi

    "${DORADO}" basecaller \
        --modified-bases "${MOD_BASES}" \
        --emit-moves \
        --device cuda:0 \
        --reference "${REF}" \
        "${MODEL}" \
        "${POD5_DIR}" | samtools view -b - > "${OUTDIR}/${SAMPLE_NAME}_${MOD_BASES//\//_}_mapped.mod.bam"
}

# === Process all samples and replicates ===
SAMPLES=("S2_Light" "S2_Dark" "T" "O" "WT_Trans" "O_Trans" "WT")
REPS=("rep1" "rep2")
MOD_TYPES=("6mA" "4mC_5mC")

# Associative array for references
declare -A REFS
REFS["S2_Light"]="${REF_S2_LIGHT}"
REFS["S2_Dark"]="${REF_S2_DARK}"
REFS["T"]="${REF_T}"
REFS["O"]="${REF_O}"
REFS["WT_Trans"]="${REF_WT_TRANS}"
REFS["O_Trans"]="${REF_O_TRANS}"
REFS["WT"]="${REF_WT}"

for SAMPLE in "${SAMPLES[@]}"; do
    REF="${REFS[$SAMPLE]}"

    for REP in "${REPS[@]}"; do
        POD5_DIR=$(get_pod5_path "${SAMPLE}" "${REP}")
        SAMPLE_TAG="${SAMPLE}_${REP}"

        for MOD in "${MOD_TYPES[@]}"; do
            generate_modbam "${SAMPLE_TAG}" "${REF}" "${POD5_DIR}" "${MOD}"
        done
    done
done

# === Verify Output ===
echo ""
echo "🔍 Verifying BAM files..."
for BAM in "${OUTDIR}"/*_rep[12]_*_mapped.mod.bam; do
    if [ -f "${BAM}" ]; then
        if samtools quickcheck "${BAM}" 2>/dev/null; then
            READS=$(samtools view -c "${BAM}")
            echo "✅ $(basename "${BAM}"): ${READS} reads"
        else
            echo "❌ $(basename "${BAM}"): Corrupted or invalid format"
        fi
    fi
done

echo ""
echo "🎉 Pseudo-replicate modBAM generation complete!"
echo "📁 Output directory: ${OUTDIR}"

Step 3: Updated Samplesheets

You need to update your CSV files to include the pseudo-replicates. The group column should remain the same (e.g., “WT”) so that downstream tools know they belong to the same biological condition, but the sample name must be unique (e.g., “WT_rep1”).

samplesheet_6mA_rep.csv

group,sample,path,ref,method
WT,WT_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
WT,WT_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
T,T_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
T,T_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
O,O_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
O,O_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep1_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep2_6mA_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont

samplesheet_4mC_5mC_rep.csv

group,sample,path,ref,method
WT,WT_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
WT,WT_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT-trycycler-medaka_polished_genome.fa,ont
T,T_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
T,T_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/T-trycycler-medaka_polished_genome.fa,ont
O,O_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
O,O_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
WT_Trans,WT_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/WT_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
O_Trans,O_Trans_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/O_Trans-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Light,S2_Light_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Light-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep1,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep1_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont
S2_Dark,S2_Dark_rep2,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark_rep2_4mC_5mC_mapped.mod.bam,/mnt/md1/DATA/Data_Tam_Methylation_2026_WT_T_O_T_Trans_O_Trans/S2_Dark-trycycler-medaka_polished_genome.fa,ont

Next Steps

  1. Run split_pod5.sh to create the replicated POD5 directories.
  2. Run the new generate_mapped_modbam.sh to create the BAM files. Note: This will take roughly twice as long as before since you are processing all reads again.
  3. Use the new CSV files with nf-core/methylong.
  4. When running modkit pileup manually afterwards, ensure you update the loop to iterate over the new replicate names (e.g., WT_rep1, WT_rep2, etc.) if you wish to generate per-replicate BED files, or keep the original logic if nf-core/methylong handles the aggregation correctly. Usually, for differential methylation analysis later, having per-replicate BEDs or counts is beneficial.

Small RNA-Seq Analysis Pipeline: Identifying miRNA Targets in MKL-1 and WaGa Cell Lines

  • distribution_heatmap_MKL-1
  • differentially_expressed_miRNAs_heatmap_MKL-1
  • volcano_plot_untreated_vs_parental_cells_MKL-1
  1. Input data

     WaGa wt cells (nf774* (Considering to be deleted, due to possibly be an outlier, but in the current version, it is still included in the analysis), nf961, nf962)
     WaGa wt_EV_RNA (nf657* (The sample was EXCLUDED, since it is obviously a outlier, not clustered with the other 2 samples), nf930, nf935)
     WaGa_sT_DMSO_EV_RNA (nf931, nf936, nf971)
     WaGa_sT_Dox_EV_RNA (nf932, nf937, nf972)
     WaGa_scr_DMSO_EV_RNA (nf933, nf938, nf973)
     WaGa_scr_Dox_EV_RNA (nf934, nf939, nf974)
     # --> In total, 17 samples
    
     MKL-1 wt cells (nf780*, nf796*, nf797*)
     MKL-1 wt_EV_RNA (nf655* (The sample was EXCLUDED), 2404, 2608)
     MKL-1_sT_DMSO_EV_RNA (2608, 2701, 2802)
     MKL-1_sT_Dox_EV_RNA (2608, 2701, 2802)
     MKL-1_scr_DMSO_EV_RNA (2608, 2701, 2802)
     MKL-1_scr_Dox_EV_RNA (2608, 2701, 2802)
     # --> In total, 18 samples
    
     #Note that the real paths are as follows:
     #./20260506_AV243904_0073_A/2404_MKL1_wt_EVs/2404_MKL1_wt_EVs_R1.fastq.gz, ./20260506_AV243904_0073_A/2608_MKL1_wt_EVs/2608_MKL1_wt_EVs_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_sT_DMSO/2608_MKL1_sT_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_sT_DMSO/2701_MKL1_sT_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_sT_DMSO/2802_MKL1_sT_DMSO_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_sT_Dox/2608_MKL1_sT_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_sT_Dox/2701_MKL1_sT_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_sT_Dox/2802_MKL1_sT_Dox_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_scr_DMSO/2608_MKL1_scr_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_scr_DMSO/2701_MKL1_scr_DMSO_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_scr_DMSO/2802_MKL1_scr_DMSO_R1.fastq.gz
     #./20260506_AV243904_0073_A/2608_MKL1_scr_Dox/2608_MKL1_scr_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2701_MKL1_scr_Dox/2701_MKL1_scr_Dox_R1.fastq.gz, ./20260506_AV243904_0073_A/2802_MKL1_scr_Dox/2802_MKL1_scr_Dox_R1.fastq.gz
  2. Adapter trimming

     #some common adapter sequences from different kits for reference:
     #    - TruSeq Small RNA (Illumina): TGGAATTCTCGGGTGCCAAGG
     #    - Small RNA Kits V1 (Illumina): TCGTATGCCGTCTTCTGCTTGT
     #    - Small RNA Kits V1.5 (Illumina): ATCTCGTATGCCGTCTTCTGCTTG
     #    - NEXTflex Small RNA Sequencing Kit v3 for Illumina Platforms (Bioo Scientific): TGGAATTCTCGGGTGCCAAGG
     #    - LEXOGEN Small RNA-Seq Library Prep Kit (Illumina): TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC *
     mkdir Data_Ute_smallRNA_via_exceRpt_workspace/trimmed; cd Data_Ute_smallRNA_via_exceRpt_workspace/trimmed
    
     echo "------------------------------------ cutadapting nf774 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf774.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/220617_NB501882_0371_AH7572BGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf774/0403_WaGa_wt_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf657 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf657.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/210817_NB501882_0294_AHW5Y2BGXJ_smallRNA_Ute_newDemulti/2021_nf_ute_smallRNA/nf657/WaGa_derived_EV_miRNA_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf655 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf655.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/210817_NB501882_0294_AHW5Y2BGXJ_smallRNA_Ute_newDemulti/2021_nf_ute_smallRNA/nf655/MKL_1_derived_EV_miRNA_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf780 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf780.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/220617_NB501882_0371_AH7572BGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf780/0505_MKL1_wt_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf796 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf796.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/221216_NB501882_0404_AHLVNMBGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf796/MKL-1_wt_1_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf797 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf797.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_4/230623_newDemulti_smallRNAs/221216_NB501882_0404_AHLVNMBGXM_smallRNA_Ute_newDemulti/2022_nf_ute_smallRNA/nf797/MKL-1_wt_2_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf930 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf930.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf930/01_0505_WaGa_wt_EV_RNA_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf931 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf931.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf931/02_0505_WaGa_sT_DMSO_EV_RNA_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf932 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf932.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf932/03_0505_WaGa_sT_Dox_EV_RNA_S3_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf933 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf933.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf933/04_0505_WaGa_scr_DMSO_EV_RNA_S4_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf934 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf934.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf934/05_0505_WaGa_scr_Dox_EV_RNA_S5_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf935 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf935.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf935/06_1905_WaGa_wt_EV_RNA_S6_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf936 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf936.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf936/07_1905_WaGa_sT_DMSO_EV_RNA_S7_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf937 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf937.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf937/08_1905_WaGa_sT_Dox_EV_RNA_S8_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf938 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf938.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf938/09_1905_WaGa_scr_DMSO_EV_RNA_S9_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf939 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf939.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf939/10_1905_WaGa_scr_Dox_EV_RNA_S10_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf940 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf940.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf940/11_control_MKL1_S11_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf941 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf941.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/231016_NB501882_0435_AHG7HMBGXV/nf941/12_control_WaGa_S12_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf961 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf961.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf961/WaGaWTcells_1_S1_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf962 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf962.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf962/WaGaWTcells_2_S2_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf971 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf971.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf971/2001_WaGa_sT_DMSO_S3_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf972 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf972.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf972/2001_WaGa_sT_Dox_S4_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf973 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf973.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf973/2001_WaGa_scr_DMSO_S5_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting nf974 -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o nf974.fastq.gz ~/DATA/Data_Ute/Data_Ute_smallRNA_7/250411_VH00358_135_AAGKGLHM5/nf974/2001_WaGa_scr_Dox_S6_R1_001.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2404_MKL1_wt_EVs -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2404_MKL1_wt_EVs.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2404_MKL1_wt_EVs/2404_MKL1_wt_EVs_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_wt_EVs -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_wt_EVs.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_wt_EVs/2608_MKL1_wt_EVs_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_sT_DMSO/2608_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_sT_DMSO/2701_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_sT_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_sT_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_sT_DMSO/2802_MKL1_sT_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_sT_Dox/2608_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_sT_Dox/2701_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_sT_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_sT_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_sT_Dox/2802_MKL1_sT_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_scr_DMSO/2608_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_scr_DMSO/2701_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_scr_DMSO -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_scr_DMSO.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_scr_DMSO/2802_MKL1_scr_DMSO_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2608_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2608_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2608_MKL1_scr_Dox/2608_MKL1_scr_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2701_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2701_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2701_MKL1_scr_Dox/2701_MKL1_scr_Dox_R1.fastq.gz >> LOG
    
     echo "------------------------------------ cutadapting 2802_MKL1_scr_Dox -----------------------------------" >> LOG
     cutadapt -a TGGAATTCTCGGGTGCCAAGGAACTCCAGTCAC -q 20 --minimum-length 5 --trim-n -o 2802_MKL1_scr_Dox.fastq.gz ~/DATA/Data_Ute_smallRNA/20260506_AV243904_0073_A/2802_MKL1_scr_Dox/2802_MKL1_scr_Dox_R1.fastq.gz >> LOG
  3. Install exceRpt (https://github.gersteinlab.org/exceRpt/)

     docker pull rkitchen/excerpt
     mkdir MyexceRptDatabase
     cd /mnt/nvme0n1p1/MyexceRptDatabase
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg38_lowmem.tgz
     tar -xvf exceRptDB_v4_hg38_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg19_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_hg38_lowmem.tgz
     #http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_mm10_lowmem.tgz
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_EXOmiRNArRNA.tgz
     tar -xvf exceRptDB_v4_EXOmiRNArRNA.tgz
     wget http://org.gersteinlab.excerpt.s3-website-us-east-1.amazonaws.com/exceRptDB_v4_EXOGenomes.tgz
     tar -xvf exceRptDB_v4_EXOGenomes.tgz
    
     # List extracted hg38 directory structure
     find hg38 -type f | sed 's|^hg38/||' | sort > extracted_hg38.txt
     comm -3 extracted_hg38.txt <(tar -tf exceRptDB_v4_hg38_lowmem.tgz | grep '^hg38/' | sed 's|^hg38/||' | sort)  # --> DIR hg38
     tar -tf exceRptDB_v4_EXOmiRNArRNA.tgz  # --> DIR ribosomeDatabase, NCBI_taxonomy_taxdump, miRBase
     tar -tf exceRptDB_v4_EXOGenomes.tgz  # --> Genomes_BacteriaFungiMammalPlantProtistVirus
  4. Run exceRpt

     #[---- REAL_RUNNING_COMPLETE_DB ---->]
     #NOTE that if not renamed in the input files, then have to RENAME all files recursively by removing "_cutadapted.fastq" in all names in _CORE_RESULTS_v4.6.3.tgz (first unzip, removing, then zip, mv to ../results_g).
     cd trimmed
     for file in *.fastq.gz; do
         echo "mv \"$file\" \"${file/.fastq/}\""
     done
    
     mkdir results
     for sample in nf780 nf796 nf797  nf655    nf774 nf961 nf962  nf657 nf930 nf935  nf931 nf936 nf971  nf932 nf937 nf972  nf933 nf938 nf973  nf934 nf939 nf974; do
         docker run -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/trimmed:/exceRptInput \
                    -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/results:/exceRptOutput \
                   -v /mnt/nvme0n1p1/MyexceRptDatabase:/exceRpt_DB \
                   -t rkitchen/excerpt \
                   INPUT_FILE_PATH=/exceRptInput/${sample}.gz MAIN_ORGANISM_GENOME_ID=hg38 N_THREADS=50 JAVA_RAM='200G' MAP_EXOGENOUS=on
     done
    
     for sample in 2404_MKL1_wt_EVs 2608_MKL1_wt_EVs    2608_MKL1_sT_DMSO 2701_MKL1_sT_DMSO 2802_MKL1_sT_DMSO    2608_MKL1_sT_Dox 2701_MKL1_sT_Dox 2802_MKL1_sT_Dox    2608_MKL1_scr_DMSO 2701_MKL1_scr_DMSO 2802_MKL1_scr_DMSO    2608_MKL1_scr_Dox 2701_MKL1_scr_Dox 2802_MKL1_scr_Dox; do
         docker run -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/trimmed:/exceRptInput \
                    -v ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/results:/exceRptOutput \
                   -v /mnt/nvme3n1p1/MyexceRptDatabase:/exceRpt_DB \
                   -t rkitchen/excerpt \
                   INPUT_FILE_PATH=/exceRptInput/${sample}.gz MAIN_ORGANISM_GENOME_ID=hg38 N_THREADS=50 JAVA_RAM='200G' MAP_EXOGENOUS=on
     done
    
     #DEBUG the excerpt env
     docker inspect rkitchen/excerpt:latest
     # Without /bin/bash → May run and exit immediately
     #docker run -it rkitchen/excerpt
     # With /bin/bash → Stays open for interaction
     docker run -it --entrypoint /bin/bash rkitchen/excerpt
  5. Processing exceRpt output from multiple samples

     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/exceRpt-master
     mamba activate r_env
     mamba install -c conda-forge -c bioconda \
         bioconductor-marray \
         bioconductor-rgraphviz \
         r-plyr r-gplots r-reshape2 r-ggplot2 r-scales r-openxlsx r-rcurl r-xml \
         -y
     mamba install -c conda-forge -c bioconda \
         r-plyr r-gplots r-reshape2 r-ggplot2 r-scales r-openxlsx \
         bioconductor-marray bioconductor-rgraphviz \
         -y
    
     #mkdir summaries heatmap_all_WaGa+4_MKL-1
     mkdir results_WaGa_EXCLUDED results_MKL-1 summaries_WaGa summaries_MKL-1 heatmap_WaGa heatmap_MKL-1
     #! EXCLUDE some isolates since they have total different pattern or due to bad quality --> outliner, until now only one sample, namely nf657 from WaGa wt EV:
     sudo mv results/nf657* results_WaGa_EXCLUDED/
     sudo mv results/nf780* results_MKL-1/
     sudo mv results/nf796* results_MKL-1/
     sudo mv results/nf797* results_MKL-1/
     sudo mv results/nf655* results_MKL-1/
     for sample in 2404_MKL1_wt_EVs 2608_MKL1_wt_EVs    2608_MKL1_sT_DMSO 2701_MKL1_sT_DMSO 2802_MKL1_sT_DMSO    2608_MKL1_sT_Dox 2701_MKL1_sT_Dox 2802_MKL1_sT_Dox    2608_MKL1_scr_DMSO 2701_MKL1_scr_DMSO 2802_MKL1_scr_DMSO    2608_MKL1_scr_Dox 2701_MKL1_scr_Dox 2802_MKL1_scr_Dox; do
         echo "sudo mv results/${sample}* results_MKL-1/"
     done
     #Following our initial QC, I noticed that one of the MKL-1 wt-EV samples (nf655) is a clear outlier, clustering far apart from the other two wt-EV replicates in the PCoA plots. I recommend removing nf655 from the downstream MKL-1 analysis, which is similar to our earlier analysis for MKL-1, in which we removed the outlier nf657. Please see the attached figures for reference.
     mv results_MKL-1/nf655* results_MKL-1_EXCLUDED/
    
     (r_env) jhuang@WS-2290C:~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/exceRpt-master$ R
     #WARNING: need to reload the R-script after each change of the script.
     source("mergePipelineRuns_functions.R")
     processSamplesInDir("../results_WaGa/", "../summaries_WaGa")
     processSamplesInDir("../results_MKL-1/", "../summaries_MKL-1")
    
     #mkdir heatmap_WaGa; cp summaries_WaGa/*.RData heatmap_WaGa; rm heatmap_WaGa/exceRpt_sampleGroupDefinitions.txt;
     source("mergePipelineRuns_functions_addSampleGroupInfo_WaGa.R")
     processSamplesInDir("../results_WaGa/", "../heatmap_WaGa")
    
     #mkdir heatmap_MKL-1; cp summaries_MKL-1/*.RData heatmap_MKL-1; rm heatmap_MKL-1/exceRpt_sampleGroupDefinitions.txt;
     source("mergePipelineRuns_functions_addSampleGroupInfo_MKL-1.R")
     processSamplesInDir("../results_MKL-1/", "../heatmap_MKL-1")
    
     #!!!!! IMPORTANT: REPORT heatmap_MKL-1/exceRpt_DiagnosticPlots.pdf and heatmap_MKL-1/mapping_heatmap3.pdf (They are almost the same, mapping_heatmap3.pdf is better due to bigger font size) !!!!
     #CONSIDERING_TO_DEL_nf774 since it is very far to another two samples (MAYBE BETTER NOT DO THIS, SINCE I HAVE TO GENERATE PCA- and MANHATTAN PLOTS!!): now the sample nf774 was kept in the WaGa results.
    
     #~/Tools/csv2xls-0.4/csv_to_xls.py exceRpt_miRNA_ReadsPerMillion.txt exceRpt_tRNA_ReadsPerMillion.txt exceRpt_piRNA_ReadsPerMillion.txt -d$'\t' -o exceRpt_results_detailed.xls
    
     # Report summaries_WaGa/exceRpt_mapping_heatmaps_WaGa.xlsx or summaries_MKL-1/exceRpt_mapping_heatmaps_MKL-1.xlsx;
     #        summaries_WaGa/exceRpt_results_detailed_WaGa.xls or summaries_MKL-1/exceRpt_results_detailed_MKL-1.xls;
     #        heatmap_WaGa/mapping_heatmap3_WaGa.pdf or heatmap_MKL-1/mapping_heatmap3_MKL-1.pdf
  6. Downstream analyis using R for miRNAs (17 WaGa samples)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     ## WaGa experimental groups (scr = scramble control; sT = target knockdown)
     #WaGa_scr_DMSO_EV (nf933, nf938, nf973)
     #WaGa_scr_Dox_EV (nf934, nf939, nf974)
     #WaGa_sT_DMSO_EV (nf931, nf936, nf971)
     #WaGa_sT_Dox_EV (nf932, nf937, nf972)
     #
     ## WaGa wild-type controls
     #WaGa_wt_cells (nf774, nf961, nf962)
     #WaGa_wt_EV (nf930, nf935)
    
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_WaGa
     mamba activate r_env
     R
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     d.raw<- read.delim2("exceRpt_miRNA_ReadCounts.txt",sep="\t", header=TRUE, row.names=1)
    
     # Desired column order
     desired_order <- c(
         "nf933", "nf938", "nf973",
         "nf934", "nf939", "nf974",
         "nf931", "nf936", "nf971",
         "nf932", "nf937", "nf972",
         "nf774", "nf961", "nf962",
         "nf930", "nf935"
     )
    
     # Reorder columns
     d.raw <- d.raw[, desired_order]
     setdiff(desired_order, colnames(d.raw))  # Shows missing or misnamed columns
     #sapply(d.raw, is.numeric)
     d.raw[] <- lapply(d.raw, as.numeric)
     #d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
     write.csv(d.raw, file ="d_raw.csv")
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     # ------ Code sent to Ute ------
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
     Cell_or_EV = as.factor(c("EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "Cell","Cell","Cell",  "EV","EV"))
     replicates = as.factor(c("WaGa_scr_DMSO_EV","WaGa_scr_DMSO_EV","WaGa_scr_DMSO_EV",     "WaGa_scr_Dox_EV","WaGa_scr_Dox_EV","WaGa_scr_Dox_EV",  "WaGa_sT_DMSO_EV","WaGa_sT_DMSO_EV","WaGa_sT_DMSO_EV",  "WaGa_sT_Dox_EV","WaGa_sT_Dox_EV","WaGa_sT_Dox_EV",  "WaGa_wt_cells", "WaGa_wt_cells","WaGa_wt_cells",  "WaGa_wt_EV", "WaGa_wt_EV"))
     ids = as.factor(c(
         "nf933", "nf938", "nf973",
         "nf934", "nf939", "nf974",
         "nf931", "nf936", "nf971",
         "nf932", "nf937", "nf972",
         "nf774", "nf961", "nf962",
         "nf930", "nf935"))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, Cell_or_EV=Cell_or_EV)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
     png("pca2.png", 1200, 800)
     #plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     dds$replicates <- relevel(dds$replicates, "WaGa_wt_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("WaGa_wt_EV_vs_WaGa_wt_cells")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     WaGa_wt_EV_vs_WaGa_wt_cells-all.txt \
     WaGa_wt_EV_vs_WaGa_wt_cells-up.txt \
     WaGa_wt_EV_vs_WaGa_wt_cells-down.txt \
     -d$',' -o WaGa_wt_EV_vs_WaGa_wt_cells.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("WaGa_wt_EV_vs_WaGa_wt_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
     top_g <- c("hsa-let-7b-5p","hsa-let-7g-5p","hsa-let-7i-5p","hsa-miR-103a-3p","hsa-miR-107","hsa-miR-1224-5p","hsa-miR-122-5p","hsa-miR-1226-5p","hsa-miR-1246","hsa-miR-127-3p","hsa-miR-1290","hsa-miR-130a-3p","hsa-miR-139-3p","hsa-miR-141-3p","hsa-miR-143-3p","hsa-miR-148b-3p","hsa-miR-155-5p","hsa-miR-15a-5p","hsa-miR-17-5p","hsa-miR-184","hsa-miR-18a-3p","hsa-miR-18a-5p","hsa-miR-190a-5p","hsa-miR-191-5p","hsa-miR-193b-5p","hsa-miR-197-5p","hsa-miR-200a-3p","hsa-miR-200b-5p","hsa-miR-206","hsa-miR-20a-5p","hsa-miR-210-3p","hsa-miR-2110","hsa-miR-21-5p","hsa-miR-218-5p","hsa-miR-219a-1-3p","hsa-miR-221-3p","hsa-miR-23b-3p","hsa-miR-27a-3p","hsa-miR-27b-3p","hsa-miR-27b-5p","hsa-miR-28-3p","hsa-miR-30a-5p","hsa-miR-30c-5p","hsa-miR-30e-5p","hsa-miR-3127-5p","hsa-miR-3131","hsa-miR-3180|hsa-miR-3180-3p","hsa-miR-320a","hsa-miR-320b","hsa-miR-320c","hsa-miR-320d","hsa-miR-330-3p","hsa-miR-335-3p","hsa-miR-33b-5p","hsa-miR-340-5p","hsa-miR-342-5p","hsa-miR-3605-5p","hsa-miR-361-3p","hsa-miR-365a-5p","hsa-miR-374b-5p","hsa-miR-378i","hsa-miR-379-5p","hsa-miR-3940-5p","hsa-miR-409-3p","hsa-miR-411-5p","hsa-miR-423-3p","hsa-miR-423-5p","hsa-miR-4286","hsa-miR-429","hsa-miR-432-5p","hsa-miR-4326","hsa-miR-451a","hsa-miR-4520-3p","hsa-miR-454-3p","hsa-miR-4646-5p","hsa-miR-4667-5p","hsa-miR-4748","hsa-miR-483-5p","hsa-miR-486-5p","hsa-miR-5010-5p","hsa-miR-504-3p","hsa-miR-5187-5p","hsa-miR-590-3p","hsa-miR-6128","hsa-miR-625-5p","hsa-miR-6726-5p","hsa-miR-6730-5p","hsa-miR-676-3p","hsa-miR-6767-5p","hsa-miR-6777-5p","hsa-miR-6780a-5p","hsa-miR-6794-5p","hsa-miR-6817-3p","hsa-miR-708-5p","hsa-miR-7-5p","hsa-miR-766-5p","hsa-miR-7854-3p","hsa-miR-873-3p","hsa-miR-885-3p","hsa-miR-92b-5p","hsa-miR-93-5p","hsa-miR-937-3p","hsa-miR-9-5p","hsa-miR-98-5p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "WaGa_wt_EV_vs_WaGa_wt_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("WaGa_wt_EV_vs_WaGa_wt_cells.png",width=1200, height=1400)
     #svg("WaGa_wt_EV_vs_WaGa_wt_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ----------------------------------------
     # ----------- manhattan_plot -------------
    
     Rscript manhattan_plot_Carmen_custom_labels.R  #exceRpt_miRNA_ReadCounts.txt
  7. Downstream analyis using R for miRNAs (17 MKL-1 samples)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     #MKL-1_sT_DMSO_EV ("X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO")
     #MKL-1_sT_Dox_EV ("X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox")
     #MKL-1_scr_DMSO_EV ("X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO")
     #MKL-1_scr_Dox_EV ()"X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox")
     #MKL-1_wt_cells ("nf780","nf796","nf797")
     #MKL-1_wt_EV ("X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs")
    
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_MKL-1
     mamba activate r_env
     R
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     d.raw<- read.delim2("exceRpt_miRNA_ReadCounts.txt",sep="\t", header=TRUE, row.names=1)
    
     # Desired column order
     desired_order <- c(
         "X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO", "X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox", "X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO", "X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox",
         "nf780","nf796","nf797", "X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs"
     )
    
     # Reorder columns
     d.raw <- d.raw[, desired_order]
     setdiff(desired_order, colnames(d.raw))  # Shows missing or misnamed columns
     #sapply(d.raw, is.numeric)
     d.raw[] <- lapply(d.raw, as.numeric)
     #d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
     write.csv(d.raw, file ="d_raw.csv")
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
     Cell_or_EV = as.factor(c("EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "EV","EV","EV",  "Cell","Cell","Cell",  "EV","EV"))
     replicates = as.factor(c("MKL-1_sT_DMSO_EV","MKL-1_sT_DMSO_EV","MKL-1_sT_DMSO_EV",     "MKL-1_sT_Dox_EV","MKL-1_sT_Dox_EV","MKL-1_sT_Dox_EV",  "MKL-1_scr_DMSO_EV","MKL-1_scr_DMSO_EV","MKL-1_scr_DMSO_EV",  "MKL-1_scr_Dox_EV","MKL-1_scr_Dox_EV","MKL-1_scr_Dox_EV",    "MKL-1_wt_cells", "MKL-1_wt_cells","MKL-1_wt_cells",  "MKL-1_wt_EV","MKL-1_wt_EV"))
     ids = as.factor(c("X2608_MKL1_sT_DMSO","X2701_MKL1_sT_DMSO","X2802_MKL1_sT_DMSO", "X2608_MKL1_sT_Dox","X2701_MKL1_sT_Dox","X2802_MKL1_sT_Dox", "X2608_MKL1_scr_DMSO","X2701_MKL1_scr_DMSO","X2802_MKL1_scr_DMSO", "X2608_MKL1_scr_Dox","X2701_MKL1_scr_Dox","X2802_MKL1_scr_Dox",
         "nf780","nf796","nf797", "X2404_MKL1_wt_EVs","X2608_MKL1_wt_EVs"))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, Cell_or_EV=Cell_or_EV)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
     png("pca2.png", 1200, 800)
     #plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     dds$replicates <- relevel(dds$replicates, "MKL-1_wt_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("MKL.1_wt_EV_vs_MKL.1_wt_cells")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-all.txt \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-up.txt \
     MKL.1_wt_EV_vs_MKL.1_wt_cells-down.txt \
     -d$',' -o MKL.1_wt_EV_vs_MKL.1_wt_cells.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("MKL.1_wt_EV_vs_MKL.1_wt_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
    
     top_g <- c("hsa-miR-203a-3p","hsa-miR-6850-5p","hsa-miR-4511","hsa-miR-5187-5p","hsa-miR-133b","hsa-miR-1246","hsa-miR-625-3p","hsa-miR-6741-3p","hsa-miR-192-5p","hsa-miR-10b-5p","hsa-miR-885-5p","hsa-miR-30e-3p","hsa-miR-101-3p","hsa-miR-1307-5p","hsa-miR-95-3p","hsa-miR-889-3p","hsa-miR-206","hsa-miR-301a-3p","hsa-miR-1-3p","hsa-let-7c-5p","hsa-miR-196a-5p","hsa-let-7f-5p","hsa-let-7e-5p","hsa-miR-30c-5p","hsa-miR-30a-3p","hsa-miR-146b-5p","hsa-miR-25-3p","hsa-miR-182-5p","hsa-miR-98-5p","hsa-let-7a-5p","hsa-miR-149-5p","hsa-miR-148a-3p","hsa-miR-873-3p","hsa-miR-19b-3p","hsa-miR-320c","hsa-miR-375","hsa-miR-30a-5p","hsa-miR-877-5p","hsa-miR-34a-5p","hsa-miR-324-5p","hsa-miR-652-3p","hsa-miR-342-5p","hsa-miR-7706","hsa-miR-361-3p","hsa-miR-361-5p","hsa-miR-1180-3p","hsa-miR-217","hsa-miR-1307-3p","hsa-miR-1908-5p","hsa-miR-15b-5p","hsa-miR-92b-5p","hsa-miR-484","hsa-miR-197-3p","hsa-miR-200c-3p","hsa-miR-671-5p","hsa-miR-339-5p","hsa-miR-1301-3p","hsa-miR-769-5p","hsa-miR-328-3p","hsa-miR-93-5p","hsa-miR-103a-3p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "MKL.1_wt_EV_vs_MKL.1_wt_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("MKL.1_wt_EV_vs_MKL.1_wt_cells.png",width=1200, height=1400)
     #svg("MKL.1_wt_EV_vs_MKL.1_wt_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ----------------------------------------
     # ----------- manhattan_plot -------------
    
     Rscript manhattan_plot_Carmen_custom_labels.R  #exceRpt_miRNA_ReadCounts.txt

Until now, done and sent!

  • Raw count data (d_raw_MKL-1.xlsx): Contains the raw, unnormalized read counts for all miRNAs.
  • Mapping heatmap (mapping_heatmap3_MKL-1.pdf)
  • Volcano plot (MKL.1_wt_EV_vs_MKL.1_wt_cells.png and .svg)
  • PCA plot (pca_MKL-1.png)
  • Manhattan plot and data (manhattan_plot_MKL1_vs_EV.png, .svg, and manhattan_plot_MKL1_data.xlsx)
  1. Draw distribution_heatmap.png for MKL-1 samples sent afterwards

     # -- R-code --
    
         # Load required library
         library(dplyr)
         library(openxlsx)
    
         # The numbers are extracted manually from summaries_MKL-1/mapping_heatmap3.pdf with the samples ordered by
         #    sampleID   sampleGroup sampleGroup2
         #    nf780  MKL-1 wt cells  "parental_cells_1"
         #    nf796  MKL-1 wt cells  "parental_cells_2"
         #    nf797  MKL-1 wt cells  "parental_cells_3"
         #    2608_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_1"
         #    2701_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_1"
         #    2701_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_1"
         #    2608_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_2"
         #    2701_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_1"
         #    2404_MKL1_wt_EVs   MKL-1 wt EV "untreated_1"
         #    2608_MKL1_wt_EVs   MKL-1 wt EV "untreated_2"
         #    2701_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_2"
         #    2608_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_2"
         #    2608_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_2"
         #    2802_MKL1_scr_DMSO MKL-1 scr DMSO EV   "scr_DMSO_3"
         #    2802_MKL1_sT_DMSO  MKL-1 sT DMSO EV    "sT_DMSO_3"
         #    2802_MKL1_scr_Dox  MKL-1 scr Dox EV    "scr_Dox_3"
         #    2802_MKL1_sT_Dox   MKL-1 sT Dox EV "sT_Dox_3"
    
         # Original data matrix (Note that the following is the complete table including tRNA_sense and tRNA_antisense ..., the code summing the sense and antisense numbers and resulting in total numbers)
         data_orig <- matrix(c(100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0,
             97.9, 94.4, 94.0, 43.1, 42.5, 47.1, 44.7, 44.5, 59.5, 56.6, 54.5, 54.9, 55.1, 71.0, 65.3, 67.0, 66.5,
             1.9, 1.6, 1.0, 27.6, 29.0, 34.3, 30.5, 30.1, 43.9, 42.9, 39.5, 40.0, 40.9, 54.4, 48.8, 52.1, 52.5,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.1, 0.1, 0.0, 0.1, 0.1, 0.1, 0.0, 0.0, 0.1, 0.1, 0.1, 0.0, 0.0, 0.0, 0.1, 0.1, 0.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.2, 12.0, 10.7, 1.9, 1.8, 1.7, 1.9, 2.0, 3.2, 2.7, 1.9, 2.6, 2.6, 2.3, 2.3, 1.8, 2.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.1, 0.0, 0.2, 0.3, 0.3, 0.4, 0.3, 0.7, 0.4, 0.5, 0.7, 0.3, 0.5, 0.5, 0.5, 0.4,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             88.5, 71.9, 67.5, 6.6, 5.9, 6.0, 6.6, 6.5, 7.7, 6.4, 7.4, 6.6, 6.5, 10.7, 10.0, 9.0, 8.3,
             0.1, 0.2, 0.4, 0.2, 0.2, 0.3, 0.3, 0.3, 0.4, 0.3, 0.2, 0.3, 0.2, 0.2, 0.2, 0.2, 0.2,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             2.1, 5.6, 6.0, 56.9, 57.5, 52.9, 55.3, 55.5, 40.5, 43.4, 45.5, 45.1, 44.9, 29.0, 34.7, 33.0, 33.5,
             0.0, 0.0, 0.0, 1.5, 1.4, 1.1, 1.0, 1.3, 0.7, 1.4, 1.1, 1.1, 1.1, 0.4, 0.5, 0.7, 0.5,
             0.0, 0.2, 0.3, 1.4, 1.4, 1.1, 1.3, 1.5, 0.9, 1.2, 1.1, 1.2, 1.0, 0.5, 0.6, 0.9, 0.8,
             0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
             0.0, 0.0, 0.0, 1.1, 1.6, 0.9, 1.3, 1.0, 0.8, 0.8, 0.8, 0.8, 0.7, 0.9, 0.6, 0.7, 0.6,
             0.1, 0.1, 0.3, 21.3, 17.7, 17.0, 15.4, 18.4, 12.2, 13.3, 14.8, 14.5, 14.1, 6.5, 9.1, 8.9, 8.5), nrow = 20, byrow = TRUE)
    
         # Original vectors
         samples_orig <- c("parental_cells_1", "parental_cells_2", "parental_cells_3",
            "sT_Dox_1", "scr_DMSO_1", "sT_DMSO_1",
            "sT_DMSO_2", "scr_Dox_1",
            "untreated_1", "untreated_2",
            "sT_Dox_2", "scr_DMSO_2", "scr_Dox_2",
            "scr_DMSO_3", "sT_DMSO_3", "scr_Dox_3",
            "sT_Dox_3")
    
         categories_orig <- c("reads_used_for_alignment", "genome", "miRNA_sense", "miRNA_antisense",
                             "miRNAprecursor_sense", "miRNAprecursor_antisense", "tRNA_sense", "tRNA_antisense",
                             "piRNA_sense", "piRNA_antisense", "gencode_sense", "gencode_antisense",
                             "circularRNA_sense", "circularRNA_antisense", "not_mapped_to_genome_or_libs",
                             "repetitiveElements", "endogenous_gapped", "exogenous_miRNA", "exogenous_rRNA",
                             "exogenous_genomes")
    
         # Provided samples and categories (desired order and format)
         samples <- c("parental_cells_1","parental_cells_2","parental_cells_3",
                     "untreated_1","untreated_2",
                     "scr_Dox_1","scr_Dox_2","scr_Dox_3",
                     "sT_DMSO_1","sT_DMSO_2","sT_DMSO_3",
                     "scr_DMSO_1","scr_DMSO_2","scr_DMSO_3",
                     "sT_Dox_1","sT_Dox_2","sT_Dox_3")
    
         categories <- c("reads_used_for_alignment", "genome", "miRNA", "miRNAprecursor", "tRNA", "piRNA",
                         "gencode", "circularRNA", "not_mapped_to_genome_or_libs", "repetitiveElements",
                         "endogenous_gapped", "exogenous_miRNA", "exogenous_rRNA", "exogenous_genomes")
    
         rownames(data_orig) <- categories_orig
         colnames(data_orig) <- samples_orig
    
         # Collapse sense/antisense
         merge_rows <- function(prefix) {
             row1 <- paste0(prefix, "_sense")
             row2 <- paste0(prefix, "_antisense")
             if (row1 %in% rownames(data_orig) && row2 %in% rownames(data_orig)) {
                 return(data_orig[row1, ] + data_orig[row2, ])
             } else if (row1 %in% rownames(data_orig)) {
                 return(data_orig[row1, ])
             } else {
                 return(rep(0, ncol(data_orig)))
             }
         }
    
         # Construct merged data
         data_merged <- rbind(
             reads_used_for_alignment = data_orig["reads_used_for_alignment", ],
             genome = data_orig["genome", ],
             miRNA = merge_rows("miRNA"),
             miRNAprecursor = merge_rows("miRNAprecursor"),
             tRNA = merge_rows("tRNA"),
             piRNA = merge_rows("piRNA"),
             gencode = merge_rows("gencode"),
             circularRNA = merge_rows("circularRNA"),
             not_mapped_to_genome_or_libs = data_orig["not_mapped_to_genome_or_libs", ],
             repetitiveElements = data_orig["repetitiveElements", ],
             endogenous_gapped = data_orig["endogenous_gapped", ],
             exogenous_miRNA = data_orig["exogenous_miRNA", ],
             exogenous_rRNA = data_orig["exogenous_rRNA", ],
             exogenous_genomes = data_orig["exogenous_genomes", ]
         )
    
         # Reorder columns to match desired sample order
         data_final <- data_merged[, samples[samples %in% colnames(data_merged)]]
    
         #genome --> human_genome, not_mapped_to_genome_or_libs --> not_mapped_to_human_genome
         rownames(data_final)[rownames(data_final) == "genome"] <- "human_genome"
         rownames(data_final)[rownames(data_final) == "not_mapped_to_genome_or_libs"] <- "not_mapped_to_human_genome"
    
         # Save to Excel
         write.xlsx(data_final, file = "distribution_heatmap.xlsx", rowNames = TRUE)
    
     # -- Python-code --
    
         python plot_distribution_heatmap.py distribution_heatmap.xlsx distribution_heatmap.png
    
             import pandas as pd
             import numpy as np
             import seaborn as sns
             import matplotlib.pyplot as plt
    
             ## Load data from Excel file
             file_path = "distribution_heatmap.xlsx"
    
             # Read Excel file, assuming first column is index (row labels)
             df = pd.read_excel(file_path, index_col=0)
    
             # The data is already in percentage format, convert to decimals if needed
             # If you want fractions (0-1 range), divide by 100
             data = df.values / 100.0
    
             # Get categories (row names) and samples (column names)
             categories = df.index.tolist()
             samples = df.columns.tolist()
    
             # Create DataFrame with proper structure
             df_plot = pd.DataFrame(data, index=categories, columns=samples)
    
             # Plot heatmap
             plt.figure(figsize=(14, 6))
             sns.heatmap(df_plot, annot=True, cmap="coolwarm", fmt=".3f", linewidths=0.5, cbar_kws={'label': 'Fraction Aligned Reads'})
    
             # Improve layout
             plt.title("Heatmap of Read Alignments by Category and Sample", fontsize=14)
             plt.xlabel("Sample", fontsize=12)
             plt.ylabel("Read Category", fontsize=12)
             plt.xticks(rotation=25, ha="right", fontsize=10)
             plt.yticks(rotation=0, fontsize=10)
             plt.tight_layout()
    
             # Save as PNG
             plt.savefig("distribution_heatmap.png", dpi=300, bbox_inches="tight")
    
             # Save as SVG (Vector) - Recommended for publications/editing
             plt.savefig("distribution_heatmap.svg", bbox_inches="tight")
    
             # Show plot
             plt.show()
  2. Draw differentially_expressed_miRNAs_heatmap.png sent afterwards (Namely downstream analyis using R for miRNAs)

     #Input file
     #exceRpt_miRNA_ReadCounts.txt
     #exceRpt_piRNA_ReadCounts.txt
    
     #cd ~/DATA/Data_Ute_smallRNA_7/summaries_exo7
     cd ~/DATA/Data_Ute_smallRNA_via_exceRpt_workspace/summaries_MKL-1
     mamba activate r_env
     R
     #> .libPaths()
     #[1] "/home/jhuang/mambaforge/envs/r_env/lib/R/library"
    
     #BiocManager::install("AnnotationDbi")
     #BiocManager::install("clusterProfiler")
     #BiocManager::install(c("ReactomePA","org.Hs.eg.db"))
     #BiocManager::install("limma")
     #BiocManager::install("sva")
     #install.packages("writexl")
     #install.packages("openxlsx")
     library("AnnotationDbi")
     library("clusterProfiler")
     library("ReactomePA")
     library("org.Hs.eg.db")
     library(DESeq2)
     library(gplots)
     library(limma)
     library(sva)
     #library(writexl)  #d.raw_with_rownames <- cbind(RowNames = rownames(d.raw), d.raw); write_xlsx(d.raw, path = "d_raw.xlsx");
     library(openxlsx)
    
     # 1. Load data
     d.raw <- read.delim2("exceRpt_miRNA_ReadCounts.txt", sep="\t", header=TRUE, row.names=1)
    
     # 2. Define the mapping from Original Column Names to Standardized Names
     # Ensure these keys EXACTLY match what is in colnames(d.raw)
     sample_map <- c(
     "nf780"               = "parental_cells_1",
     "nf796"               = "parental_cells_2",
     "nf797"               = "parental_cells_3",
    
     "X2404_MKL1_wt_EVs"   = "untreated_1",
     "X2608_MKL1_wt_EVs"   = "untreated_2",
    
     "X2701_MKL1_scr_DMSO" = "scr_DMSO_1",
     "X2608_MKL1_scr_DMSO" = "scr_DMSO_2",
     "X2802_MKL1_scr_DMSO" = "scr_DMSO_3",
    
     "X2701_MKL1_scr_Dox"  = "scr_Dox_1",
     "X2608_MKL1_scr_Dox"  = "scr_Dox_2",
     "X2802_MKL1_scr_Dox"  = "scr_Dox_3",
    
     "X2701_MKL1_sT_DMSO"  = "sT_DMSO_1",
     "X2608_MKL1_sT_DMSO"  = "sT_DMSO_2",
     "X2802_MKL1_sT_DMSO"  = "sT_DMSO_3",
    
     "X2701_MKL1_sT_Dox"   = "sT_Dox_1",
     "X2608_MKL1_sT_Dox"   = "sT_Dox_2",
     "X2802_MKL1_sT_Dox"   = "sT_Dox_3"
     )
    
     # 3. Safe Renaming Strategy
     # Create a vector of new names for ALL current columns
     new_col_names <- colnames(d.raw)
    
     # Identify which current columns are in our map
     matched_indices <- match(colnames(d.raw), names(sample_map))
    
     # Replace names where a match was found
     # matched_indices will be NA if no match is found
     found_mask <- !is.na(matched_indices)
     new_col_names[found_mask] <- sample_map[colnames(d.raw)[found_mask]]
    
     # Assign the new names back to the dataframe
     colnames(d.raw) <- new_col_names
    
     # Optional: Check if any expected samples were missing entirely
     missing_samples <- setdiff(names(sample_map), colnames(d.raw)) # Check against OLD names? No, check against original input
     # Better check:
     original_cols <- colnames(read.delim2("exceRpt_miRNA_ReadCounts.txt", sep="\t", header=TRUE, nrows=1))
     missing_in_data <- setdiff(names(sample_map), original_cols)
     if(length(missing_in_data) > 0) {
     warning(paste("WARNING: The following samples from your map were NOT found in the file:", paste(missing_in_data, collapse=", ")))
     }
    
     # 4. Define the desired final order
     desired_order <- c(
         "parental_cells_1", "parental_cells_2", "parental_cells_3",
         "untreated_1", "untreated_2",
         "scr_Dox_1", "scr_Dox_2", "scr_Dox_3",
         "sT_DMSO_1", "sT_DMSO_2", "sT_DMSO_3",
         "scr_DMSO_1", "scr_DMSO_2", "scr_DMSO_3",
         "sT_Dox_1", "sT_Dox_2", "sT_Dox_3"
     )
    
     # 5. Check for missing columns in the final desired set
     missing_final <- setdiff(desired_order, colnames(d.raw))
     if (length(missing_final) > 0) {
     stop(paste("ERROR: Missing required columns after renaming:", paste(missing_final, collapse=", ")))
     }
    
     # 6. Subset and Reorder
     d.raw <- d.raw[, desired_order]
    
     # 7. Ensure numeric type and round
     d.raw[] <- lapply(d.raw, function(x) as.numeric(as.character(x)))
     d.raw <- round(d.raw)
    
     # 8. Save outputs
     write.csv(d.raw, file = "d_raw.csv", row.names = TRUE)
     write.xlsx(d.raw, file = "d_raw.xlsx", rowNames = TRUE)
    
     print("Processing complete. Files saved.")
    
     #d.raw <- read.delim2("d_raw.csv",sep=",", header=TRUE, row.names=1)
    
     parental_or_EV = as.factor(c("parental","parental","parental", "EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV","EV"))
     #batch = as.factor(c("Aug22","March25","March25", "Sep23","Sep23", "Sep23","Sep23","March25", "Sep23","Sep23","March25", "Sep23","Sep23","March25", "Sep23","Sep23","March25"))
     replicates = as.factor(c("parental_cells", "parental_cells", "parental_cells",
         "untreated", "untreated",
         "scr_Dox", "scr_Dox", "scr_Dox",
         "sT_DMSO", "sT_DMSO", "sT_DMSO",
         "scr_DMSO", "scr_DMSO", "scr_DMSO",
         "sT_Dox", "sT_Dox", "sT_Dox"))
     ids = as.factor(c(
         "parental_cells_1", "parental_cells_2", "parental_cells_3",
         "untreated_1", "untreated_2",
         "scr_Dox_1", "scr_Dox_2", "scr_Dox_3",
         "sT_DMSO_1", "sT_DMSO_2", "sT_DMSO_3",
         "scr_DMSO_1", "scr_DMSO_2", "scr_DMSO_3",
         "sT_Dox_1", "sT_Dox_2", "sT_Dox_3"
     ))
     cData = data.frame(row.names=colnames(d.raw), replicates=replicates, ids=ids, parental_or_EV=parental_or_EV)
     #dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates+batch)
     dds<-DESeqDataSetFromMatrix(countData=d.raw, colData=cData, design=~replicates)
    
     # Filter low-count miRNAs
     dds <- dds[ rowSums(counts(dds)) > 10, ]  #1322-->903
     rld <- rlogTransformation(dds)
    
     # -- before pca --
     png("pca.png", 1200, 800)
     plotPCA(rld, intgroup=c("replicates"))
     #plotPCA(rld, intgroup = c("replicates", "batch"))
     #plotPCA(rld, intgroup = c("replicates", "ids"))
     #plotPCA(rld, "batch")
     dev.off()
    
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
    
     #### STEP2: DEGs ####
     #- Heatmap untreated/wt vs parental; 1x for WaGa cell line
     #- Volcano plot untreated/wt vs parental; 1x for WaGa cell line
     #- Manhattan plot miRNAs; 1x for WaGa cell line
     #- Distribution of different small RNA species untreated/wt and parental; 1x for WaGa cell line
     #- Motif analysis: identify RNA-binding proteins that may regulate small RNA loading; 1x for WaGa cell line
    
     #convert bam to bigwig using deepTools by feeding inverse of DESeq’s size Factor
     sizeFactors(dds)
     #NULL
     dds <- estimateSizeFactors(dds)
     sizeFactors(dds)
     normalized_counts <- counts(dds, normalized=TRUE)
     write.table(normalized_counts, file="normalized_counts.txt", sep="\t", quote=F, col.names=NA)
     write.xlsx(normalized_counts, file = "normalized_counts.xlsx", rowNames = TRUE)
    
     #---- untreated, scr_Dox, sT_DMSO, scr_DMSO, sT_Dox to parental_cells ----
    
     dds$replicates <- relevel(dds$replicates, "parental_cells")
     dds = DESeq(dds, betaPrior=FALSE)  #default betaPrior is FALSE
     resultsNames(dds)
     clist <- c("untreated_vs_parental_cells")
    
     dds$replicates <- relevel(dds$replicates, "untreated")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_DMSO_vs_untreated", "scr_Dox_vs_untreated", "scr_DMSO_vs_untreated", "sT_Dox_vs_untreated")
    
     dds$replicates <- relevel(dds$replicates, "sT_DMSO")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_sT_DMSO")
    
     dds$replicates <- relevel(dds$replicates, "scr_Dox")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_scr_Dox")
    
     dds$replicates <- relevel(dds$replicates, "scr_DMSO")
     dds = DESeq(dds, betaPrior=FALSE)
     resultsNames(dds)
     clist <- c("sT_Dox_vs_scr_DMSO")
    
     #NOTE that the results sent to Ute is |padj|<=0.1.
     for (i in clist) {
         contrast = paste("replicates", i, sep="_")
         res = results(dds, name=contrast)
         res <- res[!is.na(res$log2FoldChange),]
         #https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#why-are-some-p-values-set-to-na
         res$padj <- ifelse(is.na(res$padj), 1, res$padj)
         res_df <- as.data.frame(res)
         write.csv(as.data.frame(res_df[order(res_df$pvalue),]), file = paste(i, "all.txt", sep="-"))
         up <- subset(res_df, padj<=0.05 & log2FoldChange>=2)
         down <- subset(res_df, padj<=0.05 & log2FoldChange<=-2)
         write.csv(as.data.frame(up[order(up$log2FoldChange,decreasing=TRUE),]), file = paste(i, "up.txt", sep="-"))
         write.csv(as.data.frame(down[order(abs(down$log2FoldChange),decreasing=TRUE),]), file = paste(i, "down.txt", sep="-"))
     }
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     untreated_vs_parental_cells-all.txt \
     untreated_vs_parental_cells-up.txt \
     untreated_vs_parental_cells-down.txt \
     -d$',' -o untreated_vs_parental_cells.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_DMSO_vs_untreated-all.txt \
     sT_DMSO_vs_untreated-up.txt \
     sT_DMSO_vs_untreated-down.txt \
     -d$',' -o sT_DMSO_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     scr_Dox_vs_untreated-all.txt \
     scr_Dox_vs_untreated-up.txt \
     scr_Dox_vs_untreated-down.txt \
     -d$',' -o scr_Dox_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     scr_DMSO_vs_untreated-all.txt \
     scr_DMSO_vs_untreated-up.txt \
     scr_DMSO_vs_untreated-down.txt \
     -d$',' -o scr_DMSO_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_untreated-all.txt \
     sT_Dox_vs_untreated-up.txt \
     sT_Dox_vs_untreated-down.txt \
     -d$',' -o sT_Dox_vs_untreated.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_sT_DMSO-all.txt \
     sT_Dox_vs_sT_DMSO-up.txt \
     sT_Dox_vs_sT_DMSO-down.txt \
     -d$',' -o sT_Dox_vs_sT_DMSO.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_scr_Dox-all.txt \
     sT_Dox_vs_scr_Dox-up.txt \
     sT_Dox_vs_scr_Dox-down.txt \
     -d$',' -o sT_Dox_vs_scr_Dox.xls;
    
     ~/Tools/csv2xls-0.4/csv_to_xls.py \
     sT_Dox_vs_scr_DMSO-all.txt \
     sT_Dox_vs_scr_DMSO-up.txt \
     sT_Dox_vs_scr_DMSO-down.txt \
     -d$',' -o sT_Dox_vs_scr_DMSO.xls;
    
     # ------------------- volcano_plot -------------------
     library(ggplot2)
     library(ggrepel)
    
     geness_res <- read.csv(file = paste("untreated_vs_parental_cells", "all.txt", sep="-"), row.names=1)
    
     external_gene_name <- rownames(geness_res)
     geness_res <- cbind(geness_res, external_gene_name)
     #top_g are from ids
     top_g <- c("hsa-miR-10b-5p","hsa-miR-1246","hsa-let-7a-5p","hsa-miR-182-5p","hsa-let-7f-5p","hsa-miR-1-3p","hsa-miR-375","hsa-miR-200c-3p","hsa-miR-30a-5p","hsa-miR-98-5p","hsa-miR-25-3p","hsa-miR-192-5p","hsa-miR-30c-5p","hsa-miR-1180-3p","hsa-let-7e-5p","hsa-miR-203a-3p","hsa-miR-625-3p","hsa-miR-146b-5p","hsa-miR-95-3p","hsa-miR-877-5p","hsa-miR-1307-3p","hsa-let-7c-5p","hsa-miR-361-5p","hsa-miR-30e-3p","hsa-miR-885-5p","hsa-miR-34a-5p","hsa-miR-93-5p","hsa-miR-5187-5p","hsa-miR-101-3p","hsa-miR-6850-5p","hsa-miR-103a-3p","hsa-miR-4511","hsa-miR-196a-5p","hsa-miR-1908-5p","hsa-miR-484","hsa-miR-92b-5p","hsa-miR-9-5p","hsa-miR-15b-5p","hsa-miR-30a-3p","hsa-miR-133b","hsa-miR-148a-3p","hsa-miR-1307-5p","hsa-miR-19b-3p","hsa-miR-6741-3p","hsa-miR-486-5p","hsa-miR-181a-5p","hsa-miR-342-5p","hsa-miR-873-3p","hsa-miR-324-5p","hsa-miR-769-5p","hsa-miR-328-3p","hsa-miR-301a-3p","hsa-miR-1224-5p","hsa-miR-671-5p","hsa-miR-652-3p","hsa-miR-1301-3p","hsa-miR-206","hsa-miR-889-3p","hsa-miR-197-3p","hsa-miR-217","hsa-miR-339-5p","hsa-miR-320c","hsa-miR-423-3p","hsa-miR-7706","hsa-miR-425-5p","hsa-miR-19a-3p","hsa-miR-149-5p","hsa-miR-361-3p","hsa-miR-4476","hsa-miR-186-5p","hsa-miR-342-3p","hsa-miR-708-3p","hsa-let-7b-5p","hsa-miR-17-5p","hsa-miR-532-3p","hsa-miR-1226-5p","hsa-miR-4677-3p","hsa-miR-3187-3p","hsa-miR-320a","hsa-miR-183-5p","hsa-miR-93-3p","hsa-miR-128-3p","hsa-miR-92a-1-5p","hsa-miR-501-5p","hsa-miR-454-3p","hsa-miR-760","hsa-miR-193b-3p","hsa-miR-200a-3p","hsa-miR-1290","hsa-miR-107","hsa-miR-331-3p","hsa-miR-148b-3p","hsa-miR-505-3p","hsa-miR-26b-5p","hsa-miR-130b-3p","hsa-miR-23b-3p","hsa-let-7g-5p","hsa-miR-188-5p","hsa-miR-432-5p","hsa-miR-190b","hsa-miR-1296-5p","hsa-miR-615-3p","hsa-miR-132-3p","hsa-miR-195-5p","hsa-miR-362-5p","hsa-miR-324-3p","hsa-miR-500a-3p","hsa-miR-151b","hsa-miR-92a-3p","hsa-miR-769-3p","hsa-miR-191-5p","hsa-miR-486-3p","hsa-miR-940","hsa-miR-449c-5p","hsa-miR-500a-5p","hsa-miR-22-3p","hsa-miR-183-3p","hsa-miR-181d-5p","hsa-miR-3200-3p","hsa-miR-1306-3p","hsa-miR-30c-2-3p","hsa-let-7b-3p","hsa-miR-1254","hsa-miR-7974","hsa-miR-216b-5p","hsa-miR-200b-5p","hsa-miR-1306-5p","hsa-miR-181b-5p","hsa-miR-133a-3p","hsa-miR-425-3p","hsa-miR-3934-5p","hsa-miR-421","hsa-miR-200b-3p","hsa-miR-18a-5p","hsa-miR-3605-5p","hsa-miR-210-3p","hsa-miR-193b-5p","hsa-miR-30b-5p","hsa-miR-190a-5p","hsa-miR-30e-5p","hsa-miR-106b-5p","hsa-miR-423-5p","hsa-mir-378c","hsa-miR-15a-5p","hsa-miR-92b-3p","hsa-miR-15b-3p","hsa-miR-148a-5p","hsa-miR-130b-5p","hsa-miR-181c-5p","hsa-miR-378e","hsa-miR-744-5p","hsa-miR-320b","hsa-miR-20a-5p","hsa-miR-885-3p","hsa-miR-339-3p","hsa-let-7i-5p","hsa-miR-181a-2-3p","hsa-miR-378i","hsa-miR-27b-3p","hsa-let-7a-3","hsa-miR-16-2-3p","hsa-miR-3615","hsa-miR-4510","hsa-miR-4492","hsa-miR-212-3p","hsa-let-7c","hsa-miR-660-5p","hsa-miR-25-5p","hsa-miR-16-5p","hsa-miR-141-3p","hsa-miR-30d-5p","hsa-let-7a-1","hsa-miR-151a-3p","hsa-let-7a-2","hsa-miR-30b-3p","hsa-miR-532-5p","hsa-miR-378d","hsa-let-7d-3p","hsa-miR-378c","hsa-miR-27a-3p","hsa-miR-378a-3p","hsa-miR-21-5p","hsa-miR-320d","hsa-miR-106b-3p","hsa-miR-320e","hsa-miR-196b-5p","hsa-miR-30d-3p","hsa-miR-4516","hsa-let-7b","hsa-miR-708-5p","hsa-miR-151a-5p|hsa-miR-151b","hsa-miR-6134","hsa-miR-106a-5p","hsa-miR-335-3p","hsa-miR-1269b","hsa-let-7d-5p","hsa-miR-139-3p","hsa-miR-218-5p","hsa-miR-6128","hsa-miR-215-5p","hsa-miR-26a-5p","hsa-miR-20b-5p","hsa-miR-24-3p","hsa-miR-330-3p","hsa-miR-941","hsa-miR-10a-5p","hsa-miR-1270","hsa-miR-345-5p","hsa-miR-140-3p","hsa-miR-7-5p","hsa-miR-577","hsa-let-7a-3p","hsa-miR-1269a","hsa-miR-1468-5p","hsa-miR-146a-5p")
     subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0))
     geness_res$Color <- "NS or log2FC < 2.0"
     geness_res$Color[geness_res$pvalue < 0.05] <- "P < 0.05"
     geness_res$Color[geness_res$padj < 0.05] <- "P-adj < 0.05"
     geness_res$Color[abs(geness_res$log2FoldChange) < 2.0] <- "NS or log2FC < 2.0"
    
     write.csv(geness_res, "untreated_vs_parental_cells_with_Category.csv")
     geness_res$invert_P <- (-log10(geness_res$pvalue)) * sign(geness_res$log2FoldChange)
    
     geness_res <- geness_res[, -1*ncol(geness_res)]
     png("volcano_plot_untreated_vs_parental_cells.png",width=1200, height=1400)
     #svg("untreated_vs_parental_cells.svg",width=12, height=14)
     ggplot(geness_res,       aes(x = log2FoldChange, y = -log10(pvalue),           color = Color, label = external_gene_name)) +       geom_vline(xintercept = c(2.0, -2.0), lty = "dashed") +       geom_hline(yintercept = -log10(0.05), lty = "dashed") +       geom_point() +       labs(x = "log2(FC)", y = "Significance, -log10(P)", color = "Significance") +       scale_color_manual(values = c("P < 0.05"="orange","P-adj < 0.05"="red","NS or log2FC < 2.0"="darkgray"),guide = guide_legend(override.aes = list(size = 4))) + scale_y_continuous(expand = expansion(mult = c(0,0.05))) +       geom_text_repel(data = subset(geness_res, external_gene_name %in% top_g & pvalue < 0.05 & (abs(geness_res$log2FoldChange) >= 2.0)), size = 4, point.padding = 0.15, color = "black", min.segment.length = .1, box.padding = .2, lwd = 2) +       theme_bw(base_size = 16) +       theme(legend.position = "bottom")
     dev.off()
    
     # ------------------ differentially_expressed_miRNAs_heatmap -----------------
     # Batch Effect Removal Methods (Non-batch effect removal applied!)
     # prepare all_genes
     #rld <- rlogTransformation(dds)
     #mat <- assay(rld)
     #mm <- model.matrix(~replicates, colData(rld))
     #mat <- limma::removeBatchEffect(mat, batch=rld$batch, design=mm)
     #assay(rld) <- mat
     RNASeq.NoCellLine <- assay(rld)
    
     #Manully defining miRNA for visualization
     for i in untreated_vs_parental_cells sT_Dox_vs_untreated sT_DMSO_vs_untreated scr_Dox_vs_untreated scr_DMSO_vs_untreated sT_Dox_vs_sT_DMSO sT_Dox_vs_scr_Dox sT_Dox_vs_scr_DMSO; do
       echo "cut -d',' -f1-1 ${i}-up.txt > ${i}-up.id";
       echo "cut -d',' -f1-1 ${i}-down.txt > ${i}-down.id";
     done
     #cat *.id | sort -u > ids
     ##add Gene_Id in the first line, delete the ""
     GOI <- read.csv("ids")$Gene_Id
     datamat = RNASeq.NoCellLine[GOI, ]
    
     # clustering the genes and draw heatmap
     #datamat <- datamat[,-1]  #delete the sample "control MKL1"
     #datamat <- datamat[, 1:5]
    
     #parental_cells_1 parental_cells_2 parental_cells_3    untreated_1 untreated_2    scr_Dox_1 scr_Dox_2 scr_Dox_3     sT_DMSO_1 sT_DMSO_2 sT_DMSO_3    scr_DMSO_1 scr_DMSO_2 scr_DMSO_3    sT_Dox_1 sT_Dox_2 sT_Dox_3 -->
     #parental cells 1 parental cells 2 parental cells 3    untreated 1 untreated 2    scr control 1 scr control 2 scr control 3    DMSO control 1 DMSO control 2 DMSO control 3    scr DMSO control 1 scr DMSO control 2 scr DMSO control 3    sT knockdown 1 sT knockdown 2 sT knockdown 3
     colnames(datamat)[1] <- "parental cells 1"
     colnames(datamat)[2] <- "parental cells 2"
     colnames(datamat)[3] <- "parental cells 3"
     colnames(datamat)[4] <- "untreated 1"
     colnames(datamat)[5] <- "untreated 2"
     colnames(datamat)[6] <- "scr Dox 1"
     colnames(datamat)[7] <- "scr Dox 2"
     colnames(datamat)[8] <- "scr Dox 3"
     colnames(datamat)[9] <- "sT DMSO 1"
     colnames(datamat)[10] <- "sT DMSO 2"
     colnames(datamat)[11] <- "sT DMSO 3"
     colnames(datamat)[12] <- "scr DMSO 1"
     colnames(datamat)[13] <- "scr DMSO 2"
     colnames(datamat)[14] <- "scr DMSO 3"
     colnames(datamat)[15] <- "sT Dox 1"
     colnames(datamat)[16] <- "sT Dox 2"
     colnames(datamat)[17] <- "sT Dox 3"
    
     write.csv(datamat, file ="differentially_expressed_miRNAs_heatmap.txt")
     write.xlsx(datamat, file = "differentially_expressed_miRNAs_heatmap.xlsx", rowNames = TRUE)
     #"ward.D"’, ‘"ward.D2"’,‘"single"’, ‘"complete"’, ‘"average"’ (= UPGMA), ‘"mcquitty"’(= WPGMA), ‘"median"’ (= WPGMC) or ‘"centroid"’ (= UPGMC)
     hr <- hclust(as.dist(1-cor(t(datamat), method="pearson")), method="complete")
     hc <- hclust(as.dist(1-cor(datamat, method="spearman")), method="complete")
     mycl = cutree(hr, h=max(hr$height)/1.1)
     mycol = c("YELLOW", "BLUE", "ORANGE", "CYAN", "GREEN", "MAGENTA", "GREY", "LIGHTCYAN", "RED",     "PINK", "DARKORANGE", "MAROON",  "LIGHTGREEN", "DARKBLUE",  "DARKRED",   "LIGHTBLUE", "DARKCYAN",  "DARKGREEN", "DARKMAGENTA");
     mycol = mycol[as.vector(mycl)]
    
     rownames(datamat) <- sub("\\|.*", "", rownames(datamat))
    
     png("differentially_expressed_miRNAs_heatmap.png", width=1000, height=1400)
     heatmap.2(as.matrix(datamat),
         Rowv=as.dendrogram(hr),
         Colv=NA,
         dendrogram='row',
         labRow=row.names(datamat),
         scale='row',
         trace='none',
         col=bluered(75),
         RowSideColors=mycol,
         srtCol=30,
         lhei=c(1,8),
         cexRow=1.4,   # Increase row label font size
         cexCol=1.7,    # Increase column label font size
         margin=c(8, 12)
         )
     dev.off()
    
     svg("differentially_expressed_miRNAs_heatmap.svg", width=12, height=16)
     heatmap.2(as.matrix(datamat),
         Rowv=as.dendrogram(hr),
         Colv=NA,
         dendrogram='row',
         labRow=row.names(datamat),
         scale='row',
         trace='none',
         col=bluered(75),
         RowSideColors=mycol,
         srtCol=30,
         lhei=c(1,8),
         cexRow=1.4,   # Increase row label font size
         cexCol=1.7,    # Increase column label font size
         margin=c(8, 12)
         )
     dev.off()
    
     # mv differentially_expressed_miRNAs_heatmap.txt differentially_expressed_miRNAs_heatmap_MKL-1.txt
     # mv differentially_expressed_miRNAs_heatmap.xlsx differentially_expressed_miRNAs_heatmap_MKL-1.xlsx
     # mv differentially_expressed_miRNAs_heatmap.png differentially_expressed_miRNAs_heatmap_MKL-1.png
     # mv differentially_expressed_miRNAs_heatmap.svg differentially_expressed_miRNAs_heatmap_MKL-1.svg
     # mv distribution_heatmap.png distribution_heatmap_MKL-1.png
     # mv distribution_heatmap.svg distribution_heatmap_MKL-1.svg
     # mv volcano_plot_untreated_vs_parental_cells.png volcano_plot_untreated_vs_parental_cells_MKL-1.png

映射表 between new group names and old group names

3. 最终映射表

热图列号 旧名称 (Old Name) 实验条件推断 新名称 (New Name) 理由 (Chinese Explanation)
1 nf780 MKL-1 wt cells parental_cells_1 野生型细胞总RNA,作为亲本细胞对照1。
2 nf796 MKL-1 wt cells parental_cells_2 野生型细胞总RNA,作为亲本细胞对照2。
3 nf797 MKL-1 wt cells parental_cells_3 野生型细胞总RNA,作为亲本细胞对照3。
4 2608_MKL1_sT_Dox sT + Dox EV sT_knockdown_1 sT敲低+诱导(Dox),实验组1。
5 2701_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_1 Scramble对照+溶剂(DMSO),双阴性对照1。
6 2701_MKL1_sT_DMSO sT + DMSO EV DMSO_control_1 sT载体+溶剂(DMSO),未诱导的sT对照1。
7 2608_MKL1_sT_DMSO sT + DMSO EV DMSO_control_2 sT载体+溶剂(DMSO),未诱导的sT对照2。
8 2701_MKL1_scr_Dox Scr + Dox EV scr_control_1 Scramble对照+诱导(Dox),诱导对照组1。
9 2404_MKL1_wt_EVs WT EV untreated_1 野生型外泌体,未处理对照1。
10 2608_MKL1_wt_EVs WT EV untreated_2 野生型外泌体,未处理对照2。
11 2701_MKL1_sT_Dox sT + Dox EV sT_knockdown_2 sT敲低+诱导(Dox),实验组2。
12 2608_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_2 Scramble对照+溶剂(DMSO),双阴性对照2。
13 2608_MKL1_scr_Dox Scr + Dox EV scr_control_2 Scramble对照+诱导(Dox),诱导对照组2。
14 2802_MKL1_scr_DMSO Scr + DMSO EV scr_DMSO_control_3 Scramble对照+溶剂(DMSO),双阴性对照3。
15 2802_MKL1_sT_DMSO sT + DMSO EV DMSO_control_3 sT载体+溶剂(DMSO),未诱导的sT对照3。
16 2802_MKL1_scr_Dox Scr + Dox EV scr_control_3 Scramble对照+诱导(Dox),诱导对照组3。
17 2802_MKL1_sT_Dox sT + Dox EV sT_knockdown_3 sT敲低+诱导(Dox),实验组3。

(注:untreated_1/2parental_cells_1/2/3 的具体编号顺序(1,2,3)可以根据原始样本ID的数字大小或实验记录微调,但类别对应是确定的。上述编号是按它们在列表中出现的顺序分配的。)

4. 为什么这样映射?(Explanation in Chinese)

  1. 区分细胞与外泌体 (Cells vs EVs):

    • 旧名称中的 nf780/796/797 标记为 “MKL-1 wt cells”,这是细胞裂解液的 RNA-seq 数据,而非外泌体。在新名称中,parental_cells 是最合适的对应项,代表亲本细胞系的基线表达。
    • 旧名称中的 2404/2608 ... wt_EVs 标记为 “MKL-1 wt EV”,这是野生型的外泌体。在新名称中,untreated 通常指未经过任何转染或药物处理的天然状态,因此对应 WT EVs。
  2. 区分处理条件 (Treatment Conditions):

    • sT_knockdown: 对应旧名称中的 sT_Dox。因为 Dox (Doxycycline) 是诱导剂,用于启动 shRNA/siRNA 的表达从而实现敲低。这是主要的实验组。
    • scr_control: 对应旧名称中的 scr_Dox。Scramble (乱序序列) 是阴性对照,同样加 Dox 诱导,用于排除诱导剂本身和非特异性序列的影响。这是 sT_knockdown 的直接对照。
    • DMSO_control: 对应旧名称中的 sT_DMSO。这里 sT 载体存在,但加入的是 DMSO (溶剂) 而不是 Dox,因此基因敲低未被诱导(或仅有极低背景泄漏)。这用于评估在没有诱导的情况下,sT 载体本身对细胞/外泌体的影响。
    • scr_DMSO_control: 对应旧名称中的 scr_DMSO。既没有功能性敲低序列 (Scr),也没有诱导剂 (DMSO)。这是最基础的“双阴性”对照,代表转染了空载体或乱序载体且未诱导的状态。
  3. 重复样本 (Replicates):

    • 每个条件都有3个生物学重复(来自不同的批次或制备,如 2608, 2701, 2802),因此新名称中的 _1, _2, _3 分别对应这三个不同的来源。

R 代码实现映射

# 定义旧名称顺序 (对应热图列 1-17)
old_names <- c("nf780", "nf796", "nf797", 
               "2608_MKL1_sT_Dox", "2701_MKL1_scr_DMSO", "2701_MKL1_sT_DMSO", 
               "2608_MKL1_sT_DMSO", "2701_MKL1_scr_Dox", 
               "2404_MKL1_wt_EVs", "2608_MKL1_wt_EVs", 
               "2701_MKL1_sT_Dox", "2608_MKL1_scr_DMSO", "2608_MKL1_scr_Dox", 
               "2802_MKL1_scr_DMSO", "2802_MKL1_sT_DMSO", "2802_MKL1_scr_Dox", 
               "2802_MKL1_sT_Dox")

# 定义新名称顺序 (根据上述逻辑映射)
new_names <- c("parental_cells_1", "parental_cells_2", "parental_cells_3",
               "sT_knockdown_1", "scr_DMSO_control_1", "DMSO_control_1",
               "DMSO_control_2", "scr_control_1",
               "untreated_1", "untreated_2",
               "sT_knockdown_2", "scr_DMSO_control_2", "scr_control_2",
               "scr_DMSO_control_3", "DMSO_control_3", "scr_control_3",
               "sT_knockdown_3")

# 创建映射数据框
mapping_df <- data.frame(
  Old_Name = old_names,
  New_Name = new_names
)

print(mapping_df)

Yes, your calculated sums are correct.

Here is the step-by-step verification adding the two rows you provided:

Index Row 1 (gencode_sense) Row 2 (gencode_antisense) Your Sum Calculated Sum (gencode) Match?
1 88.5 0.1 88.6 88.6
2 71.9 0.2 72.1 72.1
3 67.5 0.4 67.9 67.9
4 6.6 0.2 6.8 6.8
5 5.9 0.2 6.1 6.1
6 6.0 0.3 6.3 6.3
7 6.6 0.3 6.9 6.9
8 6.5 0.3 6.8 6.8
9 7.7 0.4 8.1 8.1
10 6.4 0.3 6.7 6.7
11 7.4 0.2 7.6 7.6
12 6.6 0.3 6.9 6.9
13 6.5 0.2 6.7 6.7
14 10.7 0.2 10.9 10.9
15 10.0 0.2 10.2 10.2
16 9.0 0.2 9.2 9.2
17 8.3 0.2 8.5 8.5

Your calculation is perfectly accurate.

exFAT is compatible with modern Linux systems, but how?

Actually, exFAT is compatible with modern Linux systems, but there are some important details to understand:

Why You Might Think It’s Not Compatible

1. Older Linux Kernels (< 5.4)

  • Before Linux kernel 5.4 (released November 2019), exFAT support was not included in the mainline kernel
  • You needed to install third-party drivers like exfat-fuse or exfat-utils
  • Many older distributions didn’t have these packages by default

2. Missing Packages

Even on newer systems, you might need to install specific packages:

# For Debian/Ubuntu-based systems
sudo apt install exfat-fuse exfat-utils

# For newer systems (kernel 5.4+)
sudo apt install exfatprogs

# For RHEL/CentOS/Fedora
sudo dnf install exfatprogs
# or
sudo yum install exfat-utils fuse-exfat

3. Check Your Kernel Version

uname -r
  • If your kernel is 5.4 or newer, exFAT support is built-in
  • If older, you need the FUSE-based drivers

How to Mount exFAT on Linux

Modern Systems (Kernel 5.4+):

sudo mount -t exfat /dev/sdX1 /mnt/usb

Older Systems:

sudo mount -t exfat-fuse /dev/sdX1 /mnt/usb

Check if exFAT Support is Available

# Check if the module is loaded
lsmod | grep exfat

# Check available filesystem types
cat /proc/filesystems | grep exfat

# Try to list supported filesystems
mount -l | grep exfat

Alternative Solutions

If you’re still having issues:

  1. Reformat to a more compatible format:

    • ext4: Best for Linux-only use
    • FAT32: Universal compatibility (but 4GB file size limit)
    • NTFS: Good cross-platform support (read/write on most modern Linux)
  2. Install missing packages:

    sudo apt update
    sudo apt install exfat-fuse exfat-utils exfatprogs
  3. Update your kernel if you’re running an very old distribution

Quick Diagnostic

Run this to check your system:

# Check kernel version
uname -r

# Check if exfat tools are installed
which mount.exfat
which mount.exfat-fuse

# List installed exfat packages
dpkg -l | grep exfat    # Debian/Ubuntu
rpm -qa | grep exfat    # RHEL/CentOS

What Linux distribution and version are you using? I can provide more specific instructions based on your system.

Data_Denise_LT_DNA_Bindung + Data_Denise_LT_K331A_RNASeq

基于您提供的文件列表和已发表的论文背景,以下是 LT (Large Tumor Antigen) 相关未发表数据的完整表格整理。这些数据分为 ChIP-seq(LT蛋白结合位点)和 RNA-seq(LT及突变体转录组影响)。

1. LT 蛋白特异性 ChIP-Seq 数据集

状态: 未发表 (Unpublished) 目的: 绘制 LT 蛋白在全基因组上的直接结合位点。 抗体: Cm2b4 (针对 LT/LTtr 蛋白) 或 IgG/Input 对照。 注意: 部分样本为 LT+sT 共表达,部分为 LT 单独表达。

样本名称 (Sample ID) 细胞类型 供体/ID 处理条件 (Condition) 对照类型 (Control) 文件名示例 (File Name) 备注
HEK293_r1 HEK293 N/A LT + sT Input HEK293_LT+sT_r1.fastq.gz
HEK293_LT+sT_r1_Input.fastq.gz
重复1
HEK293_r2 HEK293 N/A LT + sT Input HEK293_LT+sT_r2.fastq.gz 重复2 (Input可能在其他目录或共用)
HEK293_r3 HEK293 N/A LT + sT Input HEK293_LT+sT_r3.fastq.gz
HEK293_LT+sT_r3_Input.fastq.gz
重复3
HEK293_Mock_r1-3 HEK293 N/A Mock (Vector) Input HEK293_mock_r1...r3.fastq.gz
..._Input.fastq.gz
阴性对照 (之前分析中 r2/r3 质量较差可能被排除)
hTERT_LT_r1 hTERT (BJ5ta) N/A LT only Input? hTERT_LT_r1.fastq.gz 仅 LT 表达 (注意:之前分析中此样本可能因质量被排除,需检查对应 Input)
hTERT_LT_r2 hTERT (BJ5ta) N/A LT only Input hTERT_LT_r2.fastq.gz
hTERT_LT_r2_Input.fastq.gz
仅 LT 表达,高质量重复
hTERT_LT+sT_r1 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r1.fastq.gz
hTERT_LT+sT_r1_Input.fastq.gz
LT+sT 共表达
hTERT_LT+sT_r2 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r2.fastq.gz
hTERT_LT+sT_r2_Input.fastq.gz
LT+sT 共表达
hTERT_Mock_r1-2 hTERT (BJ5ta) N/A Mock (Vector) Input hTERT_mock_r1...r2.fastq.gz
..._Input.fastq.gz
阴性对照
NHDF_Donor1 NHDF (Primary) Donor 1 LT (Cm2b4) Input NHDF_LT_Donor1.fastq.gz
NHDF_LT_Donor1_Input.fastq.gz
原代细胞,生理相关性高
NHDF_Donor2 NHDF (Primary) Donor 2 LT (Cm2b4) Input NHDF_LT_Donor2.fastq.gz
NHDF_LT_Donor2_Input.fastq.gz
原代细胞,生理相关性高
p783_DonorI NHDF (Primary) Donor I (p783) LT?/Cm2b4 Input p783_ChIP_DonorI.fastq.gz
p783_input_DonorI.fastq.gz
2023年新批次数据
p783_DonorII NHDF (Primary) Donor II (p783) LT?/Cm2b4 Input p783_ChIP_DonorII.fastq.gz
p783_input_DonorII.fastq.gz
2023年新批次数据
PFSK-1A_r1 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r1.fastq.gz
PFSK-1A_LT+sT_r1_IgG.fastq.gz
注意: 使用 IgG 作为对照,而非 Input
PFSK-1A_r2 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r2.fastq.gz
PFSK-1A_LT+sT_r2_IgG.fastq.gz
注意: 使用 IgG 作为对照
PFSK-1B_r1 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r1.fastq.gz
PFSK-1B_LT+sT_r1_Input.fastq.gz
使用 Input 作为对照
PFSK-1B_r2 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r2.fastq.gz
PFSK-1B_LT+sT_r2_Input.fastq.gz
使用 Input 作为对照
PFSK-1A_H3K4 PFSK-1A N/A H3K4me3 ChIP IgG PFSK-1A_H3K4_...fastq.gz 非LT蛋白ChIP,为组蛋白修饰数据,可用于辅助注释

2. LT-K331A 突变体 RNA-Seq 数据集

状态: 未发表 (Unpublished) 目的: 比较野生型 LT、截短体 LTtr 和解旋酶突变体 K331A 对宿主转录组的影响。 细胞模型: NHDF (原代人真皮成纤维细胞),两个独立供体 (Donor I & II)。 时间点: 转导后第 8 天 (Day 8)。

样本名称 (Sample ID) 细胞类型 供体 (Donor) 处理条件 (Condition) 文件名 (File Name) 备注
Control_DI NHDF Donor I Vector Control control_d8_DonorI.fastq.gz 空白对照
Control_DII NHDF Donor II Vector Control control_d8_DonorII.fastq.gz 空白对照
Control_DII_Re NHDF Donor II Vector Control control-d8-DII_re.fastq.gz Donor II 的重复或重测数据
LT_WT_DI NHDF Donor I LT (Wild Type) LT_d8_DonorI.fastq.gz 野生型 LT
LT_WT_DII NHDF Donor II LT (Wild Type) LT_d8_DonorII.fastq.gz 野生型 LT
LTtr_DI NHDF Donor I LTtr (Truncated) LTtr_d8_DonorI.fastq.gz 肿瘤相关截短体
LTtr_DII NHDF Donor II LTtr (Truncated) LTtr_d8_DonorII.fastq.gz 肿瘤相关截短体
LT_K331A_DI NHDF Donor I LT-K331A (Mutant) LT_K331A_d8_DonorI.fastq.gz 解旋酶结构域突变体
LT_K331A_DII NHDF Donor II LT-K331A (Mutant) LT_K331A_d8_DonorII.fastq.gz 解旋酶结构域突变体
LT_K331A_DII_Re NHDF Donor II LT-K331A (Mutant) LT-K331A-d8-DII_re.fastq.gz Donor II 的重复或重测数据

数据分析建议

  1. ChIP-Seq 分析策略:

    • 分组: 将样本分为 LT_only (hTERT_LT_r2, NHDF_Donors), LT+sT (HEK293, hTERT_LT+sT, PFSK), 和 Mock
    • 对照处理: 注意 PFSK-1A 使用 IgG 对照,而其他样本主要使用 Input。在调用峰值 (Peak Calling, 如 MACS2) 时,需针对不同对照类型调整参数或分别处理。
    • 整合: 将 LT 结合位点与 RNA-Seq 中的差异基因 (DEGs) 进行重叠分析,特别是关注 LT-K331A 突变是否导致某些关键基因启动子区域的 LT 结合丢失或减弱。
  2. RNA-Seq 分析策略:

    • 差异表达: 使用 DESeq2 进行以下对比:
      • LT_WT vs Control
      • LTtr vs Control
      • LT_K331A vs Control
      • LT_K331A vs LT_WT (关键对比:确定 K331A 突变特异性影响的基因)
    • 功能富集: 重点关注干扰素信号通路 (ISGs)、细胞周期调控和 DNA 损伤反应基因。根据已发表论文,LT 会诱导 ISGs,而 K331A 突变可能会改变这种诱导能力或影响其他下游通路。
  3. 多组学整合:

    • 利用 NHDF Donor 1 & 2 的数据进行跨组学整合,因为这部分既有 ChIP-seq (LT 结合) 又有 RNA-seq (LT/K331A 表达影响),且来自相同的原代细胞系统,生物学一致性最高。


Based on the file list you provided and the background of published papers, here is the complete table of unpublished data related to LT (Large Tumor Antigen). These data are divided into ChIP-seq (LT protein binding sites) and RNA-seq (transcriptomic impact of LT and its mutants).

1. LT Protein-Specific ChIP-Seq Datasets

Status: Unpublished Objective: To map the direct genome-wide binding sites of the LT protein. Antibody: Cm2b4 (targeting LT/LTtr proteins) or IgG/Input controls. Note: Some samples involve co-expression of LT+sT, while others involve LT expression alone.

Sample ID Cell Type Donor/ID Condition Control Type Example File Name Remarks
HEK293_r1 HEK293 N/A LT + sT Input HEK293_LT+sT_r1.fastq.gz
HEK293_LT+sT_r1_Input.fastq.gz
Replicate 1
HEK293_r2 HEK293 N/A LT + sT Input HEK293_LT+sT_r2.fastq.gz Replicate 2 (Input may be in another directory or shared)
HEK293_r3 HEK293 N/A LT + sT Input HEK293_LT+sT_r3.fastq.gz
HEK293_LT+sT_r3_Input.fastq.gz
Replicate 3
HEK293_Mock_r1-3 HEK293 N/A Mock (Vector) Input HEK293_mock_r1...r3.fastq.gz
..._Input.fastq.gz
Negative control (r2/r3 might have been excluded due to poor quality in previous analyses)
hTERT_LT_r1 hTERT (BJ5ta) N/A LT only Input? hTERT_LT_r1.fastq.gz LT expression only (Note: This sample might have been excluded due to quality in previous analyses; check for corresponding Input)
hTERT_LT_r2 hTERT (BJ5ta) N/A LT only Input hTERT_LT_r2.fastq.gz
hTERT_LT_r2_Input.fastq.gz
LT expression only, high-quality replicate
hTERT_LT+sT_r1 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r1.fastq.gz
hTERT_LT+sT_r1_Input.fastq.gz
Co-expression of LT+sT
hTERT_LT+sT_r2 hTERT (BJ5ta) N/A LT + sT Input hTERT_LT+sT_r2.fastq.gz
hTERT_LT+sT_r2_Input.fastq.gz
Co-expression of LT+sT
hTERT_Mock_r1-2 hTERT (BJ5ta) N/A Mock (Vector) Input hTERT_mock_r1...r2.fastq.gz
..._Input.fastq.gz
Negative control
NHDF_Donor1 NHDF (Primary) Donor 1 LT (Cm2b4) Input NHDF_LT_Donor1.fastq.gz
NHDF_LT_Donor1_Input.fastq.gz
Primary cells, high physiological relevance
NHDF_Donor2 NHDF (Primary) Donor 2 LT (Cm2b4) Input NHDF_LT_Donor2.fastq.gz
NHDF_LT_Donor2_Input.fastq.gz
Primary cells, high physiological relevance
p783_DonorI NHDF (Primary) Donor I (p783) LT?/Cm2b4 Input p783_ChIP_DonorI.fastq.gz
p783_input_DonorI.fastq.gz
New batch data from 2023
p783_DonorII NHDF (Primary) Donor II (p783) LT?/Cm2b4 Input p783_ChIP_DonorII.fastq.gz
p783_input_DonorII.fastq.gz
New batch data from 2023
PFSK-1A_r1 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r1.fastq.gz
PFSK-1A_LT+sT_r1_IgG.fastq.gz
Note: Uses IgG as control, not Input
PFSK-1A_r2 PFSK-1A N/A LT + sT IgG PFSK-1A_LT+sT_r2.fastq.gz
PFSK-1A_LT+sT_r2_IgG.fastq.gz
Note: Uses IgG as control
PFSK-1B_r1 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r1.fastq.gz
PFSK-1B_LT+sT_r1_Input.fastq.gz
Uses Input as control
PFSK-1B_r2 PFSK-1B N/A LT + sT Input PFSK-1B_LT+sT_r2.fastq.gz
PFSK-1B_LT+sT_r2_Input.fastq.gz
Uses Input as control
PFSK-1A_H3K4 PFSK-1A N/A H3K4me3 ChIP IgG PFSK-1A_H3K4_...fastq.gz Not LT protein ChIP; histone modification data, useful for auxiliary annotation

2. LT-K331A Mutant RNA-Seq Datasets

Status: Unpublished Objective: To compare the impact of Wild-Type LT, Truncated LT (LTtr), and Helicase Mutant K331A on the host transcriptome. Cell Model: NHDF (Primary Human Dermal Fibroblasts), two independent donors (Donor I & II). Time Point: Day 8 post-transduction.

Sample ID Cell Type Donor Condition File Name Remarks
Control_DI NHDF Donor I Vector Control control_d8_DonorI.fastq.gz Blank control
Control_DII NHDF Donor II Vector Control control_d8_DonorII.fastq.gz Blank control
Control_DII_Re NHDF Donor II Vector Control control-d8-DII_re.fastq.gz Replicate or re-test data for Donor II
LT_WT_DI NHDF Donor I LT (Wild Type) LT_d8_DonorI.fastq.gz Wild-Type LT
LT_WT_DII NHDF Donor II LT (Wild Type) LT_d8_DonorII.fastq.gz Wild-Type LT
LTtr_DI NHDF Donor I LTtr (Truncated) LTtr_d8_DonorI.fastq.gz Tumor-associated truncated form
LTtr_DII NHDF Donor II LTtr (Truncated) LTtr_d8_DonorII.fastq.gz Tumor-associated truncated form
LT_K331A_DI NHDF Donor I LT-K331A (Mutant) LT_K331A_d8_DonorI.fastq.gz Helicase domain mutant
LT_K331A_DII NHDF Donor II LT-K331A (Mutant) LT_K331A_d8_DonorII.fastq.gz Helicase domain mutant
LT_K331A_DII_Re NHDF Donor II LT-K331A (Mutant) LT-K331A-d8-DII_re.fastq.gz Replicate or re-test data for Donor II

Data Analysis Recommendations

  1. ChIP-Seq Analysis Strategy:

    • Grouping: Divide samples into LT_only (hTERT_LT_r2, NHDF_Donors), LT+sT (HEK293, hTERT_LT+sT, PFSK), and Mock.
    • Control Handling: Note that PFSK-1A uses IgG controls, while other samples primarily use Input. When calling peaks (e.g., using MACS2), adjust parameters or process them separately based on the control type.
    • Integration: Overlap LT binding sites with Differentially Expressed Genes (DEGs) from RNA-Seq. Pay particular attention to whether the LT-K331A mutation leads to the loss or weakening of LT binding at the promoter regions of key genes.
  2. RNA-Seq Analysis Strategy:

    • Differential Expression: Use DESeq2 for the following comparisons:
      • LT_WT vs Control
      • LTtr vs Control
      • LT_K331A vs Control
      • LT_K331A vs LT_WT (Key comparison: Identify genes specifically affected by the K331A mutation)
    • Functional Enrichment: Focus on Interferon signaling pathways (ISGs), cell cycle regulation, and DNA damage response genes. According to published literature, LT induces ISGs, and the K331A mutation may alter this induction capacity or affect other downstream pathways.
  3. Multi-Omics Integration:

    • Utilize data from NHDF Donor 1 & 2 for cross-omics integration, as these samples have both ChIP-seq (LT binding) and RNA-seq (impact of LT/K331A expression) data from the same primary cell system, offering the highest biological consistency.

checkM output explanation

以下是 CheckM 结果表中各列的中文解释:

  1. Bin Id (基因组分箱编号)

    • 这是每个组装出的基因组(MAG)的唯一标识符。在你的数据中,它们以 “RKP” 开头(例如 RKP53, RKP5)。这对应于你输入文件中的样本名称。
  2. Marker Lineage (标记谱系/参考进化分支)

    • 这表示 CheckM 用来评估该基因组质量的参考进化树分支
    • CheckM 不会用同一套标准去衡量所有细菌,而是根据该基因组最可能属于的分类群(如“根节点 root”、“细菌界 kBacteria”、“葡萄球菌属 gStaphylococcus”等),选择一套特定的单拷贝标记基因集来进行比对。
    • 注意: 如果显示为 root (UID1)k__Bacteria,通常意味着该基因组质量较差或太短,CheckM 无法将其精确归类到更具体的分类层级,只能用最通用的标记集来估算,因此其结果的参考价值较低。
  3. # Genomes (# 参考基因组数)

    • 在选定的“标记谱系”中,包含的参考基因组数量
    • 这个数字越大,说明该分类群在数据库中越丰富,CheckM 评估时使用的统计模型就越可靠。例如 g__Staphylococcus 有 60 个参考基因组,而 root 有 5656 个。
  4. # Markers (# 标记基因数)

    • 在该特定谱系中,用于评估的单拷贝标记基因的总数
    • CheckM 通过查找这些保守基因是否存在、是否唯一来判断组装质量。不同分类群的标记基因数量不同(例如葡萄球菌属有 773 个标记,而根节点只有 56 个)。
  5. Completeness (%) (完整度)

    • 估计该基因组包含了多少比例的预期标记基因。
    • 含义: 数值越高越好。100% 表示找到了所有预期的单拷贝标记基因。
    • 警示: 高完整度并不总是代表高质量。如果 contamination(污染率)也很高(如你的 RKP53 达到 100% 完整度但 104% 污染),说明这个 bin 里混入了太多其他物种的序列,导致标记基因重复出现,从而虚高了完整度。
  6. Contamination (%) (污染率)

    • 估计该基因组中多余/重复的标记基因比例。
    • 含义: 数值越低越好。理想情况下应为 0%。
    • 计算逻辑: 如果某个本该是“单拷贝”的基因在你的 bin 里出现了 2 次或更多,CheckM 就会认为这是污染(即混入了其他菌株或物种的 DNA)。
    • 你的数据情况: 很多样本(如 RKP53, RKP43, RKP31)污染率超过 100%,这意味着平均每个标记基因都出现了两次以上,这是严重的嵌合体(Chimeric bin),必须剔除。
  7. Strain Heterogeneity (%) (菌株异质性)

    • 估计该基因组内部是否存在多个近缘菌株混合的情况。
    • 含义: 数值越低越好。
    • 原理: 当存在多个相似菌株时,某些标记基因可能会出现轻微的序列变异(多态性),或者部分标记基因出现双份。CheckM 通过分析这些信号来估算异质性。
    • 影响: 高异质性(如 RKP53 的 82.76%)意味着这个 bin 不是单一纯培养物,而是多个相似菌株的混合物。这对于构建精确的系统发育树或进行 SNP 分析是非常不利的。

Table 1: CheckM Quality Assessment Results

Bin Id Marker Lineage # Genomes # Markers Completeness (%) Contamination (%) Strain Heterogeneity (%)
RKP53 root (UID1) 5656 56 100.00 104.17 82.76
RKP5 c__Gammaproteobacteria (UID4445) 228 583 100.00 0.14 0.00
RKP43 root (UID1) 5656 56 100.00 104.17 0.00
RKP42 k__Bacteria (UID203) 5449 104 100.00 99.84 0.00
RKP37 k__Bacteria (UID203) 5449 104 100.00 99.84 0.00
RKP33 k__Bacteria (UID203) 5449 104 100.00 101.57 0.00
RKP31 root (UID1) 5656 56 100.00 104.92 79.03
RKP1 root (UID1) 5656 56 100.00 100.00 0.00
RKP47 g__Burkholderia (UID4006) 64 769 99.87 0.00 0.00
RKP38 g__Staphylococcus (UID294) 60 773 99.81 0.00 0.00
RKP30 g__Staphylococcus (UID294) 60 773 99.81 2.61 7.14
RKP54 g__Staphylococcus (UID294) 60 773 99.67 0.00 0.00
RKP25 g__Staphylococcus (UID294) 60 773 99.67 0.28 0.00
RKP24 g__Staphylococcus (UID294) 60 773 99.67 0.28 0.00
RKP19 g__Staphylococcus (UID294) 60 773 99.67 0.00 0.00
RKP18 g__Staphylococcus (UID294) 60 773 99.67 0.00 0.00
RKP17 g__Staphylococcus (UID294) 60 773 99.67 0.00 0.00
RKP26 o__Lactobacillales (UID544) 293 475 99.63 0.00 0.00
RKP15 o__Lactobacillales (UID544) 293 475 99.63 0.56 0.00
RKP7 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP56 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP50 g__Staphylococcus (UID298) 56 805 99.62 25.90 24.64
RKP49 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP45 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP40 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP39 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP3 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP29 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP22 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP21 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP13 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP12 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP11 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP10 g__Staphylococcus (UID298) 56 805 99.62 0.00 0.00
RKP36 g__Staphylococcus (UID298) 56 805 99.61 3.41 30.56
RKP35 g__Staphylococcus (UID301) 45 940 99.51 0.08 0.00
RKP34 g__Staphylococcus (UID301) 45 940 99.51 0.08 0.00
RKP6 g__Staphylococcus (UID298) 56 805 99.51 1.79 57.14
RKP4 g__Staphylococcus (UID298) 56 805 99.51 0.17 100.00
RKP9 g__Staphylococcus (UID298) 56 805 99.48 0.00 0.00
RKP8 g__Staphylococcus (UID298) 56 805 99.48 0.00 0.00
RKP41 c__Bacilli (UID285) 586 325 99.45 0.55 0.00
RKP2 g__Staphylococcus (UID301) 45 940 99.40 0.10 0.00
RKP48 g__Staphylococcus (UID298) 56 805 99.38 1.14 50.00
RKP46 g__Staphylococcus (UID298) 56 805 99.38 1.14 50.00
RKP16 g__Staphylococcus (UID298) 56 805 99.38 0.59 0.00
RKP14 g__Staphylococcus (UID298) 56 805 99.38 0.57 0.00
RKP55 g__Staphylococcus (UID298) 56 805 99.33 0.57 0.00
RKP52 g__Staphylococcus (UID298) 56 805 99.33 0.57 0.00
RKP51 g__Staphylococcus (UID298) 56 805 99.33 0.57 0.00
RKP32 g__Staphylococcus (UID294) 60 773 99.25 0.00 0.00
RKP28 f__Micrococcaceae (UID1623) 39 457 98.70 0.23 0.00
RKP23 k__Bacteria (UID203) 5449 104 98.28 37.93 85.48
RKP44 g__Staphylococcus (UID298) 56 805 97.34 5.16 37.14


Explain: RKP4 g__Staphylococcus (UID298) 0.17 100.00

这是一个非常典型且有趣的现象。在 CheckM 的结果中,低污染(Contamination = 0.17%)极高菌株异质性(Strain Heterogeneity = 100.00%) 通常意味着:你的这个 Bin 里实际上混合了多个高度相似的菌株(Strains),而不是多个不同的物种(Species)。

以下是详细的解读:

1. 为什么污染率这么低 (0.17%)?

  • 定义: CheckM 的“污染”主要检测的是不同物种之间的标记基因重复。例如,如果 Bin 里同时有 Staphylococcus aureusEscherichia coli,它们的核心基因完全不同,CheckM 会发现大量非预期的标记基因,从而报出高污染。
  • 现状: RKP4 被 GTDB-Tk 鉴定为 Staphylococcus haemolyticus。Bin 里的所有序列都属于这个物种(或极近缘物种)。因为物种层面的核心基因集是统一的,所以没有触发“跨物种污染”的警报。

2. 为什么菌株异质性高达 100%?

  • 定义: “菌株异质性”检测的是同一物种内不同菌株之间的序列差异。
  • 机制: 当样本中存在两个或多个高度相似的 S. haemolyticus 菌株时,组装软件(Assembler)往往无法将它们完全分开,而是会将它们组装成一个个“嵌合”的 Contig,或者将属于不同菌株的相似区域合并在一起。
  • CheckM 的信号: CheckM 在比对标记基因时,发现某些本该是“单拷贝”的基因位点上,存在显著的序列多态性(SNPs/Indels),或者同一个基因出现了两个高度相似但不完全相同的副本(Paralogs due to strain variation)。
  • 100% 的含义: 这表示在该 Bin 的所有可评估标记基因中,几乎每一个都检测到了这种“多菌株混合”的信号。这说明该 Bin 不是由一个纯克隆(Pure Clone)组成的,而是一个种群(Population)的混合体。

3. 结合 GTDB-Tk 结果看 RKP4

  • 分类: Staphylococcus haemolyticus
  • ANI: 98.9% (vs GCF_006094395.1)
  • AF (Alignment Fraction): 0.876
    • 注意: AF 为 0.876 意味着只有约 87.6% 的参考基因组与你的 Bin 比对上了。对于高质量 MAG,AF 通常 >0.9 甚至 >0.95。
    • 关联: 较低的 AF 加上 100% 的异质性,强烈暗示你的 Bin 可能是一个泛基因组(Pangenome)级别的混合,或者包含了该物种中某个参考基因组所没有的独特区域(可能是另一个菌株特有的基因岛)。

4. 对下游分析的影响与建议

分析类型 影响程度 建议
物种注释/功能概况 🟢 低 基本可用。因为都是 S. haemolyticus,物种层面的功能预测(如代谢通路)通常是准确的。
系统发育树 (Phylogeny) 🟡 中 需谨慎。 如果建树使用的是单拷贝标记基因(Single-copy markers),混合菌株会导致分支长度异常或拓扑结构错误。建议在建树前使用工具(如 phyloFlash 或手动筛选)提取一致性序列,或者直接剔除该样本以保证树的稳健性。
SNP calling / 进化分析 不可用。 100% 异质性意味着你无法区分哪些变异是测序错误、组装错误,还是真实的菌株间差异。强行做 SNP 分析会得到错误的进化距离。
毒力因子/耐药基因 🟡 中 需注意基因拷贝数。混合菌株可能导致某些耐药基因看起来有“多个拷贝”,但实际上可能分属不同菌株。

总结

RKP4 是一个“干净但混杂”的 Bin。 它没有混入其他物种(低污染),但它内部包含了多个 S. haemolyticus 菌株的序列(高异质性)。

  • 如果你的目标是构建高精度的系统发育树: 听从你之前的建议,删除 RKP4 是最稳妥的选择,因为它会引入噪音。
  • 如果你只想看群落组成或功能潜力: 可以保留,但需知晓它代表的是一个菌株群体而非单一基因组。

降解酶是在细胞内还是细胞外的?

这是一个非常敏锐且关键的问题。简短的回答是:两者都有,但主导“死后迅速清除”的主要是细胞内的酶。

为了更准确地理解这个过程,我们需要区分正常生理状态下的RNA周转细胞死亡后的降解

1. 细胞内(Intracellular):主要的降解场所

在细胞活着的时候,以及刚死亡的初期,RNA的降解主要发生在细胞内部。

  • 核糖核酸酶(RNases): 细胞质和细胞器中充满了各种RNase。这些酶在正常代谢中负责清理旧的、错误的或不再需要的mRNA。
  • 溶酶体(Lysosomes): 当细胞启动自噬或程序性死亡(凋亡)时,溶酶体会释放大量水解酶,包括强效的RNase,将细胞内的RNA彻底分解。
  • 为什么死后很快消失? 因为细胞膜破裂后,原本被 compartmentalization(区室化)隔离的酶会释放出来,与底物(RNA)充分接触,导致快速降解。

2. 细胞外(Extracellular):环境中的“清道夫”

一旦细胞裂解,内容物释放到周围环境中,细胞外的因素也开始起作用:

  • 环境中的RNase: 土壤、水体、甚至空气中都广泛存在微生物分泌的RNase。这些酶非常稳定且活性极强。
  • 其他细胞的酶: 在多细胞生物体内,免疫细胞(如巨噬细胞)会吞噬死亡细胞碎片,并在其内部的溶酶体中降解RNA。
  • 血液/体液中的酶: 在动物体内,血浆中也含有RNase,用于清除循环中的游离RNA。

3. 为什么我们还能在化石或古老样本中找到RNA?

虽然理论上RNA应该迅速消失,但在某些特殊条件下可以保留:

  • 极端干燥或冷冻: 抑制了酶的活性。
  • 矿化作用: RNA可能被包裹在矿物晶体中,物理上隔绝了酶。
  • 结合蛋白: RNA可能与某些保护性蛋白结合,延缓降解。

总结

  • 主要降解者: 细胞内的RNase 是RNA短命的主要原因。它们在细胞活着时就不断工作,在细胞死亡后因膜破裂而更加活跃。
  • 次要但重要的角色: 细胞外的环境RNase 会在细胞裂解后进一步确保RNA被彻底清除,防止遗传信息污染环境或被其他细胞误用。

所以,当你听到“死亡细胞不应该保留任何RNA”时,主要是因为细胞内原有的降解系统失控并加速工作,加上外部环境的侵蚀共同作用的结果。



这篇文章报道了德国马克斯·普朗克海洋微生物研究所的一项突破性发现,科学家首次直接观察到了“跳跃基因”在不同物种间的转移过程。以下是核心内容总结:

1. 核心发现: 研究团队在一种捕食性细菌(Ca. Velamenicoccus archaeovorus)与其猎物古菌(Methanothrix soehngenii)的互动中,首次亲眼目睹并证实了跳跃基因(具体为一种内含子)以 RNA形式 跨物种转移。

2. 关键机制:环状RNA的稳定性

  • 反常现象: 通常RNA极不稳定,且在细胞死亡后会迅速被酶降解。
  • 生存原因: 该跳跃基因形成的内含子RNA呈环状结构。由于没有末端,降解酶无法对其进行切割,使其能在死亡的猎物细胞残骸中长期稳定存在,从而被科学家通过高灵敏度探针捕获。

3. 科学意义:

  • 填补空白: 此前关于跳跃基因跨物种转移主要依赖“搭车假说”(借助病毒或质粒),缺乏直接证据。这项研究提供了可视化的直接证据。
  • 新传播路径: 揭示了跳跃基因可能无需病毒或质粒作为载体,仅凭稳定的环状RNA结构即可在物种间(如捕食过程中)进行传递。
  • 进化启示: 虽然本次观察中猎物已死导致转移未完全成功,但这表明在捕食等密切接触中,若猎物未立即死亡,这种机制可能成为生命进化和基因交流的重要途径。

4. 背景信息:

  • 研究成果于2026年5月发表在《科学报告》上。
  • 环状RNA不仅在微生物进化中起作用,在人类医学(如癌症、疫苗开发)中也是研究热点。