Comments (4)
Hi,
It's sure that you can use ggcoverage
to visualize and annotate bacterial/viral genome coverage.
- For a basic coverage plot,
ggcoverage
requires:
- track data (bigwig/bam/..., use bam for SNV)
- metadata (can be
NULL
, generate pseudo-group use track.file)
-
Adding GC content annotation requires genome FASTA file to calculate GC content.
-
Adding gene annotation requires GTF file, and the gtf file should contain "seqnames", "start", "end", "strand", "type", "gene_name" columns and one of "gene_type", "gene_biotype". Example gtf file
-
Adding CNV annotation requires a file containing copy number results according to Genome-wide copy number analysis of single cells. You can provide a customed file with four columns: chr, position, bin value (point), copy number(line). Example cnv file
-
Adding SNV annotation requires bam file and genome FASTA file (reference base and aa).
Hope it helps,
YB
from ggcoverage.
This is actually something I'm looking to accomplish for plotting coverage of reads to a bacterial genome reference for one sample. From a very basic effort (as a novice), I've tried the following but am running into an error when I try to create a track dataframe from bam file.
S1_tracks = LoadTrackFile("../BaseSpace/Bacterialgenomes-402632365/FASTQ_Generation_2023-11-16_04_36_48Z-703830129/S1_bam/S1_sort.bam", track.folder = NULL, format = "bam", norm.method = "None", meta.info = sample.meta)
This generates the following error:
Calculate coverage with GenomicAlignments when norm.method is None!
Error in .io_bam(.scan_bamfile, file, reverseComplement, yieldSize(file), :
seqlevels(param) not in BAM header:
seqlevels: 'chr14'
file: ../BaseSpace/Bacterialgenomes-402632365/FASTQ_Generation_2023-11-16_04_36_48Z-703830129/S1_bam/S1_sort.bam
index: ../BaseSpace/Bacterialgenomes-402632365/FASTQ_Generation_2023-11-16_04_36_48Z-703830129/S1_bam/S1_sort.bam
I don't know where the 'chr14' is coming from particularly as my alignment is to a single bacterial genome.
Of note, here's my meta data file:
sample.meta
SampleName Type Group
1 S1 BAL Patient
Here's a text file of my session info.
session-info.txt
And here's the link to my sorted bam file: https://drive.google.com/file/d/1kf0oGu2h35F5wr2OwAse3OkoNWe5IVwb/view?usp=sharing
I'm sure this is something ridiculously simple, but I'm just not figuring it out.
Could you help me understand what the error is here?
from ggcoverage.
Hi, sorry for late reply, but now I looked into that issue. The problem is that the LoadTrackFile
function is currently quite inflexible. Many options are hardcoded towards human data.
To make your exmaple work, you need to specify the "region" argument and your samples in the meta data file need to correspond to the name of the BAM file. This example works for me:
library(ggcoverage)
library(dplyr)
sample.meta <- data.frame(
SampleName = "S1_sort",
Type = "BAL",
Group = "Patient"
)
# look for name of assembly/chromosomes in bam file
data = rtracklayer::import("~/Downloads/S1_sort.bam", format = "bam")
seqlevels(data)
# supply custom region
df_coverage = LoadTrackFile(
track.file = "~/Downloads/S1_sort.bam",
track.folder = NULL,
format = "bam",
norm.method = "None",
meta.info = sample.meta,
region = "NZ_CP065651.1:25,000-30,000"
)
# need to fix the end coordinate because binning is currently not
# working for non-normlaized data
df_coverage$end <- df_coverage$end + 1
ggcoverage(df_coverage, facet.key = "Type", group.key = "Group")
It shouldn't be that complicated, will try to fix this.
from ggcoverage.
Will be fixed with commit 8c537bb
from ggcoverage.
Related Issues (20)
- No output with geom.base() HOT 4
- Issue with `seqnames` when adding gene/transcript annotation HOT 6
- Getting installation error HOT 1
- Error in CeilingNumber(max(.x)) : object 'x.ceiling' not found HOT 5
- inconstistent behavior with colors for `geom_coverage` HOT 4
- formatting of scale range can be improved HOT 3
- Error in geom_rect() when running ggcoverage() examples HOT 6
- Error when running ggcoverage() examples HOT 16
- R CMD CHECK gives 3 warnings and 5 notes, could be fixed for BioC submission HOT 2
- `bin.size` parameter in `LoadTrackFile` has no effect when normalization is "none" HOT 2
- Column `seqnames` doesn't exist when adding geom_gene() HOT 2
- feature request: add github actions workflow for CI
- suggestion: reduce number of dependencies (currently 28) HOT 2
- suggestion: add alternative arrow style for gene and transcript annotation
- CRAN Release 1.4.0 HOT 4
- suggestion: all plotting functions should accept builtin R objects as data, not paths to local files
- any smooth parameter HOT 5
- Unable to install ggcoverage package on MacOS 14.4.1 HOT 2
- Suggestion: differential colors for different peaks based on score or other colunm in narrowPeak file HOT 7
- Docker/Apptainer for linux HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggcoverage.