dartR doesn't have a function to plot SNP density along chromosomes, we will add it to our to-do list and should be available in next release of dartR hopefully in the next few weeks.
In the meantime, you can create an input file for bedtools using the code below.
# the system used by the BED format is zero-based for the coordinate start and
# one-based for the coordinate end. Thus, the nucleotide with the coordinate 1 in
# a genome will have a value of 0 in column 2 and a value of 1 in column 3.
# A thousand-base BED interval with the following start and end:
# chr7 0 1000
library(dartR)
t1 <-
platypus.glt1 <- gl.filter.callrate(t1,threshold = 1)
# keeping just the loci that were mapped to chromosomes or contigs using
# BLAST alignment E-value
t1 <- gl.filter.locmetric(
t1,
metric = "AlnEvalue_Platypus_Chrom_NCBIv1",
lower = min(t1$other$loc.metrics$AlnEvalue_Platypus_Chrom_NCBIv1),
upper = 1e-20
)
#assigning chromosome and snp position
t1$chromosome <- as.factor(t1$other$loc.metrics$Chrom_Platypus_Chrom_NCBIv1)
t1$position <- t1$other$loc.metrics$ChromPos_Platypus_Chrom_NCBIv1
t1$other$loc.metrics[30:41,]
bed <- cbind(as.character(t1$chromosome), (t1$position - 1), t1$position)
# writing bed file
write.table(
bed,
file = "test.bed",
col.names = FALSE,
row.names = FALSE,
quote = FALSE,
sep = "\t"
)