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

Library fields #1486

Merged
merged 2 commits into from Oct 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions qiita_ware/ebi.py
Expand Up @@ -107,9 +107,7 @@ class EBISubmission(object):
'NEXTSEQ 500', 'UNSPECIFIED']}
xmlns_xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi_noNSL = "ftp://ftp.sra.ebi.ac.uk/meta/xsd/sra_1_3/SRA.%s.xsd"
experiment_library_fields = [
'library_strategy', 'library_source', 'library_selection',
'library_layout']
experiment_library_fields = ['library_strategy']

def __init__(self, preprocessed_data_id, action):
error_msgs = []
Expand Down Expand Up @@ -439,6 +437,18 @@ def generate_experiment_xml(self):
library_name = ET.SubElement(library_descriptor, 'LIBRARY_NAME')
library_name.text = self._get_library_name(sample_name)

# hardcoding some values,
# see https://github.com/biocore/qiita/issues/1485
library_source = ET.SubElement(library_descriptor,
"LIBRARY_SOURCE")
library_source.text = "METAGENOMIC"
library_selection = ET.SubElement(library_descriptor,
"LIBRARY_SELECTION")
library_selection.text = "PCR"
library_layout = ET.SubElement(library_descriptor,
"LIBRARY_LAYOUT")
ET.SubElement(library_layout, "SINGLE")

lcp = ET.SubElement(library_descriptor,
"LIBRARY_CONSTRUCTION_PROTOCOL")
lcp.text = escape(clean_whitespace(
Expand Down
63 changes: 6 additions & 57 deletions qiita_ware/test/test_ebi.py
Expand Up @@ -740,6 +740,9 @@ def test_generate_send_sequences_cmd(self):
640194" />
<LIBRARY_DESCRIPTOR>
<LIBRARY_NAME>1.SKB2.640194</LIBRARY_NAME>
<LIBRARY_SOURCE>METAGENOMIC</LIBRARY_SOURCE>
<LIBRARY_SELECTION>PCR</LIBRARY_SELECTION>
<LIBRARY_LAYOUT><SINGLE /></LIBRARY_LAYOUT>
<LIBRARY_CONSTRUCTION_PROTOCOL>This analysis was done as in Caporaso \
et al 2011 Genome research. The PCR primers (F515/R806) were developed \
against the V4 region of the 16S rRNA (both bacteria and archaea), which we \
Expand Down Expand Up @@ -826,6 +829,9 @@ def test_generate_send_sequences_cmd(self):
640195" />
<LIBRARY_DESCRIPTOR>
<LIBRARY_NAME>1.SKB3.640195</LIBRARY_NAME>
<LIBRARY_SOURCE>METAGENOMIC</LIBRARY_SOURCE>
<LIBRARY_SELECTION>PCR</LIBRARY_SELECTION>
<LIBRARY_LAYOUT><SINGLE /></LIBRARY_LAYOUT>
<LIBRARY_CONSTRUCTION_PROTOCOL>This analysis was done as in Caporaso \
et al 2011 Genome research. The PCR primers (F515/R806) were developed \
against the V4 region of the 16S rRNA (both bacteria and archaea), which we \
Expand Down Expand Up @@ -982,18 +988,6 @@ def test_generate_send_sequences_cmd(self):
</TESTING>
"""

GENLIBDESC = """<design foo="bar">
<LIBRARY_DESCRIPTOR>
<LIBRARY_NAME>sample</LIBRARY_NAME>
<LIBRARY_STRATEGY>OTHER</LIBRARY_STRATEGY>
<LIBRARY_SOURCE>METAGENOMIC</LIBRARY_SOURCE>
<LIBRARY_SELECTION>unspecified</LIBRARY_SELECTION>
<LIBRARY_CONSTRUCTION_PROTOCOL>libconsprot
</LIBRARY_CONSTRUCTION_PROTOCOL>
</LIBRARY_DESCRIPTOR>
</design>
"""

GENSPOTDESC = """<design foo="bar">
<SPOT_DESCRIPTOR>
<SPOT_DECODE_SPEC />
Expand All @@ -1007,51 +1001,6 @@ def test_generate_send_sequences_cmd(self):
</design>
"""

SAMPLE_TEMPLATE_ERROR = (
"sample_name\tcollection_timestamp\tdescription\thas_extracted_data\t"
"has_physical_specimen\thost_subject_id\tlatitude\tlongitude\t"
"physical_location\trequired_sample_info_status_id\tsample_type\t"
"str_column\n"
"sample1\t2014-05-29 12:24:51\tTest Sample 1\tTrue\tTrue\tNotIdentified\t"
"42.42\t41.41\tlocation1\t1\ttype1\tValue for sample 1\n"
"sample2\t2014-05-29 12:24:51\tTest Sample 2\tTrue\tTrue\tNotIdentified\t"
"4.2\t1.1\tlocation1\t1\ttype1\tValue for sample 2\n"
"sample3\t2014-05-29 12:24:51\tTest Sample 3\tTrue\tTrue\tNotIdentified\t"
"4.8\t4.41\tlocation1\t1\ttype1\tValue for sample 3\n")

EXP_SAMPLE_TEMPLATE = (
"sample_name\tcollection_timestamp\tdescription\thas_extracted_data\t"
"has_physical_specimen\thost_subject_id\tlatitude\tlongitude\t"
"physical_location\trequired_sample_info_status_id\tsample_type\t"
"str_column\ttaxon_id\tscientific_name\n"
"sample1\t2014-05-29 12:24:51\tTest Sample 1\tTrue\tTrue\tNotIdentified\t"
"42.42\t41.41\tlocation1\t1\ttype1\tValue for sample 1\t9606\t"
"homo sapiens\n"
"sample2\t2014-05-29 12:24:51\tTest Sample 2\tTrue\tTrue\tNotIdentified\t"
"4.2\t1.1\tlocation1\t1\ttype1\tValue for sample 2\t9606\thomo sapiens\n"
"sample3\t2014-05-29 12:24:51\tTest Sample 3\tTrue\tTrue\tNotIdentified\t"
"4.8\t4.41\tlocation1\t1\ttype1\tValue for sample 3\t9606\thomo sapiens\n")

EXP_PREP_TEMPLATE = (
"sample_name\tcenter_name\tcenter_project_name\tdata_type_id\t"
"temp_status_id\tstr_column\tplatform\texperiment_design_description"
"\tlibrary_construction_protocol"
"\nsample1\tANL\tTest Project\t2\t1\tValue for sample 3"
"\tILLUMINA\texp design\tlib protocol\n"
"sample2\tANL\tTest Project\t2\t1\tValue for sample 1"
"\tILLUMINA\texp design\tlib protocol\n"
"sample3\tANL\tTest Project\t2\t1\tValue for sample 2"
"\tILLUMINA\texp design\tlib protocol\n")

EXP_PREP_TEMPLATE_FILTERED = (
"sample_name\tcenter_name\tcenter_project_name\tdata_type_id\t"
"temp_status_id\tstr_column\tplatform\texperiment_design_description"
"\tlibrary_construction_protocol"
"\nsample1\tANL\tTest Project\t2\t1\tValue for sample 3"
"\tILLUMINA\texp design\tlib protocol\n"
"sample2\tANL\tTest Project\t2\t1\tValue for sample 1"
"\tILLUMINA\texp design\tlib protocol\n")


if __name__ == "__main__":
main()