Skip to content

Commit

Permalink
trim2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
mkandziora committed Nov 10, 2018
1 parent 850cd95 commit 7b86fba
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ py.test tests/test_addLocal.py
py.test tests/test_reconcile.py
py.test tests/test_trim.py
py.test tests/test_unmapped_taxa.py

python tests/test_trim2.py

py.test tests/test_blacklist.py
51 changes: 51 additions & 0 deletions tests/test_trim2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from dendropy import Tree, \
DnaCharacterMatrix, \
DataSet, \
datamodel
from physcraper import wrappers, generate_ATT_from_files, AlignTreeTax, OtuJsonDict, IdDicts, ConfigObj
import os
import json



seqaln= "tests/data/Senecioneae_ets_update/Senecioneae_ets2.fas"
mattype="fasta"
treefile= "tests/data/Senecioneae_ets_update/2taxon.tre"
schema_trf = "newick"
workdir="tests/output/test_trim2"
configfi = "tests/data/localblast.config"
id_to_spn = r"tests/data/Senecioneae_ets_update/nicespl.csv"
otu_jsonfi = "{}/otu_dict.json".format(workdir)



if not os.path.exists("{}".format(workdir)):
os.makedirs("{}".format(workdir))

conf = ConfigObj(configfi, interactive=False)
ids = IdDicts(conf, workdir=workdir)

if os.path.exists(otu_jsonfi):
print("load json")
otu_json = json.load(open(otu_jsonfi))
else:
otu_json = OtuJsonDict(id_to_spn, ids)
json.dump(otu_json, open(otu_jsonfi,"w"))


data_obj = generate_ATT_from_files(seqaln=seqaln,
mattype=mattype,
workdir=workdir,
treefile=treefile,
schema_trf = schema_trf,
otu_json=otu_jsonfi,
ingroup_mrca=None)

for tax, seq in data_obj.aln.items():
len_start = len(seq)
next
data_obj.trim()
for tax, seq in data_obj.aln.items():
len_end = len(seq)

assert len_start != len_end

0 comments on commit 7b86fba

Please sign in to comment.