Skip to content

Commit

Permalink
[CI] Add command in README
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed Jan 7, 2018
1 parent b3e980a commit 2430328
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# ALLHIC
Genome scaffolding based on HiC data
# ALLHIC Genome scaffolding based on HiC data

## Usage

### Partition

Given a target k, number of partitions, the goal of the partitioning
is to separate all the contigs into separate clusters. As with all
clustering algorithm, there is an optimization goal here. The
LACHESIS algorithm is a hierarchical clustering algorithm using
average links.

```bash
allhic partition tests/prunning.sub.bam
```

### Optimize

Given a set of Hi-C contacts between contigs, as specified in the
clmfile, reconstruct the highest scoring ordering and orientations
for these contigs.

```bash
allhic optimize tests/test.clm
```
11 changes: 7 additions & 4 deletions allhic/optimize.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ func (r *Optimizer) Run() {
}

for phase := 1; ; phase++ {
clm.OptimizeOrientations(fwtour, phase)
break
tag1, tag2 := clm.OptimizeOrientations(fwtour, phase)
if tag1 == REJECT && tag2 == REJECT {
log.Noticef("Terminating ... no more %v", ACCEPT)
break
}
}
}

Expand All @@ -55,12 +58,12 @@ func (r *CLMFile) OptimizeOrdering(fwtour *os.File, phase int) {
}

// OptimizeOrientations changes the orientations of contigs by using heuristic flipping algorithms.
func (r *CLMFile) OptimizeOrientations(fwtour *os.File, phase int) {
func (r *CLMFile) OptimizeOrientations(fwtour *os.File, phase int) (string, string) {
tag1 := r.flipWhole()
r.PrintTour(fwtour, r.Tour, fmt.Sprintf("FLIPWHOLE%d", phase))
tag2 := r.flipOne()
r.PrintTour(fwtour, r.Tour, fmt.Sprintf("FLIPONE%d", phase))
fmt.Println(tag1, tag2)
return tag1, tag2
}

// PrintTour logs the current tour to file
Expand Down
5 changes: 1 addition & 4 deletions allhic/orientation.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *CLMFile) flipAll() {

// flipWhole test flipping all contigs at the same time to see if score improves
func (r *CLMFile) flipWhole() (tag string) {
var oldSigns []byte
oldSigns := make([]byte, len(r.Signs))
copy(oldSigns, r.Signs)
score := r.EvaluateQ()

Expand All @@ -78,9 +78,6 @@ func (r *CLMFile) flipOne() (tag string) {
anyTagACCEPT := false
score := r.EvaluateQ()
for i, t := range r.Tour.Tigs {
if i == 0 {
continue
}
idx := t.Idx
r.Signs[idx] = rr(r.Signs[idx])
newScore := r.EvaluateQ()
Expand Down

0 comments on commit 2430328

Please sign in to comment.