Skip to content

Commit aa0aed1

Browse files
authored
Merge pull request #27 from usegalaxy-eu/NCBI-taxon-ID
Taxon ID parsing improvements
2 parents d504072 + 1b16ee7 commit aa0aed1

File tree

45 files changed

+179
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+179
-16
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,22 @@ A Webin can be made [here](https://www.ebi.ac.uk/ena/submit/sra/#home) if you do
8181

8282
To avoid exposing your credentials through the terminal history, it is recommended to make use of a `.secret.yml` file, containing your password and username keywords. An example is given in the root of this directory.
8383

84-
### Switching between ENA sample checklists
84+
### ENA sample checklists
8585

8686
You can specify ENA sample checklist using the `--checklist` parameter. By default the ENA default sample checklist is used supporting the minimum information required for the sample (ERC000011). The supported checklists are listed on the [ENA website](https://www.ebi.ac.uk/ena/browser/checklists). This website will also describe which Field Names you have to use in the header of your sample tsv table. The Field Names will be automatically mapped in the outputted xml if the correct `--checklist` parameter is given.
8787

88+
#### Fixed sample columns
89+
90+
The command line tool will automatically fetch the correct scientific name based on the taxon ID or fetch the taxon ID based on the scientific name. Both can be given and no overwrite will be done.
91+
92+
- Mandatory: *alias*, *title*, *sample_description* and either *scientific_name* or *taxon_id* (preferred)
93+
- Optional: *common_name*
94+
95+
| alias | title | taxon_id | scientific_name | common_name | sample_description |
96+
|----------------|----------------|----------|-------------------------------------------------|-------------|----------------------|
97+
| sample_alias_4 | sample_title_2 | 2697049 | Severe acute respiratory syndrome coronavirus 2 | covid-19 | sample_description_1 |
98+
| sample_alias_5 | sample_title_3 | 2697049 | Severe acute respiratory syndrome coronavirus 2 | covid-19 | sample_description_2 |
99+
88100
#### Viral submissions
89101

90102
If you want to submit viral samples you can use the [ENA virus pathogen](https://www.ebi.ac.uk/ena/browser/view/ERC000033) checklist by adding `ERC000033` to the checklist parameter. Check out our [viral example command](#test-the-tool) as demonstration. Please use the [ENA virus pathogen](https://www.ebi.ac.uk/ena/browser/view/ERC000033) checklist on the website of ENA to know which values are allowed/possible in the `restricted text` and `text choice` fields.

ena_upload/ena_upload.py

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ def create_dataframe(schema_tables, action):
4444
schema_dataframe = {}
4545

4646
for schema, table in schema_tables.items():
47-
df = pd.read_csv(table, sep='\t', comment='#')
47+
df = pd.read_csv(table, sep='\t', comment='#', dtype = str)
4848
# checking for optional columns and if not present adding them
49-
optional_columns = ['accession', 'submission_date', 'status']
49+
if schema == 'sample':
50+
optional_columns = ['accession', 'submission_date', 'status', 'scientific_name', 'taxon_id']
51+
else:
52+
optional_columns = ['accession', 'submission_date', 'status']
5053
for header in optional_columns:
5154
if not header in df.columns:
5255
if header == 'status':
@@ -314,6 +317,24 @@ def get_taxon_id(scientific_name):
314317
msg = f'Oops, no taxon ID avaible for {scientific_name}. Is it a valid scientific name?'
315318
sys.exit(msg)
316319

320+
def get_scientific_name(taxon_id):
321+
"""Get scientific name for input taxon_id.
322+
323+
:param taxon_id: NCBI taxonomy identifier
324+
:return scientific_name: scientific name of sample that distinguishes its taxonomy
325+
"""
326+
# endpoint for scientific name
327+
url = 'http://www.ebi.ac.uk/ena/taxonomy/rest/tax-id'
328+
session = requests.Session()
329+
session.trust_env = False
330+
r = session.get(f"{url}/{str(taxon_id).strip()}")
331+
try:
332+
taxon_id = r.json()['scientificName']
333+
return taxon_id
334+
except ValueError:
335+
msg = f'Oops, no scientific name avaible for {taxon_id}. Is it a valid taxon_id?'
336+
sys.exit(msg)
337+
317338

318339
def submit_data(file_paths, password, webin_id):
319340
"""Submit data to webin ftp server.
@@ -722,15 +743,22 @@ def main():
722743
submit_data(file_paths, password, webin_id)
723744

724745
# when adding sample
725-
# update schema_targets with taxon ids
746+
# update schema_targets with taxon ids or scientific names
726747
if 'sample' in schema_targets:
727748
df = schema_targets['sample']
728-
729-
# retrieve taxon id using scientific name
730-
print('retrieving taxon IDs...')
731-
taxonID = df['scientific_name'].apply(get_taxon_id).values
732-
print('taxon IDs are retrieved')
733-
df.loc[:, 'taxon_id'] = taxonID
749+
print('retrieving taxon IDs and scientific names if needed')
750+
for index, row in df.iterrows():
751+
if pd.notna(row['scientific_name']) and pd.isna(row['taxon_id']):
752+
# retrieve taxon id using scientific name
753+
taxonID = get_taxon_id(row['scientific_name'])
754+
df.loc[index, 'taxon_id'] = taxonID
755+
elif pd.notna(row['taxon_id']) and pd.isna(row['scientific_name']):
756+
# retrieve scientific name using taxon id
757+
scientificName = get_scientific_name(row['taxon_id'])
758+
df.loc[index, 'scientific_name'] = scientificName
759+
elif pd.isna(row['taxon_id']) and pd.isna(row['scientific_name']):
760+
sys.exit(f"No taxon_id or scientific_name was given with sample {row['alias']}.")
761+
print('taxon IDs and scientific names are retrieved')
734762
schema_targets['sample'] = df
735763

736764
# ? need to add a place holder for setting up

ena_upload/templates/ENA_template_samples.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000011.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000012.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000013.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000014.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000015.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000016.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000017.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000018.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000019.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000020.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000021.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000022.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000023.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000024.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000025.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000027.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000028.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000029.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000030.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000031.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000032.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000033.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000034.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000035.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000036.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000037.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000038.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000039.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

ena_upload/templates/ENA_template_samples_ERC000040.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def attributetest(row, column):
1515
<SAMPLE_NAME>
1616
<TAXON_ID>${row.taxon_id}</TAXON_ID>
1717
<SCIENTIFIC_NAME>${row.scientific_name}</SCIENTIFIC_NAME>
18+
<py:if test="attributetest(row, 'common_name')">
19+
<COMMON_NAME>${row.common_name}</COMMON_NAME>
20+
</py:if>
1821
</SAMPLE_NAME>
1922
<DESCRIPTION>${row.sample_description}</DESCRIPTION>
2023
<SAMPLE_ATTRIBUTES>

0 commit comments

Comments
 (0)