Skip to content

Instantly share code, notes, and snippets.

@gregcaporaso
Created December 1, 2016 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregcaporaso/681c1c20ea834edcf2cb834b206c22ce to your computer and use it in GitHub Desktop.
Save gregcaporaso/681c1c20ea834edcf2cb834b206c22ce to your computer and use it in GitHub Desktop.
QIIME 2 issue #190 example
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running external command line application. This may print messages to stdout and/or stderr.\n",
"The command being run is below. This command cannot be manually re-run as it will depend on temporary files that no longer exist.\n",
"\n",
"Command: FastTree -nt /var/folders/xq/0kh93ng53bs6zzk091w_bbsr0000gn/T/qiime2-archive-wto551o4/aa4ef5af-050a-4cfc-a768-4fe59484f8d6/data/aligned-dna-sequences.fasta\n",
"\n",
"3f2db99e-ad89-4006-8dbe-4ede47775174\n"
]
}
],
"source": [
"from qiime.plugins import phylogeny, alignment\n",
"from q2_types import FeatureData, AlignedSequence, Sequence\n",
"import qiime\n",
"\n",
"aligned_seqs = qiime.Artifact.import_data(FeatureData[AlignedSequence], 'aligned-dna-sequences.fasta')\n",
"\n",
"# standard error goes to terminal where \"jupyter notebook\" is running\n",
"tree = phylogeny.methods.fasttree(aligned_seqs)\n",
"print(tree.tree.uuid)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Hello world!!\n"
]
}
],
"source": [
"import sys\n",
"print(\"Hello world!!\", file=sys.stderr)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running external command line application. This may print messages to stdout and/or stderr.\n",
"The command being run is below. This command cannot be manually re-run as it will depend on temporary files that no longer exist.\n",
"\n",
"Command: mafft --preservecase /var/folders/xq/0kh93ng53bs6zzk091w_bbsr0000gn/T/qiime2-archive-rv181wqs/fddba98e-110d-41c1-b9c1-2748e384dfd9/data/dna-sequences.fasta\n",
"\n",
"84dacdc5-0104-4c7f-a2d5-4e0c847e5bf5\n"
]
}
],
"source": [
"unaligned_seqs = qiime.Artifact.import_data(FeatureData[Sequence], 'dna-sequences.fasta')\n",
"\n",
"# standard error goes to terminal where \"jupyter notebook\" is running\n",
"aln = alignment.methods.mafft(unaligned_seqs)\n",
"print(aln.alignment.uuid)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Hello world!"
]
}
],
"source": [
"sys.stderr.write('Hello world!')"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"testing\r\n"
]
}
],
"source": [
"!echo \"testing\" > /dev/stderr"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
">0\r\n",
"ACGATCGAT--\r\n",
">1\r\n",
"-CAGCTAGCAT\r\n"
]
}
],
"source": [
"# for the sake of completeness\n",
"!cat aligned-dna-sequences.fasta"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
">0\r\n",
"ACGATCGAT\r\n",
">1\r\n",
"CAGCTAGCAT\r\n"
]
}
],
"source": [
"# for the sake of completeness\n",
"!cat dna-sequences.fasta"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python [default]",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment