Skip to content

Commit 874b993

Browse files
Merge pull request #3199 from antgonza/fixes-after-2022.04
fixes after 2022.04
2 parents 688bf74 + 3330438 commit 874b993

File tree

5 files changed

+46
-32
lines changed

5 files changed

+46
-32
lines changed

Diff for: qiita_db/artifact.py

+29-17
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ class Artifact(qdb.base.QiitaObject):
5555
"""
5656
_table = "artifact"
5757

58+
@classmethod
59+
def iter(cls):
60+
"""Iterate over all artifacts in the database
61+
62+
Returns
63+
-------
64+
generator
65+
Yields a `Artifact` object for each artifact in the database,
66+
in order of ascending artifact_id
67+
"""
68+
with qdb.sql_connection.TRN:
69+
sql = """SELECT artifact_id FROM qiita.{}
70+
ORDER BY artifact_id""".format(cls._table)
71+
qdb.sql_connection.TRN.add(sql)
72+
73+
ids = qdb.sql_connection.TRN.execute_fetchflatten()
74+
75+
for id_ in ids:
76+
yield Artifact(id_)
77+
5878
@classmethod
5979
def iter_by_visibility(cls, visibility):
6080
r"""Iterator over the artifacts with the given visibility
@@ -79,17 +99,6 @@ def iter_by_visibility(cls, visibility):
7999
for a_id in qdb.sql_connection.TRN.execute_fetchflatten():
80100
yield cls(a_id)
81101

82-
@classmethod
83-
def iter_public(cls):
84-
r"""Iterator over the public artifacts available in the system
85-
86-
Returns
87-
-------
88-
generator of qiita_db.artifact.Artifact
89-
The public artifacts available in the system
90-
"""
91-
return cls.iter_by_visibility('public')
92-
93102
@staticmethod
94103
def types():
95104
"""Returns list of all artifact types available and their descriptions
@@ -615,12 +624,15 @@ def delete(cls, artifact_id):
615624
qdb.util.move_filepaths_to_upload_folder(
616625
study.id, filepaths)
617626

618-
sql = """UPDATE qiita.prep_template
619-
SET artifact_id = NULL
620-
WHERE prep_template_id IN %s"""
621-
qdb.sql_connection.TRN.add(
622-
sql, [tuple(pt.id for a in all_artifacts
623-
for pt in a.prep_templates)])
627+
# there are cases that an artifact would not be linked to a
628+
# study
629+
pt_ids = [tuple([pt.id]) for a in all_artifacts
630+
for pt in a.prep_templates]
631+
if pt_ids:
632+
sql = """UPDATE qiita.prep_template
633+
SET artifact_id = NULL
634+
WHERE prep_template_id IN %s"""
635+
qdb.sql_connection.TRN.add(sql, pt_ids)
624636
else:
625637
sql = """DELETE FROM qiita.parent_artifact
626638
WHERE artifact_id IN %s"""

Diff for: qiita_db/test/test_artifact.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ def test_iter(self):
4040
qdb.artifact.Artifact(7)]
4141
self.assertEqual(obs, exp)
4242

43-
def test_iter_public(self):
44-
obs = list(qdb.artifact.Artifact.iter_public())
45-
exp = []
46-
self.assertEqual(obs, exp)
43+
exp.extend([qdb.artifact.Artifact(8), qdb.artifact.Artifact(9)])
44+
self.assertEqual(list(qdb.artifact.Artifact.iter()), exp)
4745

4846
def test_create_type(self):
4947
obs = qdb.artifact.Artifact.types()

Diff for: qiita_pet/support_files/doc/source/processingdata/processing-recommendations.rst

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ Qiita currently has one active shotgun metagenomics data analysis pipeline: a pe
4848
bowtie2 alignment step with Woltka classification using either the WoLr1 or Rep200 databases.
4949
Below you will find more information about each of these options.
5050

51+
.. note::
52+
The bowtie2 settings are maximum and minimum mismatch penalties (mp=[1,1]), a
53+
penalty for ambiguities (np=1; default), read and reference gap open- and
54+
extend penalties (rdg=[0,1], rfg=[0,1]), a minimum alignment score for an
55+
alignment to be considered valid (score-min=[L,0,-0.05]), a defined number of
56+
distinct, valid alignments (k=16), and the suppression of SAM records for
57+
unaligned reads, as well as SAM headers (no-unal, no-hd).
58+
5159
The current workflow is as follows:
5260

5361
#. A single step per sample adapter removal (via `fastp <https://academic.oup.com/bioinformatics/article/34/17/i884/5093234>`_) and host filtering (via `minimap2 <https://academic.oup.com/bioinformatics/article/34/18/3094/4994778>`_); more information below.

Diff for: qiita_pet/templates/sitebase.html

+1-5
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,7 @@
532532
</li>
533533
<li role="separator" class="divider"></li>
534534
<li>
535-
{% if qiita_sha=="" %}
536-
<a href="#">
537-
{% else %}
538-
<a href="https://github.com/biocore/qiita/commit/{{qiita_sha}}">
539-
{% end %}
535+
<a href="https://github.com/qiita-spots/qiita/releases">
540536
<h6>
541537
<b>Current version:</b></br>
542538
{{qiita_version}} {{qiita_sha[0:7]}}

Diff for: qiita_ware/commands.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ def _ssh_session(p_url, private_key):
4343
"""
4444
scheme = p_url.scheme
4545
hostname = p_url.hostname
46-
# if port is '' Python 2.7.6 will raise an error
47-
try:
48-
port = p_url.port
49-
except Exception:
50-
port = 22
46+
47+
port = p_url.port
5148
username = p_url.username
5249

5350
if scheme == 'scp':
@@ -61,8 +58,11 @@ def _ssh_session(p_url, private_key):
6158

6259
# step 2: connect to fileserver
6360
key = RSAKey.from_private_key_file(private_key)
61+
# we need pkeys now based on
62+
# https://github.com/paramiko/paramiko/issues/1961
63+
pkeys = dict(pubkeys=['rsa-sha2-256', 'rsa-sha2-512'])
6464
ssh.connect(hostname, port=port, username=username,
65-
pkey=key, look_for_keys=False)
65+
pkey=key, look_for_keys=False, disabled_algorithms=pkeys)
6666
return ssh
6767
else:
6868
raise ValueError(

0 commit comments

Comments
 (0)