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

Work around failures in ENA XML retrieval to still produce useful info #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pinin4fjords
Copy link

@pinin4fjords pinin4fjords commented Jul 17, 2023

Sometimes with ffq the ENA calls fail, like this:

 % ffq SRR12215634 
[2023-07-17 11:47:40,590]    INFO Parsing run SRR12215634
[2023-07-17 11:47:40,756]   ERROR 404 Client Error:  for url: https://www.ebi.ac.uk/ena/browser/api/xml/SRR12215634/
[2023-07-17 11:47:40,757]   ERROR 'NoneType' object has no attribute 'text'
usage: ffq [-h] [-o OUT] [-l LEVEL] [--ftp] [--aws] [--gcp] [--ncbi] [--split] [--verbose] [--version] IDs [IDs ...]
ffq: error: For possible failure modes, please see https://github.com/pachterlab/ffq#failure-modes

This is down to upstream errors at the ENA: https://www.ebi.ac.uk/ena/browser/view/SRR12215634 ,

What I'd really like is for ffq to do what it can without the ENA info. In this PR I illustrate that for runs. With these changes the above failing call now produces a useful response lacking only the specific things that come from ENA:

{
    "SRR12215634": {
        "accession": "SRR12215634",
        "experiment": null,
        "study": "SRP271756",
        "sample": "SRS7001069",
        "title": null,
        "attributes": {},
        "files": {
            "ftp": null,
            "aws": [
                {
                    "accession": "SRR12215634",
                    "filename": "C6_3_Pre_possorted_genome_bam.bam.1",
                    "filetype": "bam",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "aws",
                    "url": "s3://sra-pub-src-18/SRR12215634/C6_3_Pre_possorted_genome_bam.bam.1"
                },
                {
                    "accession": "SRR12215634",
                    "filename": "C6_3_Pre_possorted_genome_bam.bam.1",
                    "filetype": "bam",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "aws",
                    "url": "https://sra-pub-src-2.s3.amazonaws.com/SRR12215634/C6_3_Pre_possorted_genome_bam.bam.1"
                },
                {
                    "accession": "SRR12215634",
                    "filename": "SRR12215634",
                    "filetype": "sra",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "aws",
                    "url": "https://sra-pub-run-odp.s3.amazonaws.com/sra/SRR12215634/SRR12215634"
                },
                {
                    "accession": "SRR12215634",
                    "filename": "SRR12215634.lite.1",
                    "filetype": "sra",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "aws",
                    "url": "s3://sra-pub-zq-3/SRR12215634/SRR12215634.lite.1"
                }
            ],
            "gcp": [
                {
                    "accession": "SRR12215634",
                    "filename": "SRR12215634.lite.1",
                    "filetype": "sra",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "gcp",
                    "url": "gs://sra-pub-zq-7/SRR12215634/SRR12215634.lite.1"
                }
            ],
            "ncbi": [
                {
                    "accession": "SRR12215634",
                    "filename": "SRR12215634.lite.1",
                    "filetype": "sra",
                    "filesize": null,
                    "filenumber": 1,
                    "md5": null,
                    "urltype": "ncbi",
                    "url": "https://sra-downloadb.be-md.ncbi.nlm.nih.gov/sos4/sra-pub-zq-1/SRR012/12215/SRR12215634/SRR12215634.lite.1"
                }
            ]
        }
    }
}

Similar changes could be made to the other parse_x functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant