diff --git a/files/build-genomes-files-from-ncbi.py b/files/build-genomes-files-from-ncbi.py index 97638df..90a7f8f 100644 --- a/files/build-genomes-files-from-ncbi.py +++ b/files/build-genomes-files-from-ncbi.py @@ -17,6 +17,8 @@ "Coccidioides immitis" ] +ASSEMBLIES_URL = "https://hgdownload.soe.ucsc.edu/hubs/BRC/assemblyList.json" + OUTPUT_PATH = "files/source/genomes-from-ncbi.tsv" def build_taxonomy_request_body(taxa): @@ -45,6 +47,7 @@ def get_genome_row(genome_info): "coverage": genome_info["assembly_stats"].get("genome_coverage"), "gcPercent": genome_info["assembly_stats"]["gc_percent"], "annotationStatus": genome_info["annotation_info"].get("status"), + "pairedAccession": genome_info["paired_accession"], } def get_genomes_df(tax_ids): @@ -53,9 +56,15 @@ def get_genomes_df(tax_ids): def build_genomes_files(): print("Building files") - df = get_genomes_df(get_tax_ids(TAXA)) + genomes_source_df = get_genomes_df(get_tax_ids(TAXA)) + assemblies_df = pd.DataFrame(requests.get(ASSEMBLIES_URL).json()["data"])[["ucscBrowser", "genBank", "refSeq"]] + + gen_bank_merge_df = genomes_source_df.merge(assemblies_df, how="left", left_on="pairedAccession", right_on="genBank") + ref_seq_merge_df = genomes_source_df.merge(assemblies_df, how="left", left_on="accession", right_on="refSeq") + + result_df = gen_bank_merge_df.combine_first(ref_seq_merge_df) - df.to_csv(OUTPUT_PATH, index=False, sep="\t") + result_df.to_csv(OUTPUT_PATH, index=False, sep="\t") print(f"Wrote to {OUTPUT_PATH}") diff --git a/files/source/genomes-from-ncbi.tsv b/files/source/genomes-from-ncbi.tsv index 4ee8e1d..7141197 100644 --- a/files/source/genomes-from-ncbi.tsv +++ b/files/source/genomes-from-ncbi.tsv @@ -1,21 +1,21 @@ -taxon taxonomyId accession isRef level chromosomeCount length scaffoldCount scaffoldN50 scaffoldL50 coverage gcPercent annotationStatus -Mycobacterium tuberculosis H37Rv 83332 GCF_000195955.2 True Complete Genome 1.0 4411532 1 4411532 1 65.5 -Plasmodium falciparum 3D7 36329 GCF_000002765.6 True Complete Genome 14.0 23292622 14 1687656 5 100.0x 19.5 Full annotation -Plasmodium yoelii 5861 GCF_900002385.2 True Complete Genome 14.0 23043114 14 2046250 5 100.0x 21.5 Full annotation -Coccidioides posadasii str. Silveira 443226 GCF_018416015.2 True Complete Genome 9.0 28193268 9 8079863 2 475.0x 46.5 Full annotation -Plasmodium vinckei vinckei 54757 GCF_900681995.1 True Complete Genome 14.0 18338688 14 1692345 5 155.0x 23.0 Full annotation -Toxoplasma gondii ME49 508771 GCF_000006565.2 True Chromosome 14.0 65633124 2276 4973582 6 26.5x 52.5 -Anopheles gambiae 7165 GCF_943734735.2 True Chromosome 3.0 264451381 190 99149756 2 54.0x 44.5 Full annotation -Plasmodium vivax 5855 GCF_000002415.2 True Chromosome 14.0 27007701 2747 1678596 6 42.5 Full annotation -Culex pipiens pallens 42434 GCF_016801865.2 True Chromosome 3.0 566339288 289 186194774 2 250.0x 37.0 Full annotation -Coccidioides immitis RS 246410 GCF_000149335.2 True Scaffold 28947925 6 4323945 3 46.0 Full annotation -Mycobacterium tuberculosis H37Rv 83332 GCF_000277735.2 False Complete Genome 1.0 4411709 1 4411709 1 65.5 -Mycobacterium tuberculosis 1773 GCF_030566675.1 False Complete Genome 1.0 4516435 1 4516435 1 20.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_963525475.1 False Complete Genome 1.0 4469156 1 4469156 1 100.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_017901095.1 False Complete Genome 1.0 4459449 1 4459449 1 111.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_030566105.1 False Complete Genome 1.0 4459087 1 4459087 1 20.0x 65.0 -Mycobacterium tuberculosis 1773 GCF_033124885.1 False Complete Genome 1.0 4456234 1 4456234 1 257.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_014899985.1 False Complete Genome 1.0 4450340 1 4450340 1 92.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_040208995.1 False Complete Genome 1.0 4448271 1 4448271 1 208.6x 65.5 -Mycobacterium tuberculosis 1773 GCF_014899965.1 False Complete Genome 1.0 4447644 1 4447644 1 51.0x 65.5 -Mycobacterium tuberculosis 1773 GCF_040208985.1 False Complete Genome 1.0 4445673 1 4445673 1 232.2x 65.5 +taxon taxonomyId accession isRef level chromosomeCount length scaffoldCount scaffoldN50 scaffoldL50 coverage gcPercent annotationStatus pairedAccession ucscBrowser genBank refSeq +Mycobacterium tuberculosis H37Rv 83332 GCF_000195955.2 True Complete Genome 1.0 4411532 1 4411532 1 65.5 GCA_000195955.2 +Plasmodium falciparum 3D7 36329 GCF_000002765.6 True Complete Genome 14.0 23292622 14 1687656 5 100.0x 19.5 Full annotation GCA_000002765.3 https://genome.ucsc.edu/h/GCF_000002765.5 GCA_000002765.3 GCF_000002765.5 +Plasmodium yoelii 5861 GCF_900002385.2 True Complete Genome 14.0 23043114 14 2046250 5 100.0x 21.5 Full annotation GCA_900002385.2 https://genome.ucsc.edu/h/GCF_900002385.2 GCA_900002385.2 GCF_900002385.2 +Coccidioides posadasii str. Silveira 443226 GCF_018416015.2 True Complete Genome 9.0 28193268 9 8079863 2 475.0x 46.5 Full annotation GCA_018416015.2 https://genome.ucsc.edu/h/GCA_018416015.2 GCA_018416015.2 GCF_018416015.1 +Plasmodium vinckei vinckei 54757 GCF_900681995.1 True Complete Genome 14.0 18338688 14 1692345 5 155.0x 23.0 Full annotation GCA_900681995.1 https://genome.ucsc.edu/h/GCF_900681995.1 GCA_900681995.1 GCF_900681995.1 +Toxoplasma gondii ME49 508771 GCF_000006565.2 True Chromosome 14.0 65633124 2276 4973582 6 26.5x 52.5 GCA_000006565.2 https://genome.ucsc.edu/h/GCF_000006565.2 GCA_000006565.2 GCF_000006565.2 +Anopheles gambiae 7165 GCF_943734735.2 True Chromosome 3.0 264451381 190 99149756 2 54.0x 44.5 Full annotation GCA_943734735.2 https://genome.ucsc.edu/h/GCF_943734735.2 GCA_943734735.2 GCF_943734735.2 +Plasmodium vivax 5855 GCF_000002415.2 True Chromosome 14.0 27007701 2747 1678596 6 42.5 Full annotation GCA_000002415.2 https://genome.ucsc.edu/h/GCF_000002415.2 GCA_000002415.2 GCF_000002415.2 +Culex pipiens pallens 42434 GCF_016801865.2 True Chromosome 3.0 566339288 289 186194774 2 250.0x 37.0 Full annotation GCA_016801865.2 +Coccidioides immitis RS 246410 GCF_000149335.2 True Scaffold 28947925 6 4323945 3 46.0 Full annotation GCA_000149335.2 https://genome.ucsc.edu/h/GCF_000149335.2 GCA_000149335.2 GCF_000149335.2 +Mycobacterium tuberculosis H37Rv 83332 GCF_000277735.2 False Complete Genome 1.0 4411709 1 4411709 1 65.5 GCA_000277735.2 +Mycobacterium tuberculosis 1773 GCF_030566675.1 False Complete Genome 1.0 4516435 1 4516435 1 20.0x 65.5 GCA_030566675.1 +Mycobacterium tuberculosis 1773 GCF_963525475.1 False Complete Genome 1.0 4469156 1 4469156 1 100.0x 65.5 GCA_963525475.1 +Mycobacterium tuberculosis 1773 GCF_017901095.1 False Complete Genome 1.0 4459449 1 4459449 1 111.0x 65.5 GCA_017901095.1 +Mycobacterium tuberculosis 1773 GCF_030566105.1 False Complete Genome 1.0 4459087 1 4459087 1 20.0x 65.0 GCA_030566105.1 +Mycobacterium tuberculosis 1773 GCF_033124885.1 False Complete Genome 1.0 4456234 1 4456234 1 257.0x 65.5 GCA_033124885.1 +Mycobacterium tuberculosis 1773 GCF_014899985.1 False Complete Genome 1.0 4450340 1 4450340 1 92.0x 65.5 GCA_014899985.1 +Mycobacterium tuberculosis 1773 GCF_040208995.1 False Complete Genome 1.0 4448271 1 4448271 1 208.6x 65.5 GCA_040208995.1 +Mycobacterium tuberculosis 1773 GCF_014899965.1 False Complete Genome 1.0 4447644 1 4447644 1 51.0x 65.5 GCA_014899965.1 +Mycobacterium tuberculosis 1773 GCF_040208985.1 False Complete Genome 1.0 4445673 1 4445673 1 232.2x 65.5 GCA_040208985.1