bedGraph to bigwig
2
0
Entering edit mode
7 weeks ago
Pegasus ▴ 80

Hi everyone,

I am trying to visualize my bam.file (RNA-seq) using IGV. Following a combination of Biostar and a recommended step posted by #Matt Shirley,

• I converted bam to bedgraph using bedtools genomecov -ibam
• Generated the indexed sized genome using faidx input.fasta -i chromsizes
• However, using the command line bedGraphToBigWig SAMPLE.bedgraph GENOME_FASTA_INDEX SAMPLE.STRANDRaw.bigwig, generated 0 byte-size bw file.
1. My fasta.file is a small genome that contains 52 Contigs/scaffolds belonging to a one chromosome (Bacteria).
2. Using the original fasta file also generated 0 byte-size bw file
3. Is there any tool to merge the 52 contigs generated by Medusa scaffolder, and is such Merging essential for better downstream analysis' results?

Thank you

IGV RNA-seq • 818 views
0
Entering edit mode

The genome file is a simple two-column file, first one being the chromosome name and second one the size of the chromosome. Example linked below.

https://github.com/igvteam/igv/blob/master/genomes/sizes/hg38.chrom.sizes

0
Entering edit mode

random note: you can easily generate a .chrom.sizes file with "samtools faidx", which generates a .fai file, and I believe you can even use the .fai in place of a .chrom.sizes since the first two columns of .fai are the chrom sizes

0
Entering edit mode

Actually, I started with the fai.file which generated the same 0byte bw file, and this is why I moved to the genomesize as recommended in several threads.

0
Entering edit mode

@ATpoint Yes, the resulting genomesize file showed a correct pattern (list of all contigs column1 and their sizes column2). However, although bam > bg was generated successfully, bg > bw resulted 0 byte file

0
Entering edit mode

0
Entering edit mode

Can you give a head of the bedGraph? I think bedtools needs the -bg flag to output bedGraph rather than its histogram-like default.

0
Entering edit mode

Here is the head of the bg.file (4 columns)

JAFJXZ01    5   2   934 0.00214133

JAFJXZ01    6   1   934 0.00107066

JAFJXZ01    9   2   934 0.00214133

JAFJXZ01    12  1   934 0.00107066

JAFJXZ01    13  2   934 0.00214133

JAFJXZ01    14  4   934 0.00428266

JAFJXZ01    16  2   934 0.00214133

JAFJXZ01    17  2   934 0.00214133

JAFJXZ01    18  3   934 0.00321199

JAFJXZ01    19  6   934 0.00642398

1
Entering edit mode

It is five columns, no? And indeed not bedGraph format. Try adding the -bg or -bga option to genomecov.

0
Entering edit mode

I included the argument -bg in my command line;

bedtools genomecov -ibam < input file name> -g <genome.gff> -bg <output name>

Although I got this error below, the command line resulted a bg file (yes, with 5 columns)

When I repeated same command with the genome.sizes file instead of gff, I got this error

Genome (-g) files are ignored when BAM input is provided.

Working on Linux

1
Entering edit mode
7 weeks ago
Shiyi ▴ 10

Not sure if you problem is solved I think if you could try your approach on a hg38 or mm10 file and see if that work will be a good debug point It can validate if your problem is coming from your code or from the genome you are working on, or both (worst case)

0
Entering edit mode
7 weeks ago

Save yourself the trouble, and go directly from bam to bigwig with deeptools bamcoverage