<p>I believe the error is from <code>featureCounts</code> and the solution would be to add the <code>-p</code> flag to the <code>featureCounts</code> call, stating that you are providing paired-end data.</p>
<p>EDIT: You might want to check this <a href="https://www.reddit.com/r/bioinformatics/comments/13m89bd/help_with_featurecounts_error_pairedend_reads/" rel="noreferrer"><code>r/bioinformatics</code> (reddit) thread</a> out.</p>

CC BY-SA 4.0
2023-12-23T05:41:00.363Z
Well, thanks. It worked when I added the -p flag to the featureCounts call
Emmanuel Aroma
CC BY-SA 4.0
2023-12-24T16:16:19.773Z
@EmmanuelAroma Accept haci's answer to mark the post as answered.
Ram RS
CC BY-SA 4.0
2023-12-25T07:03:31.523Z
thank you so much comrades, I've got a wonderful answer
Emmanuel Aroma
CC BY-SA 4.0
2023-12-22T13:28:26.453Z
2023-12-22T13:28:26.453Z
haci
<p><em>This question was also asked on <a href="https://www.biostars.org/p/9583255/" rel="nofollow noreferrer">Biostars</a></em></p>
<p>I have this script</p>
<pre><code>#!/bin/bash

# Defining the number of threads to be used
threads=20

# Alignment of sequences to the reference genome using 'HISAT2'
echo -e &quot;\nNow Running Classical Alignment-based with HISAT2...\n&quot;

mkdir -p hisat2

# Download the human reference genome
wget -c ftp://ftp.ensembl.org/pub/release-100/fasta/homo_sapiens/dna/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz -O hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
gunzip hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz

# Download the human annotation file
wget -c ftp://ftp.ensembl.org/pub/release-100/gtf/homo_sapiens/Homo_sapiens.GRCh38.100.gtf.gz -O hisat2/Homo_sapiens.GRCh38.100.gtf.gz
gunzip hisat2/Homo_sapiens.GRCh38.100.gtf.gz

# HISAT2 indexing to build the reference genome index
hisat2-build -p $threads hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa hisat2/Homo_sapiens.GRCh38v3_hisat2.idx

# HISAT2 Alignment
for sample in <span class="math-container">$(cat sample_ids.txt)
do
    hisat2 -p $</span>threads -x hisat2/Homo_sapiens.GRCh38v3_hisat2.idx \
        -1 trimmed_data/<span class="math-container">${sample}_1_val_1.fq -2 trimmed_data/$</span>{sample}_2_val_2.fq \
        -S hisat2/${sample}_hisat2.sam

    # Compress the SAM files to binary format, sort them, and index them.
    samtools view -Sb hisat2/<span class="math-container">${sample}_hisat2.sam | samtools sort &gt; hisat2/$</span>{sample}_hisat2_sorted.bam
    samtools index hisat2/<span class="math-container">${sample}_hisat2_sorted.bam
rm hisat2/$</span>{sample}_hisat2.sam  # Remove the .sam files for storage purposes
done

# Quantifying Aligned reads using the Subread package's script 'featureCounts'
for sample in <span class="math-container">$(cat sample_ids.txt)
do
featureCounts -T $</span>threads -a hisat2/Homo_sapiens.GRCh38.100.gtf \
        -o hisat2/<span class="math-container">${sample}_hisat2_counts.txt \
    hisat2/$</span>{sample}_hisat2_sorted.bam
done

# Generating analysis report with MultiQC
echo &quot;Running MultiQC on HISAT2 alignment results .........&quot;
multiqc -o multiQCreports hisat2
echo &quot;MultiQC on HISAT2 alignment results completed successfully.&quot;

# Display message to show that the script is complete
echo &quot;Script completed!&quot;
</code></pre>
<p>However, I have receieved an error below</p>
<pre><code>Load annotation file Homo_sapiens.GRCh38.100.gtf ...                       ||
||    Features : 1378275                                                      ||
||    Meta-features : 60683                                                   ||
||    Chromosomes/contigs : 47                                                ||
||                                                                            ||
|| Process BAM file SRR19170514_hisat2_sorted.bam...                          ||
ERROR: Paired-end reads were detected in single-end read library : hisat2/SRR19170514_hisat2_sorted.bam
ERROR: Paired-end reads were detected in single-end read library : hisat2/SRR19170514_hisat2_sorted.bam
</code></pre>
<p>Question: What can I do to solve this?</p>

<rna-seq>
Classical alignment with HISAT2
# Classical alignment with HISAT2

(Asked by: username_0 on 2023-12-22)

This question was also asked on Biostars
I have this script
#!/bin/bash

# Defining the number of threads to be used
threads=20

# Alignment of sequences to the reference genome using 'HISAT2'
echo -e "\nNow Running Classical Alignment-based with HISAT2...\n"

mkdir -p hisat2

# Download the human reference genome
wget -c ftp://ftp.ensembl.org/pub/release-100/fasta/homo_sapiens/dna/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz -O hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
gunzip hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz

# Download the human annotation file
wget -c ftp://ftp.ensembl.org/pub/release-100/gtf/homo_sapiens/Homo_sapiens.GRCh38.100.gtf.gz -O hisat2/Homo_sapiens.GRCh38.100.gtf.gz
gunzip hisat2/Homo_sapiens.GRCh38.100.gtf.gz

# HISAT2 indexing to build the reference genome index
hisat2-build -p $threads hisat2/Homo_sapiens.GRCh38.dna.primary_assembly.fa hisat2/Homo_sapiens.GRCh38v3_hisat2.idx

# HISAT2 Alignment
for sample in $(cat sample_ids.txt)
do
    hisat2 -p $threads -x hisat2/Homo_sapiens.GRCh38v3_hisat2.idx \
        -1 trimmed_data/${sample}_1_val_1.fq -2 trimmed_data/${sample}_2_val_2.fq \
        -S hisat2/${sample}_hisat2.sam

    # Compress the SAM files to binary format, sort them, and index them.
    samtools view -Sb hisat2/${sample}_hisat2.sam | samtools sort > hisat2/${sample}_hisat2_sorted.bam
    samtools index hisat2/${sample}_hisat2_sorted.bam
rm hisat2/${sample}_hisat2.sam  # Remove the .sam files for storage purposes
done

# Quantifying Aligned reads using the Subread package's script 'featureCounts'
for sample in $(cat sample_ids.txt)
do
featureCounts -T $threads -a hisat2/Homo_sapiens.GRCh38.100.gtf \
        -o hisat2/${sample}_hisat2_counts.txt \
    hisat2/${sample}_hisat2_sorted.bam
done

# Generating analysis report with MultiQC
echo "Running MultiQC on HISAT2 alignment results ........."
multiqc -o multiQCreports hisat2
echo "MultiQC on HISAT2 alignment results completed successfully."

# Display message to show that the script is complete
echo "Script completed!"

However, I have receieved an error below
Load annotation file Homo_sapiens.GRCh38.100.gtf ...                       ||
||    Features : 1378275                                                      ||
||    Meta-features : 60683                                                   ||
||    Chromosomes/contigs : 47                                                ||
||                                                                            ||
|| Process BAM file SRR19170514_hisat2_sorted.bam...                          ||
ERROR: Paired-end reads were detected in single-end read library : hisat2/SRR19170514_hisat2_sorted.bam
ERROR: Paired-end reads were detected in single-end read library : hisat2/SRR19170514_hisat2_sorted.bam

Question: What can I do to solve this?

**Tags:** rna-seq

---

## 1 answers

### Answer by username_1 on 2023-12-22. Score: 6 | Accepted answer

I believe the error is from `featureCounts` and the solution would be to add the `-p` flag to the `featureCounts` call, stating that you are providing paired-end data.

EDIT: You might want to check this [`r/bioinformatics` (reddit) thread](https://www.reddit.com/r/bioinformatics/comments/13m89bd/help_with_featurecounts_error_pairedend_reads/) out.

> **Comments:**
> **username_0**: Well, thanks. It worked when I added the -p flag to the featureCounts call  
> **username_2**: @EmmanuelAroma Accept haci's answer to mark the post as answered.  
> **username_0**: thank you so much comrades, I've got a wonderful answer  

---

