Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for custom attributes and read type description of fastq #102

Merged
merged 19 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
should produce ENA_template_READ_TYPE.xml automatically from xsd
  • Loading branch information
cgirardot committed Dec 25, 2024
commit 9cbeff8857cf0dad8fb41655fb0748c8e9f8124a
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<py:choose xmlns:py="http://genshi.edgewall.org/" test="">
{%- for value in attributes %}
<READ_TYPE py:when="rtype.strip().lower() == '{{value | lower}}'">{{value}}</READ_TYPE>
{%- endfor %}
</py:choose>
9 changes: 5 additions & 4 deletions var/xsd_converter.py
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ def findkeys(node, query):
yield x

def main():
mapping = { "run":["FILE"], "experiment":["LIBRARY_SELECTION", "LIBRARY_SOURCE", "LIBRARY_STRATEGY"], "common":["PLATFORM"]}
mapping = { "run":["FILE", "READ_TYPE"], "experiment":["LIBRARY_SELECTION", "LIBRARY_SOURCE", "LIBRARY_STRATEGY"], "common":["PLATFORM"]}
template_names= ["ENA.project", "SRA.common", "SRA.experiment", "SRA.run", "SRA.sample", "SRA.study", "SRA.submission"]

for template_name in template_names:
@@ -102,6 +102,9 @@ def main():
if template_block == "FILE":
query_dict = (list(findkeys(xsd_dict, 'filetype')))[0]
xml_tree = query_dict['simpleType']['restriction']['enumeration']
elif template_block == "READ_TYPE":
query_dict = (list(findkeys(xsd_dict, 'READ_TYPE')))[0]
xml_tree = query_dict['simpleType']['restriction']['enumeration']
elif template_block == "LIBRARY_SELECTION":
query_dict = (list(findkeys(xsd_dict, 'typeLibrarySelection')))[0]
xml_tree = query_dict['restriction']['enumeration']
@@ -120,8 +123,7 @@ def main():

else:
break



print(f"Parsed values: {xml_tree}")

# Loading the xml jinja2 template for samples
@@ -135,7 +137,6 @@ def main():
fh.write(output_from_parsed_template)



if __name__ == "__main__":

main()