# The creation of the Collection of paired reads using the API encountered an error

**URL:** https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654
**Category:** Uncategorized
**Tags:** devops-bioblend-api
**Created:** [February 4, 2024, 8:03am UTC](https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654 "2024-02-04T08:03:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chenqiang](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@chenqiang](https://help.galaxyproject.org/u/chenqiang)
#### Post date: [February 4, 2024, 8:03am UTC](https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654/1 "2024-02-04T08:03:17Z")

</div>

Hello, I am very anxious, please help, thank you, I am using bioblend to connect to the usegalaxy API, my workflow input is Collection of paired reads.Part of my code is as follows:

 ![735f2f3e354706a1e82859854c3cf48](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/f/f3f3998c952d52bd52d8d7781d90cfba783ec6c0.png)  
 ![bc2ac3548d2c87ea0ebe30bb62c97f4](https://us1.discourse-cdn.com/flex020/uploads/galaxy/original/2X/5/551bb6f0e4b000671f8a71f942a20627282ddc6c.png)

```
history_name = 'MetaWin Results'
history_id = gi.histories.create_history(name=history_name)['id']

dataset_1 = gi.tools.upload_file(Input1_forward, history_id=history_id, file_type='fastqsanger.gz')
dataset_1_id = dataset_1['outputs'][0]['id']

dataset_2 = gi.tools.upload_file(Input1_reverse, history_id=history_id, file_type='fastqsanger.gz')
dataset_2_id = dataset_2['outputs'][0]['id']

collection_payload = {
    'collection_type': 'list:paired',
    'name': 'Paired Collection',
    'element_identifiers': [{'name': 'forward', 'src': 'hda', 'id': dataset_1_id},
                            {'name': 'reverse', 'src': 'hda', 'id': dataset_2_id}]
}

uploaded_collection = gi.histories.create_dataset_collection(history_id, collection_payload)
# 设置工作流的输入参数
inputs = {
    'input1': {'src': 'hdca', 'id': uploaded_collection['id'], 'name': 'Collection of paired reads', 'format': 'fastqsanger.gz',
               'paired': True}
}

workflow_id = 'c0d6e75e9e3f9763' # 工作流程ID
invocation = gi.workflows.invoke_workflow(workflow_id, inputs=inputs)
gi.workflows.wait_for_invocation(invocation['id'])

```

When a paired collection is generated, it is found that there are 2 paireds instead of 1 pair, which causes the input of Collection of paired reads to be unable to connect.

---

<div class="post-metadata">

### Author: ![chenqiang](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@chenqiang](https://help.galaxyproject.org/u/chenqiang)
#### Post date: [February 4, 2024, 8:08am UTC](https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654/2 "2024-02-04T08:08:14Z")

</div>

Can you please help me solve this problem? I would be extremely grateful.

---

<div class="post-metadata">

### Author: ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)
#### Post date: [February 5, 2024, 5:39pm UTC](https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654/3 "2024-02-05T17:39:26Z")

</div>

Hi @chenqiang Let’s merge this into the other post. We also got your email message about the same. We’ll be getting back to you soon. If you could clarify which server you are doing this at in the other thread, that would help. [There was a problem in creating a paired read collection using API](https://help.galaxyproject.org/t/there-was-a-problem-in-creating-a-paired-read-collection-using-api/11655)

---

<div class="post-metadata">

### Author: ![jennaj](https://sea2.discourse-cdn.com/flex020/user_avatar/help.galaxyproject.org/jennaj/32/27_2.png) [@jennaj](https://help.galaxyproject.org/u/jennaj)
#### Post date: [February 5, 2024, 5:39pm UTC](https://help.galaxyproject.org/t/the-creation-of-the-collection-of-paired-reads-using-the-api-encountered-an-error/11654/4 "2024-02-05T17:39:30Z")

</div>


