Пример #1
0
func FIBD(filePath string) string {

	data := bio.SequenceFromRosalindFile(filePath)

	inputs := strings.Split(strings.Replace(data, "\n", "", -1), " ")

	n, err := strconv.Atoi(inputs[0])
	if err != nil {
		// handle error
		fmt.Println(err)
		os.Exit(2)
	}

	k, err := strconv.Atoi(inputs[1])
	if err != nil {
		// handle error
		fmt.Println(err)
		os.Exit(2)
	}

	got := fmt.Sprintf("%d %d : %d\n", n, k, bio.Fibonaccid(n, k))

	return got

}
Пример #2
0
func PROT(filePath string) string {

	data := bio.SequenceFromRosalindFile(filePath)

	sequence := strings.Replace(data, "\n", "", -1)

	return bio.RNAtoPROTEIN(sequence)

}
Пример #3
0
func SUBS(filePath string) string {

	data := strings.Split(bio.SequenceFromRosalindFile(filePath), "\n")

	sequence := strings.Join(data[:len(data)-2], "")
	fragment := data[len(data)-2]

	indices := bio.Motifs(sequence, fragment)
	got := ""
	for i, value := range indices {
		got = got + fmt.Sprintf("%d", value+1)
		if i < len(indices)-1 {
			got = got + " "
		}
	}

	return got

}
Пример #4
0
func CONS(filePath string) string {

	fastaData := bio.SequenceFromRosalindFile(filePath)
	got := bio.Consensus(fastaData)
	return got
}