Skip to content

Commit

Permalink
Merge pull request #5 from prophyle/travis
Browse files Browse the repository at this point in the history
Fix testing using Travis
  • Loading branch information
Karel Břinda authored May 8, 2018
2 parents 09afb50 + 051e132 commit 55864ae
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
prophasm
README.html

_*

Expand Down
16 changes: 2 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: cpp

cache:
- brew
- apt: true

matrix:
Expand All @@ -13,23 +12,12 @@ matrix:
install:
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update
- sudo apt-get install g++-4.8 zlib1g-dev
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90
- sudo apt-get install zlib1g-dev

- os: osx
compiler: clang-3.7
before_install:
- brew update
- brew tap homebrew/versions
install:
- export CXX="clang++-3.7" CC="clang-3.7"
- brew install llvm37


script:
- make test

cache:
directories:
- $HOME/miniconda

9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all help clean test prophasm
.PHONY: all help clean test prophasm readme

SHELL=/usr/bin/env bash -eo pipefail

Expand All @@ -10,12 +10,15 @@ prophasm:
$(MAKE) -C src

help: ## Print help message
@echo "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s : | sort)"
@echo "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s : | sort)"

test:
$(MAKE) -C tests

readme:
md2html README.md > README.html

clean: ## Clean
$(MAKE) -C src clean
$(MAKE) -C tests clean
rm -f prophasm
rm -f prophasm README.html
33 changes: 26 additions & 7 deletions tests/tools/verify_output.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#! /usr/bin/env python3
"""A program to verify output of prophyle-assembler.
#! /usr/bin/env python2.7

"""A program to verify output of prophasm.
Author: Karel Brinda <[email protected]>
Licence: MIT
"""

import sys
import collections
import re
from Bio import SeqIO
import sys

in1_fn = sys.argv[1]
in2_fn = sys.argv[2]
Expand All @@ -26,6 +27,24 @@
"T": "A",
}

def load_fasta(fn):
d=collections.defaultdict(list)
with open(fn) as f:
seqname="_"
for line in f:
line=line.strip()
if len(line)==0:
continue
if line[0]==">":
seqname, _, _ = line.partition(" ")
else:
d[seqname].append(line)
dd={}
for k in d:
dd[k]="".join(d[k])

return dd


def reverse_complement_str(dna):
reverse_complement = "".join([comp_dict[x] for x in dna[::-1]])
Expand All @@ -37,9 +56,9 @@ def get_canonical_kmers_from_fasta(fasta_fn, k):

reg_splitting = re.compile("[^ACGT]")
set_of_kmers = set()
fasta_sequences = SeqIO.parse(fasta_fn, 'fasta')
for fasta_seq in fasta_sequences:
name, sequence = fasta_seq.id, str(fasta_seq.seq).upper()
fasta_sequences = load_fasta(fasta_fn)
for name in fasta_sequences:
sequence = fasta_sequences[name].upper()
sequences_ok = reg_splitting.split(sequence)
for seq in sequences_ok:
for i in range(len(seq) - k + 1):
Expand Down

0 comments on commit 55864ae

Please sign in to comment.