# q2-phylogeny mafft job "killed"

**URL:** https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526
**Category:** User Support
**Tags:** phylogeny
**Created:** [February 16, 2023, 6:35am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526 "2023-02-16T06:35:32Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 16, 2023, 6:35am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/1 "2023-02-16T06:35:33Z")

</div>

I would like to load rep-seqs.qza, which consists of 24 100k reads samples, for phylogeny analysis, but I get an error. I would appreciate if you could tell me how to deal with this problem.

#input command  
qiime phylogeny align-to-tree-mafft-fasttree   
--p-n-threads 30   
--i-sequences rep-seqs.qza   
--o-alignment aligned-rep-seqs.qza   
--o-masked-alignment masked-aligned-rep-seqs.qza   
--o-tree unrooted-tree.qza   
--o-rooted-tree rooted-tree.qza

#output log  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable  
Reallocating..done. \*alloclen = 125739

Reallocating..done. \*alloclen = 125739  
Reallocating..done. \*alloclen = 125739  
Reallocating..done. \*alloclen = 206192  
/home/ysuzuki/miniconda3/envs/qiime2-2022.11/bin/mafft: line 2817: 1223186 Killed "$prefix/disttbfast" -q $npickup -E $cycledisttbfast -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreads-$numthreadstb $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -g $gexp -f "-"$gop -Q $spfactor -h $aof $param\_fft $algopt $treealg $scoreoutarg $anchoropt -x $maxanchorseparation $oneiterationopt \< infile \> pre 2\>\> "$progressfile"  
Traceback (most recent call last):  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2cli/commands.py", line 352, in **call**  
results = action(\*\*arguments)  
File "", line 2, in align\_to\_tree\_mafft\_fasttree  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable  
outputs = self._callable\_executor_(scope, callable\_args,  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 475, in _callable\_executor_  
outputs = self.\_callable(scope.ctx, \*\*view\_args)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_phylogeny/\_align\_to\_tree\_mafft\_fasttree.py", line 19, in align\_to\_tree\_mafft\_fasttree  
aligned\_seq, = mafft(sequences=sequences, n\_threads=n\_threads,  
File "", line 2, in mafft  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable  
outputs = self._callable\_executor_(scope, callable\_args,  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in _callable\_executor_  
output\_views = self.\_callable(\*\*view\_args)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 128, in mafft  
return \_mafft(sequences\_fp, None, n\_threads, parttree, False)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 100, in \_mafft  
run\_command(cmd, result\_fp)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 26, in run\_command  
subprocess.run(cmd, stdout=output\_f, check=True)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/subprocess.py", line 516, in run  
raise CalledProcessError(retcode, process.args,  
subprocess.CalledProcessError: Command '['mafft', '--preservecase', '--inputorder', '--thread', '30', '/tmp/qiime2/ysuzuki/data/76cc47d7-5a79-4b0e-9f00-8f6dda5f3280/data/dna-sequences.fasta']' returned non-zero exit status 1.

---

<div class="post-metadata">

### Author: ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)
#### Post date: [February 16, 2023, 7:57am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/2 "2023-02-16T07:57:32Z")

</div>

Hello!  
Looks like your machine is running out of RAM and not able to complete the task.

> [@ysuzuki](#):
>
> --p-n-threads 30

You can try to set number of threads to 4 (or another lower than 30 number) to decrease RAM requirements.

Another option to consider is to filter feature table to get rid of sequences with low counts (less than 10, for example), then filter rep-seqs file based on filtered feature table. It will significantly decrease RAM need to accomplish the task.

Best,

---

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 16, 2023, 8:55am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/3 "2023-02-16T08:55:10Z")

</div>

Thanks for your comment.  
I started the analysis with 4thread.  
In case you are wondering, I have 48GB of memory installed, but is it still not enough?  
Please also tell me the recommended amount of memory to run at 30thread.

Also, is it ok to use the following command to filter the table?

qiime feature-table filter-samples  
--i-table table.qza  
--p-min-frequency 10  
--o-filtered-table sample-frequency-filtered-table.qza

---

<div class="post-metadata">

### Author: ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)
#### Post date: [February 16, 2023, 11:32am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/4 "2023-02-16T11:32:35Z")

</div>

> [@ysuzuki](#):
>
> In case you are wondering, I have 48GB of memory installed, but is it still not enough?  
> Please also tell me the recommended amount of memory to run at 30thread.

It depends on the amount of sequences in your rep-seqs file. In my experirence it is enough for most of the cases with 16S datasets, but sometimes I need to use 64 or even 128 Gb. But after filtering usually 32 is enough.  
High number of threads is not always speeding up the overall time required for the task, and I prefer not to put more than 6 or 8 threads, so I really do not know how much one need RAM to run it with 30 threads.

> [@ysuzuki](#):
>
> Also, is it ok to use the following command to filter the table?
> 
> qiime feature-table filter-samples

In that case you need to filter features, not samples:  
[link](https://docs.qiime2.org/2022.11/plugins/available/feature-table/filter-features/)

After it, use filtered feature table to filter rep-seqs file:  
[link](https://docs.qiime2.org/2022.11/plugins/available/feature-table/filter-seqs/)

---

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 16, 2023, 11:44am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/5 "2023-02-16T11:44:57Z")

</div>

I understood that about 8 threads is sufficient for analysis.  
I just tried it with 4 threads and am getting the same error.  
I may need to do some filtering.

output log

Running external command line application. This may print messages to stdout and/or stderr.

The command being run is below. This command cannot be manually re-run as it will depend on temporary files that no longer exist.

Command: mafft --preservecase --inputorder --thread 4 /tmp/qiime2/ysuzuki/data/76cc47d7-5a79-4b0e-9f00-8f6dda5f3280/data/dna-sequences.fasta

inputfile = orig

78518 x 3683 - 27 d

nthread = 4

nthreadpair = 4

nthreadtb = 4

ppenalty\_ex = 0

stacksize: 8192 kb-\>15335 kb

generating a scoring matrix for nucleotide (dist=200) ... done

Gap Penalty = -1.53, +0.00, +0.00

Making a distance matrix ..

done.

Constructing a UPGMA tree (efffree=0) ...

done.

Progressive alignment 1/2...

Reallocating..done. \*alloclen = 125739  
Reallocating..done. \*alloclen = 206192  
/home/ysuzuki/miniconda3/envs/qiime2-2022.11/bin/mafft: line 2817: 1412851 Killed "$prefix/disttbfast" -q $npickup -E $cycledisttbfast -V "-"$gopdist -s $unalignlevel $legacygapopt $mergearg -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreads-$numthreadstb $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -g $gexp -f "-"$gop -Q $spfactor -h $aof $param\_fft $algopt $treealg $scoreoutarg $anchoropt -x $maxanchorseparation $oneiterationopt \< infile \> pre 2\>\> "$progressfile"  
Traceback (most recent call last):  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2cli/commands.py", line 352, in **call**  
results = action(\*\*arguments)  
File "", line 2, in align\_to\_tree\_mafft\_fasttree  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable  
outputs = self._callable\_executor_(scope, callable\_args,  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 475, in _callable\_executor_  
outputs = self.\_callable(scope.ctx, \*\*view\_args)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_phylogeny/\_align\_to\_tree\_mafft\_fasttree.py", line 19, in align\_to\_tree\_mafft\_fasttree  
aligned\_seq, = mafft(sequences=sequences, n\_threads=n\_threads,  
File "", line 2, in mafft  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound\_callable  
outputs = self._callable\_executor_(scope, callable\_args,  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/qiime2/sdk/action.py", line 381, in _callable\_executor_  
output\_views = self.\_callable(\*\*view\_args)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 128, in mafft  
return \_mafft(sequences\_fp, None, n\_threads, parttree, False)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 100, in \_mafft  
run\_command(cmd, result\_fp)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/site-packages/q2\_alignment/\_mafft.py", line 26, in run\_command  
subprocess.run(cmd, stdout=output\_f, check=True)  
File "/home/ysuzuki/miniconda3/envs/qiime2-2022.11/lib/python3.8/subprocess.py", line 516, in run  
raise CalledProcessError(retcode, process.args,  
subprocess.CalledProcessError: Command '['mafft', '--preservecase', '--inputorder', '--thread', '4', '/tmp/qiime2/ysuzuki/data/76cc47d7-5a79-4b0e-9f00-8f6dda5f3280/data/dna-sequences.fasta']' returned non-zero exit status 1.

---

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [February 16, 2023, 5:20pm UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/6 "2023-02-16T17:20:32Z")

</div>

Hi @ysuzuki,

If you run `qiime phylogeny align-to-tree-mafft-fasttree --help`, you'll find that there is a potentially useful flag: ` --p-partree`. Try running with this flag and let us know if it works.

-Mike

---

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 17, 2023, 2:50am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/8 "2023-02-17T02:50:33Z")

</div>

I tried filtering but got the following error Do I need to process my table.qza with filter-samples?

> <https://github.com/qiime2/docs/blob/master/source/tutorials/filtering.rst>

\*\*\*\*output\_log

**(1/1) Invalid value for '--i-table': Expected an artifact of at least type**

**FeatureTable[Frequency]. An artifact of type FeatureData[Sequence] was**

**provided.**

---

<div class="post-metadata">

### Author: ![timanix](https://forum.qiime2.org/user_avatar/forum.qiime2.org/timanix/32/17879_2.png) [@timanix](https://forum.qiime2.org/u/timanix)
#### Post date: [February 17, 2023, 8:08am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/9 "2023-02-17T08:08:46Z")

</div>

> [@ysuzuki](#):
>
> **(1/1) Invalid value for '--i-table': Expected an artifact of at least type**
> 
> **FeatureTable[Frequency]. An artifact of type FeatureData[Sequence] was**
> 
> **provided.**

It looks like you made and error and provided rep-seqs.qza file instead of feature table. Take a closer look on the plugin descriptions. In the first step (first link) feature table should be filtered, and in a second step (second link) feature table is provided, as well as rep-seqs.qza artifact. The latest will be filtered based on filtered feature table.

Best,

---

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 18, 2023, 12:26am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/10 "2023-02-18T00:26:50Z")

</div>

Thanks timanix.  
Your comment made me realize a basic mistake.  
I had merged multiple rep-seqs and table each before doing the analysis, but when I reviewed the script for merging rep-seqs, the output file name was table.qza, which had been overwritten.  
I will redo all the analysis.

---

<div class="post-metadata">

### Author: ![ysuzuki](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ysuzuki/32/15092_2.png) [@ysuzuki](https://forum.qiime2.org/u/ysuzuki)
#### Post date: [February 20, 2023, 8:34am UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/11 "2023-02-20T08:34:26Z")

</div>

I followed your advice and ran it with the "--p-partree" option, but got the following output error  
Is this also an error caused by insufficient memory?

* * *

**Plugin error from phylogeny:**

**Command '['FastTreeMP', '-quote', '-nt', '/tmp/qiime2/ysuzuki/data/fcb10cdf-a46c-4a15-9912-3daea14f9472/data/aligned-dna-sequences.fasta']' died with \<Signals.SIGKILL: 9\>.**

**Debug info has been saved to /tmp/qiime2-q2cli-err-k28rci6q.log**

List item

---

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [February 21, 2023, 2:35pm UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/12 "2023-02-21T14:35:39Z")

</div>

Hi @ysuzuki,

Yes, quite often related to a memory issue. Can you provide us with more details on how you generated your `rep-seqs.qza` file? What gene sequence are you using? Did you perform any quality control? denoising? dereplication? etc...? How many representative sequence's (_i.e._ features) does your data contain?

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [March 24, 2023, 8:36pm UTC](https://forum.qiime2.org/t/q2-phylogeny-mafft-job-killed/25526/13 "2023-03-24T20:36:36Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
