# Generate 10 random contigs of sizes comprised between 100 and 10000:
my.contig <- DNAStringSet(
sapply(
sample(c(100:10000), 10),
function(size)
paste(sample(DNA_BASES, size, replace=TRUE), collapse="")
)
)
# Get their sizes:
my.size <- width(my.contig)
# Calculate the N50 value of this set of contigs:
my.contig.N50 <- N50(my.size)
Run the code above in your browser using DataLab