Skip to content

Commit

Permalink
[allhic] Add hic/partition
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed Nov 21, 2017
1 parent 4a03efc commit 91f248f
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
8 changes: 7 additions & 1 deletion allhic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import docopt
import hic/clm
import hic/partition
import strutils
import tables

Expand All @@ -25,11 +26,16 @@ proc optimize_main() =
c.parse()


proc partition_main() =
var c = initPartitioner("tests/prunning.sub.bam")
echo c.bamfile


proc main() =
let args = docopt(doc, version="ALLHIC 0.7.11")

if args["partition"]:
echo "Hello world"
partition_main()

if args["optimize"]:
optimize_main()
Expand Down
24 changes: 24 additions & 0 deletions hic/partition.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# ALLHIC: Partition function
# 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.
#


import logging

var logger = newConsoleLogger()
logger.addHandler()

type
Partitioner* = ref object
bamfile*: string


proc initPartitioner*(bamfile: string): Partitioner =
new result
result.bamfile = bamfile
62 changes: 62 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

echo $(pwd)

sudo apt-get -qy install bwa make build-essential cmake libncurses-dev ncurses-dev libbz2-dev lzma-dev liblzma-dev \
curl libssl-dev libtool autoconf automake libcurl4-openssl-dev

export base=$(pwd)
if [ ! -x nim-$BRANCH/bin/nim ]; then
git clone -b $BRANCH --depth 1 git://github.com/nim-lang/nim nim-$BRANCH/
cd nim-$BRANCH
git clone --depth 1 git://github.com/nim-lang/csources csources/
cd csources
sh build.sh
cd ..
rm -rf csources
bin/nim c koch
./koch boot -d:release
else
cd nim-$BRANCH
git fetch origin
if ! git merge FETCH_HEAD | grep "Already up-to-date"; then
bin/nim c koch
./koch boot -d:release
fi
fi

export PATH=$PATH:$base/nim-$BRANCH/bin/:$PATH:$base/nimble/src
cd $base
echo $PATH


git clone --depth 1 https://github.com/nim-lang/nimble.git
cd nimble
nim c src/nimble
src/nimble install -y

set -x
cd $base
nimble refresh

echo $(which nimble)
echo $(pwd)


if [ ! -x hts-nim ]; then
cd $base
git clone --depth 1 https://github.com/brentp/hts-nim/
cd hts-nim && nimble install -y
fi

set -x
cd $base
nimble install -y
git clone --recursive https://github.com/samtools/htslib.git

cd htslib && git checkout 1.5 && autoheader && autoconf && ./configure --enable-libcurl
cd ..
make -j 4 -C htslib
export LD_LIBRARY_PATH=$base/htslib
ls -lh $base/htslib/*.so
echo $base

0 comments on commit 91f248f

Please sign in to comment.