This is a test version of Biostars. For the public version, visit https://www.biostars.org.
qualimap - bed file error - BED format error, there should be at least 6 fields.

Hello,

I am trying to run qualimap, my code is as below:

TOOL=qualimap
EXOME_IDs_FILE=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/fastp/All_fastp_input/List_of_33_exome_IDs
SORTEDBAM=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/samtools/sort/{}PE_samtoolssorted.bam
QUALIMAPBAMQCOUTPUTDIR=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/coveragetest/qualimap/{}
QUALIMAPBAMQCOUTPUTFILE=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/coveragetest/qualimap/{}.pdf
BEDFILEGFF=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/deepvariant/bed/novogene_agilent_human_region_hg38_recoded.bed
MAKEDIRECTORYIDS=/scratch/c.c21087028/Polyposis_Exome_Analysis_Novogene/coveragetest/qualimap/{}


cd /scratch/c.c21087028/

# samtools flagstat on .sam files
sed -n "${SLURM_ARRAY_TASK_ID}p" $EXOME_IDs_FILE | parallel -j 1 "$TOOL bamqc -bam $SORTEDBAM -gff $BEDFILEGFF -outdir $QUALIMAPBAMQCOUTPUTDIR -outfile $QUALIMAPBAMQCOUTPUTFILE -outformat pdf --java-mem-size=4G"

However, I am getting the error:

Failed to run bamqc
java.lang.RuntimeException: BED format error, there should be at least 6 fields.
Problematic line:
NC_000001.11    12080   12251
        at org.bioinfo.ngs.qc.qualimap.common.GenomicFeatureStreamReader$2.parseFeatureRecord(GenomicFeatureStreamReader.java:70)
        at org.bioinfo.ngs.qc.qualimap.common.GenomicFeatureStreamReader.readNextRecord(GenomicFeatureStreamReader.java:184)
        at org.bioinfo.ngs.qc.qualimap.process.BamStatsAnalysis.loadSelectedRegions(BamStatsAnalysis.java:982)
        at org.bioinfo.ngs.qc.qualimap.process.BamStatsAnalysis.run(BamStatsAnalysis.java:286)
        at org.bioinfo.ngs.qc.qualimap.main.BamQcTool.execute(BamQcTool.java:242)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartTool.run(NgsSmartTool.java:190)
        at org.bioinfo.ngs.qc.qualimap.main.NgsSmartMain.main(NgsSmartMain.java:111)

The first ten lines of my bed file look like this - lines spaces are not present in the file, just for ease of posting here (the bam file and the bed file did not have the same IDs so the bed file had to be changed from chr1 to NC_000001.11 ect):

NC_000001.11 12080 12251

NC_000001.11 12595 12802

NC_000001.11 13163 13658

NC_000001.11 14620 15015

NC_000001.11 15795 15914

NC_000001.11 16743 17098

NC_000001.11 17247 18121

NC_000001.11 18216 18411

NC_000001.11 18963 19169

NC_000001.11 24260 24532

Anyone know how to stop this error?

Thanks! Amy

qualimap

Thanks Asaf! Yes, it seems that way. I'm not sure what to do if my bed file doesn't already have those columns? Amy

Either make something up if it's not important or try to get the bed file with those columns. To make it up you can use awk for instance

Hi Asaf, I don't suppose you know how to add 3 new columns all with a zero value?

I've tried this for one column but can't get it to work:

awk 'BEGIN {OFS="\t"}{$4=0; print $0}' file.bed newfile.bed 

it doesn't make any changes to the file.

Any ideas?

Your command is missing a redirection operator (>) to write the output of awk to the file newfile.bed:

awk 'BEGIN {OFS="\t"}{$4=0; print $0}' file.bed > newfile.bed

0 answers

No answers yet.

Log in to answer this question.