Commit dbd76db7 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 4.8.1

parent 08d8190e
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line

CC = g++ -Wall -ggdb
CC = g++ -pg
CC = g++

# without OpenMP

# default with OpenMP
# with OpenMP
# in command line: 
# make openmp=yes
@@ -14,6 +12,21 @@ else
  CCFLAGS = -fopenmp
endif

#LDFLAGS = -static -lz -o
#LDFLAGS = /usr/lib/x86_64-linux-gnu/libz.a -o

# default with zlib
# without zlib
# in command line:
# make zlib=no
ifeq ($(zlib),no)
  CCFLAGS += 
  LDFLAGS += -o
else
  CCFLAGS += -DWITH_ZLIB
  LDFLAGS += -lz -o
endif

# support debugging
# in command line:
# make debug=yes
@@ -28,9 +41,6 @@ ifdef MAX_SEQ
CCFLAGS += -DMAX_SEQ=$(MAX_SEQ)
endif

#LDFLAGS = -static -o
LDFLAGS += -o

PROGS = cd-hit cd-hit-est cd-hit-2d cd-hit-est-2d cd-hit-div cd-hit-454

# Propagate hardening flags
+24 −3
Original line number Diff line number Diff line
For cd-hit

How to compile?
Requirements
Since 4.8.1, cd-hit supports .gz format input file. This requires zlib library. zlib should
be install in most Linux systems, so cd-hit should be compiled without issue. If your system
don't have zlib, please install it first. 
    * On Ubuntu, to install zlib:
        sudo apt install zlib1g-dev
    * On CentOS, to install zlib:
        sudo yum install zlib-devel 


How to compile
  1. Compile with multi-threading support (default): make
  2. Compile without multi-threading support (if you are on very old systems): make openmp=no
  3. Compile without zlib (if you can not install zlib): make zlib=no

Having problems to compile
Please contact the author


For cd-hit-auxtools
@@ -10,9 +24,16 @@ For cd-hit-auxtools
  make


For psi-cd-hit
  please download legacy BLAST (not BLAST+) and install the executables in your $PATH
Compile cd-hit on MacOS
To install CD-HIT on MacOS, first install gcc on your system.
To use Homebrew (https://brew.sh/), see https://brewformulas.org/gcc. 
Then locate the path to your g++ executable, (e.g. /usr/local/Cellar/gcc/6.3.0_1/bin/g++-6, 
note: yours g++ path is likely to be different), then use command like this:
  make CC=/usr/local/Cellar/gcc/6.3.0_1/bin/g++-6


For psi-cd-hit
  please download BLAST+ (not legacy BLAST) and install the executables in your $PATH

For more information, please visit http://cd-hit.org

cd-hit-clstr_2_blm8.pl

0 → 100755
+58 −0
Original line number Diff line number Diff line
#!/usr/bin/perl
#

my $rep;
my @non_reps = ();
my @aln_info = ();
while($ll=<>){
  if ($ll =~ /^>/ ) {
    if (@non_reps) {
      for ($i=0; $i<@non_reps; $i++) {
        print "$non_reps[$i]\t$rep\t$aln_info[$i]\n";
      }
    }
    $rep = "";
    @non_reps = ();
    @aln_info = ();
  }
  else {
    chop($ll);
    if ($ll =~ />(.+)\.\.\./ ) {
      my $id = $1;
      if ($ll =~ /\*$/) { $rep = $id}
      else              { 
        push(@non_reps, $id);
        my @lls = split(/\s+/, $ll);
        my ($a, $iden) = split(/\//, $lls[-1]);
        chop($iden); ### removing % sign
        my ($qb, $qe, $sb, $se) = split(/:/, $a);
        my $alnln = $qe-$qb+1;
        my $mis = int($alnln * (100-$iden) / 100);
        my $gap = 0;
        my $exp = 0;
        my $bit = $alnln*3 - $mis*6; #### very rough
        push(@aln_info, "$iden\t$alnln\t$mis\t$gap\t$qb\t$qe\t$sb\t$se\t$exp\t$bit");
      }
    }
#>Cluster 582
#0       6671aa, >gi|302514050|uid|51... *
#1       339aa, >SRS584717|scaffold|... at 2:332:4020:4356/89.32%
#2       182aa, >SRS584717|scaffold|... at 1:182:6490:6671/100.00%
#3       367aa, >SRS584717|scaffold|... at 1:332:4543:4874/90.66%
#4       109aa, >SRS584717|scaffold|... at 1:108:5782:5889/97.22%

  }
}
    if (@non_reps) {
      for ($i=0; $i<@non_reps; $i++) {
        print "$non_reps[$i]\t$rep\t$aln_info[$i]\n";
      }
    }

#query                          subject         %       alnln   mis     gap     q_b     q_e     s_b     s_e     expect  bits
##0                              1               2       3       4       5       6       7       8       9       10      11
#mHE-SRS012902|scaffold|86.16    gnl|CDD|226997  47.62   42      17      2       164     201     210     250     5e-04   37.6
#mHE-SRS012902|scaffold|109.23   gnl|CDD|225183  47.46   236     122     1       1       236     475     708     1e-92    284
#mHE-SRS012902|scaffold|109.23   gnl|CDD|224055  44.35   239     130     2       1       239     332     567     2e-84    259
#mHE-SRS012902|scaffold|109.23   gnl|CDD|227321  39.50   238     140     3       1       238     324     557     9e-69    218
+438 −26

File changed.

Preview size limit exceeded, changes collapsed.

+29 −17
Original line number Diff line number Diff line
@@ -35,11 +35,15 @@
#include<stdint.h>
#include<time.h>

#ifdef WITH_ZLIB
#include<zlib.h>
#endif

#include<valarray>
#include<vector>
#include<map>

#define CDHIT_VERSION  "4.7"
#define CDHIT_VERSION  "4.8.1"

#ifndef MAX_SEQ
#define MAX_SEQ 655360
@@ -559,9 +563,17 @@ class SequenceDB
		~SequenceDB(){ Clear(); }

		void Read( const char *file, const Options & options );
		void Readgz( const char *file, const Options & options );

		void Read( const char *file, const char *file2, const Options & options );
		void Readgz( const char *file, const char *file2, const Options & options );

		void WriteClusters( const char *db, const char *newdb, const Options & options );
		void WriteClustersgz( const char *db, const char *newdb, const Options & options );

		void WriteClusters( const char *db, const char *db_pe, const char *newdb, const char *newdb_pe, const Options & options );
		void WriteClustersgz( const char *db, const char *db_pe, const char *newdb, const char *newdb_pe, const Options & options );

		void WriteExtra1D( const Options & options );
		void WriteExtra2D( SequenceDB & other, const Options & options );
		void DivideSave( const char *db, const char *newdb, int n, const Options & options );
Loading