# Remove.groups invalid groups

**URL:** https://forum.mothur.org/t/remove-groups-invalid-groups/2250
**Category:** Commands in mothur
**Created:** [February 13, 2015, 12:07pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250 "2015-02-13T12:07:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Somebodyatthedoor](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Somebodyatthedoor](https://forum.mothur.org/u/Somebodyatthedoor)
#### Post date: [February 13, 2015, 12:07pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/1 "2015-02-13T12:07:37Z")

</div>

Hi, I’m having a little trouble removing groups of samples from a shared file. I have a group file containing four groups and want to be left with only those samples from the fourth group in the shared file.

To do this I ran the following command and got this output:

\_remove.groups(shared=three\_month\_final\_shared, group=design\_sheepvscontrols.txt, groups=negative-positive-wash)

Removed 30 sequences from your group file.  
negative is not a valid group, and will be disregarded.  
positive is not a valid group, and will be disregarded.  
wash is not a valid group, and will be disregarded.  
You provided no valid groups. I will run the command using all the groups in your file.  
Removed groups: negative, positive, wash from your shared file.

Output File names:  
design\_sheepvscontrols.pick.txt  
three\_month\_final\_shared1.pick\_

The group file is formatted fine as I have used it successfully with another command. I’m presuming I’m doing something wrong with the command but I’m not completely sure what.

---

<div class="post-metadata">

### Author: ![pschloss](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/pschloss/32/4_2.png) [@pschloss](https://forum.mothur.org/u/pschloss)
#### Post date: [February 16, 2015, 2:39pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/2 "2015-02-16T14:39:26Z")

</div>

Can you run…

count.groups(group=design\_sheepvscontrols.txt)

… and post the output

---

<div class="post-metadata">

### Author: ![Somebodyatthedoor](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Somebodyatthedoor](https://forum.mothur.org/u/Somebodyatthedoor)
#### Post date: [February 16, 2015, 3:34pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/3 "2015-02-16T15:34:09Z")

</div>

Thanks for your reply. This is what I get:

\_mothur \> count.groups(group=design\_sheepvscontrols.txt)

lung contains 54.  
negative contains 10.  
other contains 8.  
positive contains 2.  
wash contains 18.

Total seqs: 92.

Output File Names:  
design\_sheepvscontrols.count.summary\_

---

<div class="post-metadata">

### Author: ![Somebodyatthedoor](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Somebodyatthedoor](https://forum.mothur.org/u/Somebodyatthedoor)
#### Post date: [February 17, 2015, 9:54am UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/4 "2015-02-17T09:54:12Z")

</div>

Also,

I have just discovered that a similar thing happens when I try to run metastats with the same design file:

\_metastats(shared=three\_month\_final\_shared1.subsample, design=design\_sheepvscontrols.txt, groups=lung-negative-positive-wash, processors=2)

Using 2 processors.  
lung is not a valid group, and will be disregarded.  
negative is not a valid group, and will be disregarded.  
positive is not a valid group, and will be disregarded.  
wash is not a valid group, and will be disregarded.  
You provided no valid groups. I will run the command using all the groups in your file.  
1  
Comparing positive and other…

Comparing negative and lung…

Output File Names:  
three\_month\_final\_shared1.1.negative-lung.metastats  
three\_month\_final\_shared1.1.other-lung.metastats  
three\_month\_final\_shared1.1.other-negative.metastats  
three\_month\_final\_shared1.1.positive-lung.metastats  
three\_month\_final\_shared1.1.positive-negative.metastats\_

I have tried this with several other deign files with different groups specified and it still happens. It seems quite random in the groups it decides are present in the group file after saying none of the groups specified were valid. In the above example it seems to leave out the group ‘wash’. In another design file with the groups 2D618-2D619-2D620-2D644-2D645-2S066 it leaves out 2S066.

---

<div class="post-metadata">

### Author: ![westcott](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/westcott/32/18_2.png) [@westcott](https://forum.mothur.org/u/westcott)
#### Post date: [February 18, 2015, 2:43pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/5 "2015-02-18T14:43:55Z")

</div>

Could you send your files to [mothur.bugs@gmail.com](mailto:mothur.bugs@gmail.com)?

---

<div class="post-metadata">

### Author: ![Somebodyatthedoor](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Somebodyatthedoor](https://forum.mothur.org/u/Somebodyatthedoor)
#### Post date: [February 18, 2015, 3:43pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/6 "2015-02-18T15:43:35Z")

</div>

I’ve sent them along. Thanks for your help.

---

<div class="post-metadata">

### Author: ![westcott](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/westcott/32/18_2.png) [@westcott](https://forum.mothur.org/u/westcott)
#### Post date: [February 18, 2015, 4:26pm UTC](https://forum.mothur.org/t/remove-groups-invalid-groups/2250/7 "2015-02-18T16:26:33Z")

</div>

Hi Laura,  
The problem is mothur is expecting the groups negative-positive-wash to be listed as groups in the shared file. The way you have the files set up, mothur is considering them sets. To remove all the groups associated with the sets lung-negative-positive-wash, you would need to list them individually. i.e., something like:

mothur \> remove.groups(shared=three\_month\_final\_shared, design=design\_sheepvscontrols.txt, groups= 2152N0049-2152N0050,…)

For the metastats command there is a sets parameter. So if you want to include only the groups associated with lung-negative-positive-wash, then you could run the following:

metastats(shared=three\_month\_final\_shared1.subsample, design=design\_sheepvscontrols.txt, sets=lung-negative-positive-wash, processors=2)

Kindly,  
Sarah
