genomation
genomation copied to clipboard
Issue with annotateWithFeatures
I am running into an error when running annotateWithFeatures, I have attached the code run and the error. I have verified that the gff file I use matches the file used for alignment. I believe the issue however still might be a mismatch between the methylation object and the gff, so I have attached the head() output here as well. I have also run the code using a bed file with annotateWithGeneParts however there I received a different error. Does anyone happen to know what could be causing this issue?
CODE:
Reading methylation data
`library(methylKit) library(genomation) library(GenomicRanges) library(rtracklayer) # for reading GFF files
file.list <- list( "D:/bismark/SF-1F_Liver_S67_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov", "D:/bismark/SF-2F_Liver_S73_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov", "D:/bismark/SF-3F_Liver_S79_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov", "D:/bismark/SF-4F_Liver_S85_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov", "D:/bismark/SF-5F_Liver_S90_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov", "D:/bismark/SF-6F_Liver_S95_R1_001_val_1_bismark_bt2_pe.deduplicated.bismark.cov" )
myobj <- methRead(file.list, sample.id=list("SF_Liver_1", "SF_Liver_2", "SF_Liver_3", "SF_Liver_4", "SF_Liver_5", "SF_Liver_6"), pipeline="bismarkCoverage", assembly="GCF_023375975.1", # genome assembly number for Astyanax treatment=c(1,1,1,0,0,0), mincov=1 )
myobj.filt <- filterByCoverage(myobj, lo.count=1, lo.perc=NULL, hi.count=NULL, hi.perc=99.9)
meth <- unite(myobj.filt, destrand=FALSE)
read gff file and prepare GRanges
na.omit(meth) #bed = readTranscriptFeatures("C:/Users/marcf/Downloads/BedTest.bed/BedTest.bed",remove.unusual=FALSE) #head(bed)
gff = gffToGRanges("D:/bismark/GCF_023375975.1_AstMex3_surface_genomic.gff")
head(gff)
split = as(split(gff, gff$type), "GRangesList")
methGrange <- as(meth, "GRanges")
head(split) head(methGrange)
annotateWithFeatures and processing
annotated_meth <- annotateWithFeatures(methGrange, split)
dm_genes <- as.data.frame(annotated_meth$gene.obj)
write.csv(dm_genes, file="methylated_genes_in_liver.csv", row.names=FALSE)
plotTargetAnnotation(annotated_meth, main="Methylation Annotation to Gene Regions", precedence=TRUE)
myDiff <- calculateDiffMeth(meth, covariates=NULL)
dmr_annotated <- annotateWithGeneParts(as(myDiff, "GRanges"), split)
dmr_genes <- as.data.frame(dmr_annotated$gene.obj)
write.csv(dmr_genes, file="dmr_genes_in_liver.csv", row.names=FALSE)`
ERROR:
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'as.matrix': Item 1 of j is 2 which is outside the column number range [1,ncol=1] In addition: Warning message: In .merge_two_Seqinfo_objects(x, y) : The 2 combined objects have no sequence levels in common. (Use suppressWarnings() to suppress this warning.)
HEAD GFF:
seqnames ranges strand | source type score phase ID Dbxref Name chromosome
<Rle> <IRanges> <Rle> |
HEAD METHYLATION OBJECT:
seqnames ranges strand | score name
<Rle> <IRanges> <Rle> |