Hi there! I am very new in this field and learning bit by bit. really appreciate your help! I am trying to normalize a set of RNA-seq data chromsome by chromsome in my case. Before normalisation, I just want to plot coverage on individual chromosomes. Here is my code from bioconductor:
>library(GenomicAlignments) >library(Rsamtools) >library(ggplot2) >elution_wt1 <- "/Users/berkyurekahmetcan/Dropbox (ericmiskalab)/cambridge-UK/NGS/piChIP/smallRNA/elution/wt1/elution_wt1_22Gs_dedup.bam" ## Coverage of a GAlignments object: >elution_wt1_gal <- readGAlignments(elution_wt1) >elution_wt1_cvg <- coverage(elution_wt1_gal) >elution_wt1_cvg >elution_wt2 <- "/Users/berkyurekahmetcan/Dropbox (ericmiskalab)/cambridge-UK/NGS/piChIP/smallRNA/elution/wt2/elution_wt2_22Gs_dedup.bam" ## Coverage of a GAlignments object: >elution_wt2_gal <- readGAlignments(elution_wt1) >elution_wt2_cvg <- coverage(elution_wt1_gal) >elution_wt2_cvg >elution_wt3 <- "/Users/berkyurekahmetcan/Dropbox (ericmiskalab)/cambridge-UK/NGS/piChIP/smallRNA/elution/wt3/elution_wt3_22Gs_dedup.bam" ## Coverage of a GAlignments object: >elution_wt3_gal <- readGAlignments(elution_wt1) >elution_wt3_cvg <- coverage(elution_wt1_gal) >elution_wt3_cvg >vctr1 <- as.vector(elution_wt1_cvg[]) >vctr2 <- as.vector(elution_wt2_cvg[]) >vctr3 <- as.vector(elution_wt3_cvg[]) #[] corresponds to the piRNAsensor, which is an extrachromosomal addition! >wt1 = as.data.frame(vctr1) >wt2 = as.data.frame(vctr2) >wt3 = as.data.frame(vctr3) >x = 1:1663 >y = wt1[,1] >coverage = data.frame(x,y) >p = ggplot(coverage) + aes(color = "red") + labs(title = 'elution_wt1', x = 'bps (piRNAsensor)', y = 'Coverage') + scale_x_continuous(scale_fill_grey(start = 1, end = 1663, na.value = "red")) + scale_y_continuous(limits=c(0, 10)) >ggsave("wt1.pdf",p)
When I run this script, I get an error as:
> source('~/Dropbox (ericmiskalab)/cambridge-UK/NGS/piChIP/smallRNA/coverage.R') > p Error in as.vector(x, "character") : cannot coerce type 'environment' to vector of type 'character'
I would really appreciate your help in this case. Is there any problem with my code? How can I resolve this issue?