Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyibin committed Mar 4, 2022
1 parent db574d7 commit 87d50ac
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 14 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# asmkit
Toolkit for genome assembly

## Introduction

`asmkit` provide some useful tools for genome scaffold, such as [ALLHiC](https://github.com/tangerzhang/ALLHiC).

## Installation
The easiest way to install `asmkit` is to download the latest binary from the [releases](https://github.com/wangyibin/asmkit/releases/latest)

Build from source with:
```console
go get -u -t -v github.com/wangyibin/asmkit/...
go install github.com/wangyibin/asmkit
```
## Usage
### <kbd>agp2assembly</kbd>

```console
asmkit agp2assembly input.agp output.assembly
```
### <kbd>bam2links</kdb>
```console
asmkit bam2links input.bam output.links
```




## Example
### From bam to juicebox assembly tool
> Depend on [3D-DNA](https://github.com/aidenlab/3d-dna), please first downloand it.
```console
asmkit agp2assembly sample.agp sample.assembly
asmkit bam2links sample.bwa_mem.bam sample.links
bash ~/software/3d-dna/visualize/run-assembly-visualizer.sh sample.assembly sample.links
```
And then import `sample.hic` and `sample.assembly` into [juicebox](https://github.com/aidenlab/Juicebox) to manual curate genome assembly
4 changes: 1 addition & 3 deletions agp2assembly.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import (
"os"
"strconv"
"strings"

"github.com/op/go-logging"
)


// Agp2assembler
type Agp2assembler struct {
Agpfile string
Expand Down Expand Up @@ -150,4 +147,5 @@ func (r *Agp2assembler) Run() error {
if err != nil {
return err
}
return nil
}
34 changes: 23 additions & 11 deletions asmkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command {
Use: "asmkit",
Short: "Toolkit for genome assembly",
var rootCmd = &cobra.Command{
Use: "asmkit",
Short: "Toolkit for genome assembly",
Version: Version,
}

Expand All @@ -15,31 +15,43 @@ func Execute() error {
}

func init() {
bam2linkCmd := &cobra.Command {
Use: "bam2links",
bam2linkCmd := &cobra.Command{
Use: "bam2links <input.bam> <output.links>",
Short: "Extract mnd links from bam",
Long: `
bam2link function:
Given a bamfile, to extract links and store as mnd links file for juicebox assembly tools.
`,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
bamfile := args[0]
linkfile := args[1]
p := Bam2link{Bamfile: bamfile, Linkfile: linkfile}
p := Bam2linker{Bamfile: bamfile, Linkfile: linkfile}
err := p.Run()
if err != nil {
log.Fatal(err)
}
},
}

agp2assembly := &cobra.Command {
Use: "agp2assembly",
agp2assemblyCmd := &cobra.Command{
Use: "agp2assembly <input.agp> <output.assembly>",
Short: "Convert agp file into 3d-dna assembly.",
Long: `
agp2assembly function:
Convert agp file into 3d-dna assembly for juicebox assembly tool.
`,
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string){
Run: func(cmd *cobra.Command, args []string) {
agpfile := args[0]
assemblyfile := args[1]
p := Agp2assembly{Agpfile: agpfile, Assemblyfile: assemblyfile}
err : p.Run()
p := Agp2assembler{Agpfile: agpfile, Assemblyfile: assemblyfile}
err := p.Run()
if err != nil {
log.Fatal(err)
}
},
}

rootCmd.AddCommand(agp2assemblyCmd, bam2linkCmd)
}
1 change: 1 addition & 0 deletions bam2links.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ func (r *Bam2linker) Run() error {
if err != nil {
return err
}
return nil
}

0 comments on commit 87d50ac

Please sign in to comment.