Example #1
0
File: Rosalind.go Project: roca/GO
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

}
Example #2
0
File: Rosalind.go Project: roca/GO
func PROT(filePath string) string {

	data := bio.SequenceFromRosalindFile(filePath)

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

	return bio.RNAtoPROTEIN(sequence)

}
Example #3
0
File: Rosalind.go Project: roca/GO
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

}
Example #4
0
File: Rosalind.go Project: roca/GO
func CONS(filePath string) string {

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