Skip to content

Commit

Permalink
codecreatede
Browse files Browse the repository at this point in the history
final release version and usage added
  • Loading branch information
Gaurav Sablok committed Sep 19, 2024
1 parent 9c7df22 commit 262d109
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 34 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,21 @@ go-whole-genome-estimates
- the first genome will be taken as a reference.
- check the AlignmentGO package for defining your own block size.

```
[gauravsablok@fedora]~/Desktop/codecreatede/whole-genome-alignment-estimate% \
go run main.go -alignment ./samplefile/samplealignment.fasta
The collinearity block for A as a base pattern and T as a mismatch is 1
The collinearity block for A as a base pattern G as a mismatch is 1
The collinearity block for A as a base pattern and C as a mismatch is 1
The collinearity block for T as a base pattern and G as a mismatch is 0
The collinearity block for T as a base pattern C as a mismatch is 0
The collinearity block for T as a base pattern and A as a mismatch is 0
The collinearity block for G as a base pattern and C as a mismatch is 1
The collinearity block for G as a base pattern A as a mismatch is 0
The collinearity block for G as a base pattern and T as a mismatch is 0
The collinearity block for C as a base pattern and A as a mismatch is 0
The collinearity block for C as a base pattern T as a mismatch is 0
The collinearity block for C as a base pattern and G as a mismatch is 0
```

Gaurav Sablok
142 changes: 110 additions & 32 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"log"
"os"
"strconv"
"strings"
)

Expand All @@ -20,13 +19,12 @@ It takes a whole genome aligned files and then estimates the linear block by usi
You can pass as many genome as a reference genome and it will take the first genome as a reference. This only compares the
single line block. In the alignmentGO package, you can find the specific for defining your own block.
*/
*/

func main () {
func main() {
alignment := flag.String("alignment", "path to the alignment file", "file")

alignment := flag.String("alignment", "path to the alignment file", "file")

flag.Parse()
flag.Parse()

type alignmentIDStore struct {
id string
Expand Down Expand Up @@ -63,35 +61,115 @@ single line block. In the alignmentGO package, you can find the specific for def
}
}

counterA := 0
counterT := 0
counterG := 0
counterC := 0
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]) == "A" && string(sequenceSpec[i+1][j]) == "T",
|| string(sequenceSpec[i+1][j] == "C" || string(sequenceSpec[i+1][j]) == "G" {
counterA++
}
if string(sequenceSpec[i][j]) == "T" && string(sequenceSpec[i+1][j]) == "C",
|| string(sequenceSpec[i+1][j]) == "G" || string(sequenceSpec[i+1][j]) == "A" {
counterT++
}
if string(sequenceSpec[i][j]) == "C" && string(sequenceSpec[i+1][j]) == "G",
|| string(sequenceSpec[i+1][j]) == "A" || string(sequenceSpec[i+1][j]) == "T" {
counterC++
}
if string(sequenceSpec[i][j]) == "G" && string(sequenceSpec[i+1][j]) == "A",
|| string(SequenceSpec[i+1][j]) == "T" || string(sequenceSpec[i+1][j]) == "C" {
counterG++
} else {
continue
}
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++
}
}
}
fmt.Printf("The collinearity block of line width 1 for A as a base pattern is %d\n", counterA)
fmt.Printf("The collinearity block of line width 1 for T as a base pattern is %d\n", counterT)
fmt.Printf("The collinearity block of line width 1 for G as a base pattern is %d\n", counterG)
fmt.Printf("The collinearity block of line width 1 for C as a base pattern is %d\n", counterC)

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\n", counterAG)
fmt.Printf(
"The collinearity block for A as a base pattern and C as a mismatch is %d\n",
counterAC,
)

fmt.Printf(
"The collinearity block for T as a base pattern and G as a mismatch is %d\n",
counterTG,
)
fmt.Printf("The collinearity block for T as a base pattern C as a mismatch is %d\n", counterTC)
fmt.Printf(
"The collinearity block for T as a base pattern and A as a mismatch is %d\n",
counterTA,
)

fmt.Printf(
"The collinearity block for G as a base pattern and C as a mismatch is %d\n",
counterGC,
)
fmt.Printf("The collinearity block for G as a base pattern A as a mismatch is %d\n", counterGA)
fmt.Printf(
"The collinearity block for G as a base pattern and T as a mismatch is %d\n",
counterGT,
)

fmt.Printf(
"The collinearity block for C as a base pattern and A as a mismatch is %d\n",
counterCA,
)
fmt.Printf("The collinearity block for C as a base pattern T as a mismatch is %d\n", counterCT)
fmt.Printf(
"The collinearity block for C as a base pattern and G as a mismatch is %d\n",
counterCG,
)
}
4 changes: 2 additions & 2 deletions samplefile/samplealignment.fasta
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
>ENA|OX291461|OX291461.1
TCAGTATC----TC--------
TAAGTATC----TC----ATA-
>ENA|OX291509|OX291509.1
TATC----TC--------ATAG
TCTC----TC--------GTAG

0 comments on commit 262d109

Please sign in to comment.