func parseLocus(locusString string) Locus {
	locus := Locus{}

	basePairRegex, _ := regexp.Compile(` \d* \w{2} `)
	circularRegex, _ := regexp.Compile(` circular `)
	linearRegex, _ := regexp.Compile(` linear `)

	ModificationDateRegex, _ := regexp.Compile(`\d{2}-[A-Z]{3}-\d{4}`)

	locusSplit := strings.Split(strings.TrimSpace(locusString), " ")

	var filteredLocusSplit []string
	for i := range locusSplit {
		if locusSplit[i] != "" {
			filteredLocusSplit = append(filteredLocusSplit, locusSplit[i])
		}
	}

	locus.Name = filteredLocusSplit[1]

	// sequence length and coding
	baseSequenceLength := string(basePairRegex.FindString(locusString))
	if baseSequenceLength != "" {
		splitBaseSequenceLength := strings.Split(strings.TrimSpace(baseSequenceLength), " ")
		if len(splitBaseSequenceLength) == 2 {
			locus.SequenceLength = splitBaseSequenceLength[0]
			locus.SequenceCoding = splitBaseSequenceLength[1]
		}
	}

	// molecule type
	for _, moleculeType := range genBankMoleculeTypes {
		moleculeRegex, _ := regexp.Compile(moleculeType)
		match := string(moleculeRegex.Find([]byte(locusString)))
		if match != "" {
			locus.MoleculeType = match
			break
		}
	}

	// circularity flag
	if circularRegex.Match([]byte(locusString)) {
		locus.Circular = true
	}

	if linearRegex.Match([]byte(locusString)) {
		locus.Linear = true
	}

	// genbank division
	for _, genbankDivision := range genbankDivisions {
		genbankDivisionRegex, _ := regexp.Compile(genbankDivision)
		match := string(genbankDivisionRegex.Find([]byte(locusString)))
		if match != "" {
			locus.GenbankDivision = match
			break
		}
	}

	// ModificationDate
	locus.ModificationDate = ModificationDateRegex.FindString(locusString)

	return locus
}
// parses locus from provided string.
parses locus from provided string.
// parses locus from provided string .
func parseLocus(locusString string) Locus {
	locus := Locus{}
	basePairRegex, _ := regexp.Compile(` \d* \w{2} `)
	circularRegex, _ := regexp.Compile(` circular `)
	linearRegex, _ := regexp.Compile(` linear `)
	ModificationDateRegex, _ := regexp.Compile(`\d{2}-[A-Z]{3}-\d{4}`)
	locusSplit := strings.Split(strings.TrimSpace(locusString), " ")
	var filteredLocusSplit []string
	for i := range locusSplit {
		if locusSplit[i] != "" {
			filteredLocusSplit = append(filteredLocusSplit, locusSplit[i])
		}
	}
	locus.Name = filteredLocusSplit[1]
	baseSequenceLength := string(basePairRegex.FindString(locusString))
	if baseSequenceLength != "" {
		splitBaseSequenceLength := strings.Split(strings.TrimSpace(baseSequenceLength), " ")
		if len(splitBaseSequenceLength) == 2 {
			locus.SequenceLength = splitBaseSequenceLength[0]
			locus.SequenceCoding = splitBaseSequenceLength[1]
		}
	}
	for _, moleculeType := range genBankMoleculeTypes {
		moleculeRegex, _ := regexp.Compile(moleculeType)
		match := string(moleculeRegex.Find([]byte(locusString)))
		if match != "" {
			locus.MoleculeType = match
			break
		}
	}
	if circularRegex.Match([]byte(locusString)) {
		locus.Circular = true
	}
	if linearRegex.Match([]byte(locusString)) {
		locus.Linear = true
	}
	for _, genbankDivision := range genbankDivisions {
		genbankDivisionRegex, _ := regexp.Compile(genbankDivision)
		match := string(genbankDivisionRegex.Find([]byte(locusString)))
		if match != "" {
			locus.GenbankDivision = match
			break
		}
	}
	locus.ModificationDate = ModificationDateRegex.FindString(locusString)
	return locus
}
func parseLocus ( locusString string ) Locus { locus := Locus { } basePairRegex , _ := regexp . Compile ( ` \d* \w{2} ` ) circularRegex , _ := regexp . Compile ( ` circular ` ) linearRegex , _ := regexp . Compile ( ` linear ` ) ModificationDateRegex , _ := regexp . Compile ( `\d{2}-[A-Z]{3}-\d{4}` ) locusSplit := strings . Split ( strings . TrimSpace ( locusString ) , " " ) var filteredLocusSplit [ ] string for i := range locusSplit { if locusSplit [ i ] != " " { filteredLocusSplit = append ( filteredLocusSplit , locusSplit [ i ] ) } } locus . Name = filteredLocusSplit [ 1 ] baseSequenceLength := string ( basePairRegex . FindString ( locusString ) ) if baseSequenceLength != " " { splitBaseSequenceLength := strings . Split ( strings . TrimSpace ( baseSequenceLength ) , " " ) if len ( splitBaseSequenceLength ) == 2 { locus . SequenceLength = splitBaseSequenceLength [ 0 ] locus . SequenceCoding = splitBaseSequenceLength [ 1 ] } } for _ , moleculeType := range genBankMoleculeTypes { moleculeRegex , _ := regexp . Compile ( moleculeType ) match := string ( moleculeRegex . Find ( [ ] byte ( locusString ) ) ) if match != " " { locus . MoleculeType = match break } } if circularRegex . Match ( [ ] byte ( locusString ) ) { locus . Circular = true } if linearRegex . Match ( [ ] byte ( locusString ) ) { locus . Linear = true } for _ , genbankDivision := range genbankDivisions { genbankDivisionRegex , _ := regexp . Compile ( genbankDivision ) match := string ( genbankDivisionRegex . Find ( [ ] byte ( locusString ) ) ) if match != " " { locus . GenbankDivision = match break } } locus . ModificationDate = ModificationDateRegex . FindString ( locusString ) return locus }
parses locus from provided string.
parses locus from provided string .
// sequence length and coding // molecule type // circularity flag // genbank division // ModificationDate