Entering edit mode
2.2 years ago
Zebk
•
0
Dear All,
I am trying to generate bw files using bamCoverage. But, everytime it causes errors like this:
bamFilesList: ['./alignment/bam/M-EK-0D-IgG-1_S31_L003.mapped.sorted.bam']
binLength: 50
numberOfSamples: None
blackListFileName: None
skipZeroOverZero: False
bed_and_bin: False
genomeChunkSize: None
defaultFragmentLength: read length
numberOfProcessors: 1
verbose: False
region: None
bedFile: None
minMappingQuality: None
ignoreDuplicates: False
chrsToSkip: []
stepSize: 50
center_read: False
samFlag_include: None
samFlag_exclude: None
minFragmentLength: 0
maxFragmentLength: 0
zerosToNans: False
smoothLength: None
save_data: False
out_file_for_raw_data: None
maxPairedFragmentLength: 1000
Traceback (most recent call last):
File "/home/anaconda3/bin/bamCoverage", line 12, in <module>
main(args)
File "/home/anaconda3/lib/python3.8/site-packages/deeptools/bamCoverage.py", line 256, in main
wr.run(writeBedGraph.scaleCoverage, func_args, args.outFileName,
File "/home/anaconda3/lib/python3.8/site-packages/deeptools/writeBedGraph.py", line 171, in run
bedGraphToBigWig(chrom_names_and_size, [x[3] for x in res], out_file_name)
File "/home/anaconda3/lib/python3.8/site-packages/deeptools/writeBedGraph.py", line 293, in bedGraphToBigWig
bw.addHeader(chromSizes, maxZooms=10)
RuntimeError: Received an error while writing the bigWig header
[bwClose] There was an error while finishing writing a bigWig file! The output is likely truncated.
I used the following commands to generate bam files:
# bowtie2 alignment
bowtie2 -p6 --very-sensitive-local --no-mixed --no-discordant --phred33 -I 10 -X 2000 -x ./bt2/chr \
-1 ./trim/${SAMPLE}_R1_001.trimmed.fastq.gz \
-2 ./trim/${SAMPLE}_R2_001.trimmed.fastq.gz \
-S ./alignment/sam/${SAMPLE}_bowtie2.sam &> ./alignment/sam/${SAMPLE}_bowtie2.txt;
# remove duplicate with picard
java -jar picard.jar MarkDuplicates \
I=./alignment/removeDuplicate/${SAMPLE}_bowtie2.sorted.sam \
O=./alignment/removeDuplicate/${SAMPLE}_bowtie2.sorted.rmDup.sam \
REMOVE_DUPLICATES=true \
M=./alignment/removeDuplicate/picard_summary/${SAMPLE}_picard.rmDup.txt;
# Filtering mapped reads by the mapping quality filtering
minQualityScore=2
samtools view -q $minQualityScore ./alignment/removeDuplicate/${SAMPLE}_bowtie2.sorted.rmDup.sam >./alignment/sam/${SAMPLE}_bowtie2.qualityScore2.sam;
#convert to bam files
samtools view -bS -h -F 0x04 ./alignment/removeDuplicate/${SAMPLE}_bowtie2.sorted.rmDup.sam > ./alignment/bam/${SAMPLE}_bowtie2.mapped.bam; \
samtools sort ./alignment/bam/${SAMPLE}_bowtie2.mapped.bam \
-o ./alignment/bam/${SAMPLE}.mapped.sorted.bam; \
samtools index ./alignment/bam/${SAMPLE}.mapped.sorted.bam \
./alignment/bam/${SAMPLE}.mapped.sorted.bai;
#bamCoverage command
bamCoverage -b ./alignment/bam/${SAMPLE}.mapped.sorted.bam -o ./alignment/bigwig/${SAMPLE}.bw
It sounds like the header problem, but not clear how to resolve it... "RuntimeError: Received an error while writing the bigWig header"
I sincerely appreciate reading this long email and your kind help.
Best,
Thank you so much. I did not use -h with -q. I will also work with BAM rather than SAM! Thank you again. Best,
Hi ATpoint,
I changed my script like this:
As -h was used with samtools, I expected bamCoverage might go forward but it caused the same error...
I also tried to use bamCoverage with bam files of which duplicates were not removed. However, it caused the same error. I guess that samtools argument may not be correct, but I do not know what it is.
Would you please help me know what I can try to fix it?
Thank you for your support.
Best