Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimap2 2.27 not outputting MD tag #1182

Closed
ddubocan opened this issue Mar 21, 2024 · 4 comments
Closed

minimap2 2.27 not outputting MD tag #1182

ddubocan opened this issue Mar 21, 2024 · 4 comments
Labels

Comments

@ddubocan
Copy link

Hi,

Recently upgraded to 2.27 via bioconda and noticed that even when including the --MD tag , no MD tag was output.

Downgrading back down to 2.26 fixed the issue, and MD tags were output again.

@lh3
Copy link
Owner

lh3 commented Mar 25, 2024

This is caused by the same bug #1181. I will cut a new release later this week.

@lh3 lh3 added the bug label Mar 25, 2024
@wdg118
Copy link

wdg118 commented Mar 30, 2024

Hi @lh3 ,

Was this ever fixed ? I tried @ddubocan 's solution but I still don't get the MD tags.

I ran:

#!/bin/bash

# Define paths
REFERENCE="/home/jupyter/GRCh38.primary_assembly.genome.fa"
FASTQ_DIR="/home/jupyter/samples"
OUTPUT_DIR="/home/jupyter/talon_output/sam_files"

# Create output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"

# Loop through FASTQ files and align each to the reference genome
for FASTQ_FILE in "$FASTQ_DIR"/pychopper_BC*Merged.fastq; do
    # Extract the base name for the output file
    BASE_NAME=$(basename "$FASTQ_FILE" .fastq)
    
    # Define output SAM file path
    OUTPUT_SAM="$OUTPUT_DIR/${BASE_NAME}.sam"
    
    # Run minimap2 to align reads and generate SAM file with MD tags
    minimap2 -ax map-ont --MD -t 8 "$REFERENCE" "$FASTQ_FILE" > "$OUTPUT_SAM"
    
    echo "Alignment completed for $FASTQ_FILE."
done

echo "All alignments completed."

and then when running:

#!/bin/bash

for sam_file in /home/jupyter/talon_output/sam_files/*.sam; do
    echo "Checking $sam_file for MD tags..."
    missing_tags=$(grep -v "^@" $sam_file | grep -v "MD:Z" | wc -l)
    
    if [ "$missing_tags" -eq "0" ]; then
        echo "All reads in $sam_file have MD tags."
    else
        echo "$missing_tags reads in $sam_file are missing MD tags."
    fi
done

I get:

Checking /home/jupyter/talon_output/sam_files/pychopper_BC01Merged.sam for MD tags...
11456 reads in /home/jupyter/talon_output/sam_files/pychopper_BC01Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC02Merged.sam for MD tags...
19734 reads in /home/jupyter/talon_output/sam_files/pychopper_BC02Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC03Merged.sam for MD tags...
16840 reads in /home/jupyter/talon_output/sam_files/pychopper_BC03Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC04Merged.sam for MD tags...
17670 reads in /home/jupyter/talon_output/sam_files/pychopper_BC04Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC05Merged.sam for MD tags...
9549 reads in /home/jupyter/talon_output/sam_files/pychopper_BC05Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC06Merged.sam for MD tags...
12603 reads in /home/jupyter/talon_output/sam_files/pychopper_BC06Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC07Merged.sam for MD tags...
4052 reads in /home/jupyter/talon_output/sam_files/pychopper_BC07Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC08Merged.sam for MD tags...
3989 reads in /home/jupyter/talon_output/sam_files/pychopper_BC08Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC09Merged.sam for MD tags...
6884 reads in /home/jupyter/talon_output/sam_files/pychopper_BC09Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC10Merged.sam for MD tags...
7445 reads in /home/jupyter/talon_output/sam_files/pychopper_BC10Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC11Merged.sam for MD tags...
5802 reads in /home/jupyter/talon_output/sam_files/pychopper_BC11Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC12Merged.sam for MD tags...
2064 reads in /home/jupyter/talon_output/sam_files/pychopper_BC12Merged.sam are missing MD tags.
Checking /home/jupyter/talon_output/sam_files/pychopper_BC13Merged.sam for MD tags...
3195 reads in /home/jupyter/talon_output/sam_files/pychopper_BC13Merged.sam are missing MD tags.

I'm confused as to what is going on here. I need these MD tags to run TALON.

@lh3
Copy link
Owner

lh3 commented Mar 30, 2024

Yes, fixed and released.

@lh3 lh3 closed this as completed Mar 30, 2024
@wdg118
Copy link

wdg118 commented Mar 30, 2024

Odd that I'm getting a lot of reads without MD tags. I don't know what's going on here as I ran Minimap2 with --MD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants