Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kpAddCytobandLabels with custom genome and cytoband file fails #147

Open
pkerbs opened this issue Feb 14, 2024 · 2 comments
Open

kpAddCytobandLabels with custom genome and cytoband file fails #147

pkerbs opened this issue Feb 14, 2024 · 2 comments

Comments

@pkerbs
Copy link

pkerbs commented Feb 14, 2024

Hi,
I am trying to plot Cytoband labels on the ideogram.
It works if I use the default hg19 genome, but not when I use my own genome region and cytoband files.
This is my code:

cyto_bed <- read.delim("cytobands_chm13v2.bed", header=T)
cyto_bed <- makeGRangesFromDataFrame(cyto_bed, keep.extra.columns = T)

genome <- read.delim("chm13v2.bed", header=T)
genome <- makeGRangesFromDataFrame(genome, keep.extra.columns = T)

kp <- plotKaryotype(plot.type = 1,
                      chromosomes = "chr1",
                      genome = genome,
                      cytobands = cyto_bed
                      )

kpAddCytobandLabels(kp, force.all=F, cex=0.6, srt=90, col="orange")

This is an excerpt from chm13v2.bed:

chrom	chromStart	chromEnd
chr1	0	248387328
chr2	0	242696752
chr3	0	201105948
chr4	0	193574945

This is an excerpt from cytobands_chm13v2.bed:

chrom	chromStart	chromEnd	name	gieStain	strand
chr1	0	1735965	p36.33	gneg	.
chr1	1735965	4816989	p36.32	gpos25	.
chr1	4816989	6629068	p36.31	gneg	.
chr1	6629068	8634052	p36.23	gpos25	.

Unfortunately, I get this error message:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'start': subscript contains invalid names

Can you please have a look what I'm doing wrong?
Will it be possible to just set the genome parameter in the plotKaryotype function to the new assembly, so I dont have to provide genome range and cytoband file?

Thanks in advance,
Paul

@kerbspaul
Copy link

Hi,
can anyone please help out?

@pkerbs
Copy link
Author

pkerbs commented May 13, 2024

For anyone who is facing the same issue:
The problem seems to be that I only want to plot "chr1" but I provide 'genome' and 'cytoband ' GRanges objects containing all chromosomes. The parameter chromosomes of the plotKaryotype() function seems not to work with my custom references that I provide to the function (probably some specific formatting is needed that I'm missing).

Anyways, I figured that when I subset the GRanges objects to only "chr1" it works.

kp <- plotKaryotype(plot.type = 1,
                      chromosomes = "chr1",
                      genome = genome[genome@seqnames=="chr1",],
                      cytobands = cytobands[cytobands@seqnames=="chr1",]
                      )

Best,
Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants