-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
executable file
·816 lines (707 loc) · 20 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
"github.com/spf13/cobra"
)
/*
Author Gaurav Sablok
Universitat Potsdam
Date 2024-9-18
A complete Golang package for phylogenomics. It deals with all the alignment and phylogenomics.
*/
func main() {
if err := rootCmd.Execute(); err != nil {
log.Fatal(err)
}
}
var (
alignment string
title string
start int
end int
upstream int
downstream int
)
var rootCmd = &cobra.Command{
Use: "flags",
Long: "This is a complete alignmentGo package for the phylogenomics and whole genome alignment",
}
var unifiedCmd = &cobra.Command{
Use: "unified",
Long: "This estimates the site proportion in your whole genome or gene specific alignment",
Run: unifiedRun,
}
var mergeCmd = &cobra.Command{
Use: "merge",
Long: "This merges all the alignment and gives the alignment ID header you have specified",
Run: alignmentMerge,
}
var estimateCmd = &cobra.Command{
Use: "estimate",
Long: "This estimates the site by site alignment estimates across the alignment and it takes the first genome as a reference for the estimation of the site variablitiy",
Run: alignmentEstimate,
}
var conservationCmd = &cobra.Command{
Use: "conservation",
Long: "This estimates the conversation score across the alignment and then estimates the conversation score across all the sites",
Run: conservationEstimate,
}
var filterCmd = &cobra.Command{
Use: "filter",
Long: "This is used to filter the sequences filter the sequences of a given alignment",
Run: removeFunc,
}
var specificCmd = &cobra.Command{
Use: "specifcblock",
Long: "This estimates the site proportion in your whole genome or gene specific alignment",
Run: blockFunc,
}
var proportionCmd = &cobra.Command{
Use: "proportion",
Long: "This esimates the proportion of the site conservation",
Run: proportionFunc,
}
var eDNACmd = &cobra.Command{
Use: "eDNA",
Long: "This extacts the upstream and the downstream of the given alignment block with the block includes and also the block excluded",
Run: eDNAFunc,
}
func init() {
unifiedCmd.Flags().StringVarP(&alignment, "alignmentfile", "a", "align", "a alignment file")
mergeCmd.Flags().StringVarP(&alignment, "alignmentfile", "A", "align", "a alignment file")
mergeCmd.Flags().StringVarP(&title, "title", "T", "title for the alignment", "alignment title")
estimateCmd.Flags().
StringVarP(&alignment, "title", "a", "alignment file", "alignment file for the estimate")
conservationCmd.Flags().
StringVarP(&alignment, "alignmentfile", "a", "alignment file convservation score", "alignment to be analyzed")
filterCmd.Flags().
StringVarP(&alignment, "alignmentfile", "a", "alignment file for filter", "alignment to be filtered")
specificCmd.Flags().StringVarP(&alignment, "alignmentfile", "a", "align", "a alignment file")
specificCmd.Flags().IntVarP(&start, "startcoordinate", "s", 1, "start of the alignment block")
specificCmd.Flags().IntVarP(&end, "endcoordinate", "e", 40, "end of the alignment block")
proportionCmd.Flags().StringVarP(&alignment, "alignmentfile", "a", "align", "a alignment file")
eDNACmd.Flags().StringVarP(&alignment, "alignmentfile", "a", "align", "a alignment file")
eDNACmd.Flags().IntVarP(&start, "startcoordinate", "s", 1, "start of the alignment block")
eDNACmd.Flags().IntVarP(&end, "endcoordinate", "e", 40, "end of the alignment block")
eDNACmd.Flags().IntVarP(&upstream, "upstream-alignment", "u", 4, "upstream of the alignment")
eDNACmd.Flags().
IntVarP(&downstream, "downstream-alignment", "d", 4, "downstream of the alignment")
rootCmd.AddCommand(unifiedCmd)
rootCmd.AddCommand(mergeCmd)
rootCmd.AddCommand(estimateCmd)
rootCmd.AddCommand(conservationCmd)
rootCmd.AddCommand(filterCmd)
rootCmd.AddCommand(specificCmd)
rootCmd.AddCommand(proportionCmd)
rootCmd.AddCommand(eDNACmd)
}
func unifiedRun(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignIDcapture := []alignmentID{}
alignSeqcapture := []alignmentSeq{}
sequenceCap := []string{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignIDcapture = append(alignIDcapture, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignSeqcapture = append(alignSeqcapture, alignmentSeq{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceCap = append(sequenceCap, string(line))
}
}
counterA := 0
counterT := 0
counterG := 0
counterC := 0
counterAsite := []int{}
counterTsite := []int{}
counterGsite := []int{}
counterCsite := []int{}
for i := 0; i < len(sequenceCap)-1; i++ {
for j := 0; j < len(sequenceCap[0]); j++ {
if string(sequenceCap[i][j]) == "A" && string(sequenceCap[i+1][j]) == "A" {
counterA++
counterAsite = append(counterAsite, j)
}
if string(sequenceCap[i][j]) == "T" && string(sequenceCap[i+1][j]) == "T" {
counterT++
counterTsite = append(counterTsite, j)
}
if string(sequenceCap[i][j]) == "G" && string(sequenceCap[i+1][j]) == "G" {
counterG++
counterGsite = append(counterGsite, j)
}
if string(sequenceCap[i][j]) == "C" && string(sequenceCap[i+1][j]) == "C" {
counterC++
counterCsite = append(counterCsite, j)
}
}
}
fmt.Printf(
"The alignment counts for the A unified bases to the rest of the same sites in the block are: %d",
counterA,
)
fmt.Printf(
"The alignment counts for the T unified bases to the rest of the same sites in the block are: %d",
counterT,
)
fmt.Printf(
"The alignment counts for the G unified bases to the rest of the same sites in the block are: %d",
counterG,
)
fmt.Printf(
"The alignment counts for the C unified bases to the rest of the same sites in the block are: %d",
counterC,
)
for i := range counterAsite {
fmt.Printf("The A sites are %d\n", counterAsite[i])
}
for i := range counterTsite {
fmt.Printf("The T sites are %d", counterTsite[i])
}
for i := range counterGsite {
fmt.Printf("The G sites are %d", counterGsite[i])
}
for i := range counterCsite {
fmt.Printf("The C sites are %d", counterCsite[i])
}
}
func alignmentMerge(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
type alignmentFilterID struct {
id string
}
type alignmentFilterSeq struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
fRead := bufio.NewScanner(fOpen)
alignmentReadID := []alignmentID{}
alignmentReadSeq := []alignmentSeq{}
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignmentReadID = append(alignmentReadID, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignmentReadSeq = append(alignmentReadSeq, alignmentSeq{
seq: string(line),
})
}
}
var seqKeep string
for b := range alignmentReadSeq {
for j := range alignmentReadSeq[b].seq {
seqKeep += string(alignmentReadSeq[b].seq[j])
}
}
fmt.Println(">", title, "\n", seqKeep)
}
func alignmentEstimate(cmd *cobra.Command, args []string) {
type alignmentIDStore struct {
id string
}
type alignmentSeqStore struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignmentID := []alignmentIDStore{}
alignmentSeq := []alignmentSeqStore{}
sequenceSpec := []string{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignmentID = append(alignmentID, alignmentIDStore{
id: strings.Replace(string(line), ">", "", -1),
})
}
if !strings.HasPrefix(string(line), ">") {
alignmentSeq = append(alignmentSeq, alignmentSeqStore{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceSpec = append(sequenceSpec, string(line))
}
}
counterAT := 0
counterAG := 0
counterAC := 0
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if string(sequenceSpec[i][j]) == "A" && string(sequenceSpec[i+1][j]) == "T" {
counterAT++
}
if string(sequenceSpec[i][j]) == "A" && string(sequenceSpec[i+1][j]) == "C" {
counterAG++
}
if string(sequenceSpec[i][j]) == "A" && string(sequenceSpec[i+1][j]) == "G" {
counterAC++
}
}
}
counterTG := 0
counterTC := 0
counterTA := 0
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if string(sequenceSpec[i][j]) == "T" && string(sequenceSpec[i+1][j]) == "G" {
counterTA++
}
if string(sequenceSpec[i][j]) == "T" && string(sequenceSpec[i+1][j]) == "C" {
counterTC++
}
if string(sequenceSpec[i][j]) == "T" && string(sequenceSpec[i+1][j]) == "A" {
counterTA++
}
}
}
counterGC := 0
counterGA := 0
counterGT := 0
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if string(sequenceSpec[i][j]) == "G" && string(sequenceSpec[i+1][j]) == "C" {
counterGC++
}
if string(sequenceSpec[i][j]) == "G" && string(sequenceSpec[i+1][j]) == "A" {
counterGA++
}
if string(sequenceSpec[i][j]) == "G" && string(sequenceSpec[i+1][j]) == "T" {
counterGT++
}
}
}
counterCA := 0
counterCT := 0
counterCG := 0
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if string(sequenceSpec[i][j]) == "C" && string(sequenceSpec[i+1][j]) == "A" {
counterCA++
}
if string(sequenceSpec[i][j]) == "C" && string(sequenceSpec[i+1][j]) == "T" {
counterCT++
}
if string(sequenceSpec[i][j]) == "C" && string(sequenceSpec[i+1][j]) == "G" {
counterCG++
}
}
}
fmt.Printf(
"The collinearity block for A as a base pattern and T as a mismatch is %d\n", counterAT)
fmt.Printf("The collinearity block for A as a base pattern G as a mismatch is %d", counterAG)
fmt.Printf(
"The collinearity block for A as a base pattern and C as a mismatch is %d",
counterAC,
)
fmt.Printf(
"The collinearity block for T as a base pattern and G as a mismatch is %d",
counterTG,
)
fmt.Printf("The collinearity block for T as a base pattern C as a mismatch is %d", counterTC)
fmt.Printf(
"The collinearity block for T as a base pattern and A as a mismatch is %d",
counterTA,
)
fmt.Printf(
"The collinearity block for G as a base pattern and C as a mismatch is %d",
counterGC,
)
fmt.Printf("The collinearity block for G as a base pattern A as a mismatch is %d", counterGA)
fmt.Printf(
"The collinearity block for G as a base pattern and T as a mismatch is %d",
counterGT,
)
fmt.Printf(
"The collinearity block for C as a base pattern and A as a mismatch is %d",
counterCA,
)
fmt.Printf("The collinearity block for C as a base pattern T as a mismatch is %d", counterCT)
fmt.Printf(
"The collinearity block for C as a base pattern and G as a mismatch is %d",
counterCG,
)
}
func conservationEstimate(cmd *cobra.Command, args []string) {
type alignmentIDStore struct {
id string
}
type alignmentSeqStore struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignmentID := []alignmentIDStore{}
alignmentSeq := []alignmentSeqStore{}
sequenceSpec := []string{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignmentID = append(alignmentID, alignmentIDStore{
id: strings.Replace(string(line), ">", "", -1),
})
}
if !strings.HasPrefix(string(line), ">") {
alignmentSeq = append(alignmentSeq, alignmentSeqStore{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceSpec = append(sequenceSpec, string(line))
}
}
alignmentMatrixMatch := []string{}
alignmentMatrixMisMatch := []string{}
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if sequenceSpec[i][j] != sequenceSpec[i+1][j] {
alignmentMatrixMatch = append(alignmentMatrixMatch, string(sequenceSpec[i][j]))
}
}
}
for i := 0; i < len(sequenceSpec)-1; i++ {
for j := 0; j < len(sequenceSpec[0]); j++ {
if sequenceSpec[i][j] == sequenceSpec[i+1][j] {
alignmentMatrixMisMatch = append(
alignmentMatrixMisMatch,
string(sequenceSpec[i][j]),
)
}
}
}
fmt.Printf(
"The number of the matches across the alignments blocks are: %d",
len(alignmentMatrixMatch),
)
fmt.Printf(
"The number of the mismatches across the alignments blocks are: %d",
len(alignmentMatrixMisMatch),
)
add := len(sequenceSpec[0]) / len(alignmentMatrixMatch)
fmt.Println(add)
fmt.Printf("The sequence conservation score for the matrix alignment is: %d", add)
}
func removeFunc(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
type alignmentFilterID struct {
id string
}
type alignmentFilterSeq struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
fRead := bufio.NewScanner(fOpen)
alignmentReadID := []alignmentID{}
alignmentReadSeq := []alignmentSeq{}
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignmentReadID = append(alignmentReadID, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignmentReadSeq = append(alignmentReadSeq, alignmentSeq{
seq: string(line),
})
}
}
var seqFilter string
for i := range alignmentReadSeq {
for j := range alignmentReadSeq[i].seq {
if string(alignmentReadSeq[i].seq[j]) == "-" {
continue
} else {
seqFilter += string(alignmentReadSeq[i].seq[j])
}
}
}
fmt.Println(">", title, "\n", seqFilter)
}
func blockFunc(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
type alignBlock struct {
id string
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignIDcapture := []alignmentID{}
alignSeqcapture := []alignmentSeq{}
sequenceCap := []string{}
sequenceID := []string{}
alignmentBlock := []alignBlock{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignIDcapture = append(alignIDcapture, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignSeqcapture = append(alignSeqcapture, alignmentSeq{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceCap = append(sequenceCap, string(line))
}
if strings.HasPrefix(string(line), ">") {
sequenceID = append(sequenceID, string(line))
}
}
for i := 0; i < len(sequenceID); i++ {
alignmentBlock = append(alignmentBlock, alignBlock{
id: string((sequenceID[i])),
seq: string((sequenceCap[i][start:end])),
})
}
for i := range alignmentBlock {
fmt.Println(alignmentBlock[i].id, "\t", alignmentBlock[i].seq)
}
}
func proportionFunc(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignIDcapture := []alignmentID{}
alignSeqcapture := []alignmentSeq{}
sequenceCap := []string{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignIDcapture = append(alignIDcapture, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignSeqcapture = append(alignSeqcapture, alignmentSeq{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceCap = append(sequenceCap, string(line))
}
}
counterA := 0
counterT := 0
counterG := 0
counterC := 0
counterAsite := []int{}
counterTsite := []int{}
counterGsite := []int{}
counterCsite := []int{}
for i := 0; i < len(sequenceCap)-1; i++ {
for j := 0; j < len(sequenceCap[0]); j++ {
if string(sequenceCap[i][j]) == "A" && string(sequenceCap[i+1][j]) == "A" {
counterA++
counterAsite = append(counterAsite, j)
}
if string(sequenceCap[i][j]) == "T" && string(sequenceCap[i+1][j]) == "T" {
counterT++
counterTsite = append(counterTsite, j)
}
if string(sequenceCap[i][j]) == "G" && string(sequenceCap[i+1][j]) == "G" {
counterG++
counterGsite = append(counterGsite, j)
}
if string(sequenceCap[i][j]) == "C" && string(sequenceCap[i+1][j]) == "C" {
counterC++
counterCsite = append(counterCsite, j)
}
}
}
fmt.Printf(
"The alignment counts for the A unified bases to the rest of the same sites in the block are: %d",
counterA,
)
fmt.Printf(
"The alignment counts for the T unified bases to the rest of the same sites in the block are: %d",
counterT,
)
fmt.Printf(
"The alignment counts for the G unified bases to the rest of the same sites in the block are: %d",
counterG,
)
fmt.Printf(
"The alignment counts for the C unified bases to the rest of the same sites in the block are: %d",
counterC,
)
for i := range counterAsite {
fmt.Printf("The A sites are %d", counterAsite[i])
}
for i := range counterTsite {
fmt.Printf("The T sites are %d", counterTsite[i])
}
for i := range counterGsite {
fmt.Printf("The G sites are %d", counterGsite[i])
}
for i := range counterCsite {
fmt.Printf("The C sites are %d", counterCsite[i])
}
}
func eDNAFunc(cmd *cobra.Command, args []string) {
type alignmentID struct {
id string
}
type alignmentSeq struct {
seq string
}
type alignBlock struct {
id string
seq string
}
type updownStream struct {
id string
seq string
}
type upstreamStart struct {
id string
seq string
}
type downstreamStart struct {
id string
seq string
}
fOpen, err := os.Open(alignment)
if err != nil {
log.Fatal(err)
}
alignIDcapture := []alignmentID{}
alignSeqcapture := []alignmentSeq{}
sequenceCap := []string{}
sequenceID := []string{}
alignmentBlock := []alignBlock{}
upstreamBlock := []updownStream{}
upstreamfinal := start - upstream
downstreamfinal := end + downstream
upstreamS := []upstreamStart{}
downstreamS := []downstreamStart{}
fRead := bufio.NewScanner(fOpen)
for fRead.Scan() {
line := fRead.Text()
if strings.HasPrefix(string(line), ">") {
alignIDcapture = append(alignIDcapture, alignmentID{
id: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
alignSeqcapture = append(alignSeqcapture, alignmentSeq{
seq: string(line),
})
}
if !strings.HasPrefix(string(line), ">") {
sequenceCap = append(sequenceCap, string(line))
}
if strings.HasPrefix(string(line), ">") {
sequenceID = append(sequenceID, string(line))
}
}
for i := 0; i < len(sequenceID); i++ {
alignmentBlock = append(alignmentBlock, alignBlock{
id: string(sequenceID[i]),
seq: string(sequenceCap[i][start:end]),
})
}
for i := range alignmentBlock {
fmt.Println("This is the alignment block that has been extracted")
fmt.Println(alignmentBlock[i].id, "\t", alignmentBlock[i].seq)
}
for i := 0; i < len(sequenceID); i++ {
upstreamBlock = append(upstreamBlock, updownStream{
id: string(sequenceID[i]),
seq: string(sequenceCap[i][upstreamfinal:downstreamfinal]),
})
}
fmt.Println(
"These are the upstream and the downstream blocks for the chosen block including the block",
)
for i := range upstreamBlock {
fmt.Println(upstreamBlock[i].id, "\t", upstreamBlock[i].seq)
}
for i := 0; i < len(sequenceID); i++ {
upstreamS = append(upstreamS, upstreamStart{
id: string(sequenceID[i]),
seq: string(sequenceCap[i][upstreamfinal:start]),
})
}
for i := 0; i < len(sequenceID); i++ {
downstreamS = append(downstreamS, downstreamStart{
id: string(sequenceID[i]),
seq: string(sequenceCap[i][end:downstreamfinal]),
})
}
fmt.Println("The upstream from the given position till the start is given below:")
for i := range upstreamS {
fmt.Println(upstreamS[i].id, "\t", upstreamS[i].seq)
}
fmt.Println(
"The downstream from the end to the given downstream coordinate is given below:",
)
for i := range downstreamS {
fmt.Println(downstreamS[i].id, "\t", downstreamS[i].seq)
}
}