Coder Social home page Coder Social logo

Comments (4)

showteeth avatar showteeth commented on August 17, 2024

Hi,
It's sure that you can use ggcoverage to visualize and annotate bacterial/viral genome coverage.

  1. For a basic coverage plot, ggcoverage requires:
  1. Adding GC content annotation requires genome FASTA file to calculate GC content.

  2. 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

  3. 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

  4. Adding SNV annotation requires bam file and genome FASTA file (reference base and aa).

Hope it helps,

YB

from ggcoverage.

AceM1188 avatar AceM1188 commented on August 17, 2024

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.

m-jahn avatar m-jahn commented on August 17, 2024

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")

image

It shouldn't be that complicated, will try to fix this.

from ggcoverage.

m-jahn avatar m-jahn commented on August 17, 2024

Will be fixed with commit 8c537bb

from ggcoverage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.