KwanLab / Autometa

Autometa: Automated Extraction of Genomes from Shotgun Metagenomes
https://autometa.readthedocs.io
Other
40 stars 15 forks source link

Add singularity image url when autometa is on bioconda #173

Closed chasemc closed 1 year ago

chasemc commented 3 years ago

Lots code like below will be hanging out in the nextflow ".nf" local processes.

 if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
        container "https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE"
    } else {...

Once autometa is on bioconda there will be a biocontainer url for the singularity image. Then that can replace https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE

evanroyrees commented 2 years ago

See also #5

evanroyrees commented 2 years ago

While this is being done, the autometa version can also be emitted and stored (Once #269 is merged)

>>> autometa --version
autometa: 2.0.4

e.g. replace echo "TODO" > autometa.version.txt

# REPLACE:
echo "TODO" > autometa.version.txt
# WITH:
autometa --version > autometa.version.txt
evanroyrees commented 2 years ago

It looks like some of the autometa versions are now available


import requests
from bs4 import BeautifulSoup

url = "https://depot.galaxyproject.org/singularity/"
resp = requests.get(url)
soup = BeautifulSoup(resp.text)
[''.join([url, a.text]) for a in soup.find_all("a") if 'autometa' in a.text]
>>>
['https://depot.galaxyproject.org/singularity/autometa:2.0.0--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.1--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.2--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.3--pyh5e36f6f_0']
chasemc commented 2 years ago

Can also use quay.io api:

import json
import requests

url = 'https://quay.io/api/v1/repository/biocontainers/autometa'
r = requests.get(url, headers={'Accept-encoding': 'gzip'}, timeout=12)
json_decoder = json.JSONDecoder()
decoded_request = json_decoder.decode(r.text)
evanroyrees commented 1 year ago

Looks like 2.2.0 is now also available as well

import requests
from bs4 import BeautifulSoup

url = "https://depot.galaxyproject.org/singularity/"
resp = requests.get(url)
soup = BeautifulSoup(resp.text)
[''.join([url, a.text]) for a in soup.find_all("a") if 'autometa' in a.text]
>>>
['https://depot.galaxyproject.org/singularity/autometa:2.0.0--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.1--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.2--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.0.3--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.1.0--pyh5e36f6f_0',
 'https://depot.galaxyproject.org/singularity/autometa:2.2.0--pyh7cba7a3_0']

Or through quay.io api as suggested by @chasemc

import json
import requests

url = 'https://quay.io/api/v1/repository/biocontainers/autometa'
r = requests.get(url, headers={'Accept-encoding': 'gzip'}, timeout=12)
json.loads(r.text)
>>>
{'namespace': 'biocontainers',
 'name': 'autometa',
 'kind': 'image',
 'description': None,
 'is_public': True,
 'is_organization': True,
 'is_starred': False,
 'status_token': '',
 'trust_enabled': False,
 'tag_expiration_s': 1209600,
 'is_free_account': True,
 'state': 'NORMAL',
 'tags': {'2.2.0--pyh7cba7a3_0': {'name': '2.2.0--pyh7cba7a3_0',
   'size': 370344629,
   'last_modified': 'Mon, 19 Dec 2022 19:26:10 -0000',
   'manifest_digest': 'sha256:3ee6969901c532b8736bc8bfd16739695751da870487ef8b6747be0a477df689'},
  '2.1.0--pyh5e36f6f_0': {'name': '2.1.0--pyh5e36f6f_0',
   'size': 354126445,
   'last_modified': 'Fri, 20 May 2022 15:54:03 -0000',
   'manifest_digest': 'sha256:0218a75e97b25934b22058e8cea1317a6c1affd0972682d4e8c44550cb1ad9e4'},
  '2.0.3--pyh5e36f6f_0': {'name': '2.0.3--pyh5e36f6f_0',
   'size': 353519359,
   'last_modified': 'Fri, 08 Apr 2022 01:03:15 -0000',
   'manifest_digest': 'sha256:ef1e3e2cebcb607c37cbc22697026f203050459932e24005e937334ee89bbb80'},
  '2.0.2--pyh5e36f6f_0': {'name': '2.0.2--pyh5e36f6f_0',
   'size': 348200447,
   'last_modified': 'Tue, 15 Mar 2022 19:21:03 -0000',
   'manifest_digest': 'sha256:de24cfdb2d9151f94f8e2191ae3757fa38d31fa63f72e169b16d71a05e104d8e'},
  '2.0.1--pyh5e36f6f_0': {'name': '2.0.1--pyh5e36f6f_0',
   'size': 336469181,
   'last_modified': 'Sun, 27 Feb 2022 01:49:40 -0000',
   'manifest_digest': 'sha256:02c3857a1f0ac2f617253b57f39f79c437dbfd5258a80fe589447316cca45d12'},
  '2.0.0--pyh5e36f6f_0': {'name': '2.0.0--pyh5e36f6f_0',
   'size': 376221881,
   'last_modified': 'Thu, 10 Feb 2022 14:52:58 -0000',
   'manifest_digest': 'sha256:e51f3fd05da61ec84ff8e2d1830e376355301a2227b63e9bb98e00de69530b41'}},
 'can_write': False,
 'can_admin': False}
evanroyrees commented 1 year ago

This was added with #316