func ChunkChrRange(chunksize int, assembly string, chromosome string, startPos, endPos int) ([]TabixLocus, error) {
	loci, err := chrPosSlice(assembly, chromosome, false)
	if err != nil {
		return nil, fmt.Errorf("SplitChrPos: %w", err)
	}

	output := make([]TabixLocus, 0)

	start := 0
	if chromosome != "" {
		start = startPos
	}

	for _, locus := range loci {

		end := int(locus.End())
		if chromosome != "" && endPos != 0 {
			end = endPos
		}

		for locationInChromosome := start; locationInChromosome < end; locationInChromosome += chunksize {

			endPoint := locationInChromosome + chunksize
			if chrEnd := int(locus.End()); endPoint > chrEnd {
				endPoint = chrEnd
			}

			output = append(output, MakeTabixLocus(
				locus.Chrom(),
				locationInChromosome,
				endPoint,
			))
		}
	}

	return output, err
}
// ChunkChrRange allows you to split genomic data into chunks of size chunksize.
// Valid values for assemply are grch37 and grch38. chromosome is optional; if
// set, will only process that chromosome. startPos and endPos are optional and
// require chromosome to be set. If nonzero, chunks will only be created within
// their limits.
ChunkChrRange allows you to split genomic data into chunks of size chunksize.
Valid values for assemply are grch37 and grch38. chromosome is optional; if
set, will only process that chromosome. startPos and endPos are optional and
require chromosome to be set. If nonzero, chunks will only be created within
their limits.
// ChunkChrRange allows you to split genomic data into chunks of size chunksize . // Valid values for assemply are grch37 and grch38 . chromosome is optional ; if // set will only process that chromosome . startPos and endPos are optional and // require chromosome to be set . If nonzero chunks will only be created within // their limits .
func ChunkChrRange(chunksize int, assembly string, chromosome string, startPos, endPos int) ([]TabixLocus, error) {
	loci, err := chrPosSlice(assembly, chromosome, false)
	if err != nil {
		return nil, fmt.Errorf("SplitChrPos: %w", err)
	}
	output := make([]TabixLocus, 0)
	start := 0
	if chromosome != "" {
		start = startPos
	}
	for _, locus := range loci {
		end := int(locus.End())
		if chromosome != "" && endPos != 0 {
			end = endPos
		}
		for locationInChromosome := start; locationInChromosome < end; locationInChromosome += chunksize {
			endPoint := locationInChromosome + chunksize
			if chrEnd := int(locus.End()); endPoint > chrEnd {
				endPoint = chrEnd
			}
			output = append(output, MakeTabixLocus(
				locus.Chrom(),
				locationInChromosome,
				endPoint,
			))
		}
	}
	return output, err
}
func ChunkChrRange ( chunksize int , assembly string , chromosome string , startPos , endPos int ) ( [ ] TabixLocus , error ) { loci , err := chrPosSlice ( assembly , chromosome , false ) if err != nil { return nil , fmt . Errorf ( " " , err ) } output := make ( [ ] TabixLocus , 0 ) start := 0 if chromosome != " " { start = startPos } for _ , locus := range loci { end := int ( locus . End ( ) ) if chromosome != " " && endPos != 0 { end = endPos } for locationInChromosome := start ; locationInChromosome < end ; locationInChromosome += chunksize { endPoint := locationInChromosome + chunksize if chrEnd := int ( locus . End ( ) ) ; endPoint > chrEnd { endPoint = chrEnd } output = append ( output , MakeTabixLocus ( locus . Chrom ( ) , locationInChromosome , endPoint , ) ) } } return output , err }
ChunkChrRange allows you to split genomic data into chunks of size chunksize.
ChunkChrRange allows you to split genomic data into chunks of size chunksize .