-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from McTavishLab/muscle
Muscle profile alignment
- Loading branch information
Showing
8 changed files
with
207 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" This is a minimal example taking precooked data from the tests | ||
""" | ||
import os | ||
import sys | ||
import json | ||
import physcraper | ||
from physcraper import OtuJsonDict, generate_ATT_from_files, ConfigObj, IdDicts, PhyscraperScrape | ||
from physcraper import opentree_helpers | ||
from physcraper.opentree_helpers import scraper_from_opentree | ||
|
||
configfi = "tests/data/test.config" | ||
workdir ="physcraper_example_minimal" | ||
aln_fi = "tests/data/tiny_test_example/test.fas" | ||
blast_dir = "tests/data/precooked/fixed/tte_blast_files" | ||
# mattype="fasta" | ||
tre_fi= "tests/data/tiny_test_example/test.tre" | ||
# schema_trf = "newick" | ||
otu_jsonfi = "{}/otu_dict.json".format(workdir) | ||
id_to_spn = "tests/data/tiny_test_example/test_nicespl.csv" | ||
|
||
if not os.path.exists("{}".format(workdir)): | ||
os.makedirs("{}".format(workdir)) | ||
|
||
conf_base = ConfigObj(configfi) | ||
|
||
ids = IdDicts(configfi) | ||
|
||
otu_json = OtuJsonDict(id_to_spn, ids) | ||
with open(otu_jsonfi,"w") as outfile: | ||
json.dump(otu_json, outfile) | ||
|
||
ottids = [otu_json[ite]['^ot:ottId'] for ite in otu_json] | ||
|
||
mrca = opentree_helpers.get_mrca_ott(ottids) | ||
|
||
# Create a 'scraper' object to get data from NCBI | ||
|
||
data_obj = generate_ATT_from_files(alnfile=aln_fi, | ||
aln_schema="fasta", #mattype | ||
workdir=workdir, | ||
configfile=configfi, | ||
treefile=tre_fi, | ||
tree_schema = "newick", #schema_trf | ||
otu_json=otu_jsonfi, | ||
ingroup_mrca=mrca) | ||
|
||
data_obj.tag = "minEx" | ||
|
||
scraper = PhyscraperScrape(data_obj, ids) | ||
|
||
sys.stdout.write("{} taxa in alignment and tree\n".format(len(scraper.data.aln))) | ||
|
||
scraper._blasted = 1 # this tricks PhyScraper into not blasting anything new | ||
sys.stdout.write("Running read_blast_wrapper()...\n") | ||
scraper.read_blast_wrapper(blast_dir=blast_dir) | ||
sys.stdout.write("Running write_aln()...\n") | ||
aln_path1 = scraper.data.write_aln() | ||
aln_path_alt = scraper.data.write_aln(filename="already_aligned_seqs.fas") | ||
unaln_path = scraper.write_new_seqs(filename='unaligned.fas') | ||
|
||
sys.stdout.write("Running align_query_seqs()...\n") | ||
scraper.align_new_seqs() | ||
scraper.est_full_tree() | ||
scraper.data.write_labelled(label="^ot:ottTaxonName", norepeats=False) | ||
scraper.data.write_labelled(label="^ncbi:taxon", filename="ncbi", norepeats=False) | ||
|
||
|
||
# sys.stdout.write("estimating tree...") | ||
# scraper.est_full_tree() | ||
# scraper.data.write_labelled(label='^ot:ottTaxonName') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
# Example runs and datasets | ||
# Example runs | ||
|
||
There is a full example python script with comments in `docs/example.py`. | ||
Some more example files can be found in `docs/example_scripts/`. | ||
<!-- There is a full example python script with comments in `docs/example.py`. | ||
Some more example files can be found in `docs/example_scripts/`. --> | ||
|
||
## Example ot_350: blasting remotely | ||
|
||
Run physcraper interactively on python with the command: | ||
|
||
``` | ||
python -i docs/examples/data_scrape.py | ||
``` | ||
|
||
Or directly from the command line with: | ||
|
||
``` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.