index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
45,471
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/detectors/tood.py
22,23
6,24
set_epoch
TOOD
23,24
23,24
@DETECTORS.register_module() class TOOD(SingleStageDetector): r"""Implementation of `TOOD: Task-aligned One-stage Object Detection. <https://arxiv.org/abs/2108.07755>`_.""" def __init__(self, backbone, neck, bbox_head, train_cfg=None, ...
@DETECTORS.register_module() class TOOD(SingleStageDetector): r"""Implementation of `TOOD: Task-aligned One-stage Object Detection. <https://arxiv.org/abs/2108.07755>`_.""" def __init__(self, backbone, neck, bbox_head, train_cfg=None, ...
self.bbox_head.epoch = epoch
self.bbox_head.epoch = epoch
3
186
14
200
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .single_stage import SingleStageDetector @DETECTORS.register_module() class TOOD(SingleStageDetector): r"""Implementation of `TOOD: Task-aligned One-stage Object Detection. <https://arxiv.org/abs/2108.07755>`_.""" def __...
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .single_stage import SingleStageDetector @DETECTORS.register_module() class TOOD(SingleStageDetector): r"""Implementation of `TOOD: Task-aligned One-stage Object Detection. <https://arxiv.org/abs/2108.07755>`_.""" def __...
45,472
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/detectors/trident_faster_rcnn.py
34,35
6,71
simple_test
TridentFasterRCNN
36,49
35,49
@DETECTORS.register_module() class TridentFasterRCNN(FasterRCNN): """Implementation of `TridentNet <https://arxiv.org/abs/1901.01892>`_""" def __init__(self, backbone, rpn_head, roi_head, train_cfg, test_cfg, ...
@DETECTORS.register_module() class TridentFasterRCNN(FasterRCNN): """Implementation of `TridentNet <https://arxiv.org/abs/1901.01892>`_""" def __init__(self, backbone, rpn_head, roi_head, train_cfg, test_cfg, ...
assert self.with_bbox, 'Bbox head must be implemented.' x = self.extract_feat(img) if proposals is None: num_branch = (self.num_branch if self.test_branch_idx == -1 else 1) trident_img_metas = img_metas * num_branch proposal_list = self.rpn_head.simple_test_rp...
"""Test without augmentation.""" assert self.with_bbox, 'Bbox head must be implemented.' x = self.extract_feat(img) if proposals is None: num_branch = (self.num_branch if self.test_branch_idx == -1 else 1) trident_img_metas = img_metas * num_branch pro...
53
706
199
905
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .faster_rcnn import FasterRCNN @DETECTORS.register_module() class TridentFasterRCNN(FasterRCNN): """Implementation of `TridentNet <https://arxiv.org/abs/1901.01892>`_""" def __init__(self, backbone, ...
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .faster_rcnn import FasterRCNN @DETECTORS.register_module() class TridentFasterRCNN(FasterRCNN): """Implementation of `TridentNet <https://arxiv.org/abs/1901.01892>`_""" def __init__(self, backbone, ...
45,473
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/roi_heads/bbox_heads/scnet_bbox_head.py
31,32
6,78
_forward_cls_reg
SCNetBBoxHead
33,59
32,59
@HEADS.register_module() class SCNetBBoxHead(ConvFCBBoxHead): """BBox head for `SCNet <https://arxiv.org/abs/2012.10150>`_. This inherits ``ConvFCBBoxHead`` with modified forward() function, allow us to get intermediate shared feature. """ def _forward_shared(self, x): """Forward function ...
@HEADS.register_module() class SCNetBBoxHead(ConvFCBBoxHead): """BBox head for `SCNet <https://arxiv.org/abs/2012.10150>`_. This inherits ``ConvFCBBoxHead`` with modified forward() function, allow us to get intermediate shared feature. """ def _forward_shared(self, x): """Forward function ...
x_cls = x x_reg = x for conv in self.cls_convs: x_cls = conv(x_cls) if x_cls.dim() > 2: if self.with_avg_pool: x_cls = self.avg_pool(x_cls) x_cls = x_cls.flatten(1) for fc in self.cls_fcs: x_cls = self.relu(fc(x_cls...
"""Forward function for classification and regression parts.""" x_cls = x x_reg = x for conv in self.cls_convs: x_cls = conv(x_cls) if x_cls.dim() > 2: if self.with_avg_pool: x_cls = self.avg_pool(x_cls) x_cls = x_cls.flatten(1...
75
449
327
776
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.models.builder import HEADS from .convfc_bbox_head import ConvFCBBoxHead @HEADS.register_module() class SCNetBBoxHead(ConvFCBBoxHead): """BBox head for `SCNet <https://arxiv.org/abs/2012.10150>`_. This inherits ``ConvFCBBoxHead`` with modified forwar...
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.models.builder import HEADS from .convfc_bbox_head import ConvFCBBoxHead @HEADS.register_module() class SCNetBBoxHead(ConvFCBBoxHead): """BBox head for `SCNet <https://arxiv.org/abs/2012.10150>`_. This inherits ``ConvFCBBoxHead`` with modified forwar...
45,474
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/roi_heads/double_roi_head.py
17,18
6,35
_bbox_forward
DoubleHeadRoIHead
19,35
18,35
@HEADS.register_module() class DoubleHeadRoIHead(StandardRoIHead): """RoI head for Double Head RCNN. https://arxiv.org/abs/1904.06493 """ def __init__(self, reg_roi_scale_factor, **kwargs): super(DoubleHeadRoIHead, self).__init__(**kwargs) self.reg_roi_scale_factor = reg_roi_scale_fact...
@HEADS.register_module() class DoubleHeadRoIHead(StandardRoIHead): """RoI head for Double Head RCNN. https://arxiv.org/abs/1904.06493 """ def __init__(self, reg_roi_scale_factor, **kwargs): super(DoubleHeadRoIHead, self).__init__(**kwargs) self.reg_roi_scale_factor = reg_roi_scale_fact...
bbox_cls_feats = self.bbox_roi_extractor( x[:self.bbox_roi_extractor.num_inputs], rois) bbox_reg_feats = self.bbox_roi_extractor( x[:self.bbox_roi_extractor.num_inputs], rois, roi_scale_factor=self.reg_roi_scale_factor) if self.with_shared_head: ...
"""Box head forward function used in both training and testing time.""" bbox_cls_feats = self.bbox_roi_extractor( x[:self.bbox_roi_extractor.num_inputs], rois) bbox_reg_feats = self.bbox_roi_extractor( x[:self.bbox_roi_extractor.num_inputs], rois, ...
32
162
276
438
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import HEADS from .standard_roi_head import StandardRoIHead @HEADS.register_module() class DoubleHeadRoIHead(StandardRoIHead): """RoI head for Double Head RCNN. https://arxiv.org/abs/1904.06493 """ def __init__(self, reg_roi_scale_factor...
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import HEADS from .standard_roi_head import StandardRoIHead @HEADS.register_module() class DoubleHeadRoIHead(StandardRoIHead): """RoI head for Double Head RCNN. https://arxiv.org/abs/1904.06493 """ def __init__(self, reg_roi_scale_factor...
45,475
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/roi_heads/pisa_roi_head.py
100,107
8,161
_bbox_forward_train
PISARoIHead
108,161
107,161
@HEADS.register_module() class PISARoIHead(StandardRoIHead): r"""The RoI head for `Prime Sample Attention in Object Detection <https://arxiv.org/abs/1904.04821>`_.""" def forward_train(self, x, img_metas, proposal_list, ...
@HEADS.register_module() class PISARoIHead(StandardRoIHead): r"""The RoI head for `Prime Sample Attention in Object Detection <https://arxiv.org/abs/1904.04821>`_.""" def forward_train(self, x, img_metas, proposal_list, ...
rois = bbox2roi([res.bboxes for res in sampling_results]) bbox_results = self._bbox_forward(x, rois) bbox_targets = self.bbox_head.get_targets(sampling_results, gt_bboxes, gt_labels, self.train_cfg) # neg_label_weights obtained by samp...
"""Run forward function and calculate loss for box head in training.""" rois = bbox2roi([res.bboxes for res in sampling_results]) bbox_results = self._bbox_forward(x, rois) bbox_targets = self.bbox_head.get_targets(sampling_results, gt_bboxes, ...
132
1,219
710
1,929
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.core import bbox2roi from ..builder import HEADS from ..losses.pisa_loss import carl_loss, isr_p from .standard_roi_head import StandardRoIHead @HEADS.register_module() class PISARoIHead(StandardRoIHead): r"""The RoI head for `Prime Sample Attention in Ob...
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.core import bbox2roi from ..builder import HEADS from ..losses.pisa_loss import carl_loss, isr_p from .standard_roi_head import StandardRoIHead @HEADS.register_module() class PISARoIHead(StandardRoIHead): r"""The RoI head for `Prime Sample Attention in Ob...
45,476
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/models/utils/make_divisible.py
2,3
1,29
make_divisible
21,29
3,29
# Copyright (c) OpenMMLab. All rights reserved. def make_divisible(value, divisor, min_value=None, min_ratio=0.9): FILL_FUNC_BODY
# Copyright (c) OpenMMLab. All rights reserved. def make_divisible(value, divisor, min_value=None, min_ratio=0.9): """Make divisible function. This function rounds the channel number to the nearest value that can be divisible by the divisor. It is taken from the original tf repo. It ensures that all la...
if min_value is None: min_value = divisor new_value = max(min_value, int(value + divisor / 2) // divisor * divisor) # Make sure that round down does not go down by more than (1-min_ratio). if new_value < min_ratio * value: new_value += divisor return new_value
"""Make divisible function. This function rounds the channel number to the nearest value that can be divisible by the divisor. It is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by divisor. It can be seen here: https://github.com/tensorflow/mod...
44
279
104
383
# Copyright (c) OpenMMLab. All rights reserved. def make_divisible(value, divisor, min_value=None, min_ratio=0.9): FILL_FUNC_BODY
# Copyright (c) OpenMMLab. All rights reserved. def make_divisible(value, divisor, min_value=None, min_ratio=0.9): """Make divisible function. This function rounds the channel number to the nearest value that can be divisible by the divisor. It is taken from the original tf repo. It ensures that all la...
45,477
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/hlg-detection/mmdet/version.py
7,8
1,20
parse_version_info
8,19
8,19
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '2.26.0' short_version = __version__ def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '2.26.0' short_version = __version__ def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') version_info.append(int(patch_version[0])) version_info.append(f'rc{patch_version[1]}') return...
version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') version_info.append(int(patch_version[0])) version_info.append(f'rc{patch_version[1]}') return...
21
74
124
198
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '2.26.0' short_version = __version__ def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '2.26.0' short_version = __version__ def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
45,478
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/mmseg/core/evaluation/mean_iou.py
37,38
1,75
mean_iou
53,75
38,75
import numpy as np def intersect_and_union(pred_label, label, num_classes, ignore_index): """Calculate intersection and Union. Args: pred_label (ndarray): Prediction segmentation map label (ndarray): Ground truth segmentation map num_classes (int): Number of categories ignore_...
import numpy as np def intersect_and_union(pred_label, label, num_classes, ignore_index): """Calculate intersection and Union. Args: pred_label (ndarray): Prediction segmentation map label (ndarray): Ground truth segmentation map num_classes (int): Number of categories ignore_...
num_imgs = len(results) assert len(gt_seg_maps) == num_imgs total_area_intersect = np.zeros((num_classes, ), dtype=np.float) total_area_union = np.zeros((num_classes, ), dtype=np.float) total_area_pred_label = np.zeros((num_classes, ), dtype=np.float) total_area_label = np.zeros((num_classes, )...
"""Calculate Intersection and Union (IoU) Args: results (list[ndarray]): List of prediction segmentation maps gt_seg_maps (list[ndarray]): list of ground truth segmentation maps num_classes (int): Number of categories ignore_index (int): Index that will be ignored in evaluation....
84
571
399
970
import numpy as np def intersect_and_union(pred_label, label, num_classes, ignore_index): """Calculate intersection and Union. Args: pred_label (ndarray): Prediction segmentation map label (ndarray): Ground truth segmentation map num_classes (int): Number of categories ignore_...
import numpy as np def intersect_and_union(pred_label, label, num_classes, ignore_index): """Calculate intersection and Union. Args: pred_label (ndarray): Prediction segmentation map label (ndarray): Ground truth segmentation map num_classes (int): Number of categories ignore_...
45,479
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/mmseg/core/utils/misc.py
1,2
1,18
add_prefix
12,18
2,18
def add_prefix(inputs, prefix): FILL_FUNC_BODY
def add_prefix(inputs, prefix): """Add prefix for dict. Args: inputs (dict): The input dict with str keys. prefix (str): The prefix to add. Returns: dict: The dict with keys updated with ``prefix``. """ FILL_FUNC_BODY
outputs = dict() for name, value in inputs.items(): outputs[f'{prefix}.{name}'] = value return outputs
"""Add prefix for dict. Args: inputs (dict): The input dict with str keys. prefix (str): The prefix to add. Returns: dict: The dict with keys updated with ``prefix``. """ outputs = dict() for name, value in inputs.items(): outputs[f'{prefix}.{name}'] = value ...
13
82
44
126
def add_prefix(inputs, prefix): FILL_FUNC_BODY
def add_prefix(inputs, prefix): """Add prefix for dict. Args: inputs (dict): The input dict with str keys. prefix (str): The prefix to add. Returns: dict: The dict with keys updated with ``prefix``. """ FILL_FUNC_BODY
45,480
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/mmseg/models/decode_heads/cascade_decode_head.py
18,20
6,58
forward_train
BaseCascadeDecodeHead
36,41
20,41
class BaseCascadeDecodeHead(BaseDecodeHead, metaclass=ABCMeta): """Base class for cascade decode head used in :class:`CascadeEncoderDecoder.""" def __init__(self, *args, **kwargs): super(BaseCascadeDecodeHead, self).__init__(*args, **kwargs) @abstractmethod def forward(self, inputs, prev_o...
class BaseCascadeDecodeHead(BaseDecodeHead, metaclass=ABCMeta): """Base class for cascade decode head used in :class:`CascadeEncoderDecoder.""" def __init__(self, *args, **kwargs): super(BaseCascadeDecodeHead, self).__init__(*args, **kwargs) @abstractmethod def forward(self, inputs, prev_o...
seg_logits = self.forward(inputs, prev_output) losses = self.losses(seg_logits, gt_semantic_seg) return losses
"""Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. prev_output (Tensor): The output of previous decode head. img_metas (list[dict]): List of image info dict where each dict has: 'img_shape', 'scale_factor',...
10
588
51
639
from abc import ABCMeta, abstractmethod from .decode_head import BaseDecodeHead class BaseCascadeDecodeHead(BaseDecodeHead, metaclass=ABCMeta): """Base class for cascade decode head used in :class:`CascadeEncoderDecoder.""" def __init__(self, *args, **kwargs): super(BaseCascadeDecodeHead, self)....
from abc import ABCMeta, abstractmethod from .decode_head import BaseDecodeHead class BaseCascadeDecodeHead(BaseDecodeHead, metaclass=ABCMeta): """Base class for cascade decode head used in :class:`CascadeEncoderDecoder.""" def __init__(self, *args, **kwargs): super(BaseCascadeDecodeHead, self)....
45,481
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/mmseg/models/utils/make_divisible.py
1,2
1,25
make_divisible
17,25
2,25
def make_divisible(value, divisor, min_value=None, min_ratio=0.9): FILL_FUNC_BODY
def make_divisible(value, divisor, min_value=None, min_ratio=0.9): """Make divisible function. This function rounds the channel number down to the nearest value that can be divisible by the divisor. Args: value (int): The original channel number. divisor (int): The divisor to fully div...
if min_value is None: min_value = divisor new_value = max(min_value, int(value + divisor / 2) // divisor * divisor) # Make sure that round down does not go down by more than (1-min_ratio). if new_value < min_ratio * value: new_value += divisor return new_value
"""Make divisible function. This function rounds the channel number down to the nearest value that can be divisible by the divisor. Args: value (int): The original channel number. divisor (int): The divisor to fully divide the channel number. min_value (int, optional): The mini...
44
188
104
292
def make_divisible(value, divisor, min_value=None, min_ratio=0.9): FILL_FUNC_BODY
def make_divisible(value, divisor, min_value=None, min_ratio=0.9): """Make divisible function. This function rounds the channel number down to the nearest value that can be divisible by the divisor. Args: value (int): The original channel number. divisor (int): The divisor to fully div...
45,482
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/mmseg/version.py
6,7
1,19
parse_version_info
7,18
7,18
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.6.0' def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.6.0' def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') version_info.append(int(patch_version[0])) version_info.append(f'rc{patch_version[1]}') return...
version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') version_info.append(int(patch_version[0])) version_info.append(f'rc{patch_version[1]}') return...
21
66
124
190
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.6.0' def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.6.0' def parse_version_info(version_str): FILL_FUNC_BODYversion_info = parse_version_info(__version__)
45,483
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR
/home/hieuvd/dung_repo/raw/stars_03/fudan-zvg_SETR/SETR/setup.py
19,20
1,127
parse_requirements
33,95
20,95
from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmseg/version.py' def get_version(): with open(version_file, 'r') as f: exec(compile(f.read(), version_file, 'exec')) return lo...
from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmseg/version.py' def get_version(): with open(version_file, 'r') as f: exec(compile(f.read(), version_file, 'exec')) return lo...
import sys from os.path import exists import re require_fpath = fname def parse_line(line): """Parse information from a line in a requirements text file.""" if line.startswith('-r '): # Allow specifying requirements in other files target = line.split(' ')[1] ...
"""Parse the package dependencies listed in a requirements file but strips specific versioning information. Args: fname (str): path to requirements file with_version (bool, default=False): if True include version specs Returns: List[str]: list of requirements items Command...
198
661
671
1,332
from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmseg/version.py' def get_version(): with open(version_file, 'r') as f: exec(compile(f.read(), version_file, 'exec')) return lo...
from setuptools import find_packages, setup def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content version_file = 'mmseg/version.py' def get_version(): with open(version_file, 'r') as f: exec(compile(f.read(), version_file, 'exec')) return lo...
45,484
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/contrib/galaxy_config_merger.py
18,19
1,81
main
19,79
19,79
#! /usr/bin/env python """ galaxy_config_merger.py Created by Anne Pajon on 31 Jan 2012 Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute. Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample """ import configparser import logging import optparse im...
#! /usr/bin/env python """ galaxy_config_merger.py Created by Anne Pajon on 31 Jan 2012 Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute. Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample """ import configparser import logging import optparse im...
# logging configuration logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO) # get the options parser = optparse.OptionParser() parser.add_option("-s", "--sample", dest="sample", action="store", help="path to Galaxy galaxy.ini.sample file") parser.add_option("-c", "--con...
# logging configuration logging.basicConfig(format="%(levelname)s: %(message)s", level=logging.INFO) # get the options parser = optparse.OptionParser() parser.add_option("-s", "--sample", dest="sample", action="store", help="path to Galaxy galaxy.ini.sample file") parser.add_option("-c", "--con...
223
131
799
930
#! /usr/bin/env python """ galaxy_config_merger.py Created by Anne Pajon on 31 Jan 2012 Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute. Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample """ import configparser import logging import optparse im...
#! /usr/bin/env python """ galaxy_config_merger.py Created by Anne Pajon on 31 Jan 2012 Copyright (c) 2012 Cancer Research UK - Cambridge Research Institute. Script for merging specific local Galaxy config galaxy.ini.cri with default Galaxy galaxy.ini.sample """ import configparser import logging import optparse im...
45,485
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/cron/add_manual_builds.py
14,15
1,54
add_manual_builds
15,47
15,47
#!/usr/bin/env python """ Adds Manually created builds and chrom info to Galaxy's info tables Usage: python add_manual_builds.py input_file builds.txt chrom_length_dir """ import os import sys def add_manual_builds(input_file, build_file, chr_dir): FILL_FUNC_BODYif __name__ == "__main__": if len(sys.argv) < 4:...
#!/usr/bin/env python """ Adds Manually created builds and chrom info to Galaxy's info tables Usage: python add_manual_builds.py input_file builds.txt chrom_length_dir """ import os import sys def add_manual_builds(input_file, build_file, chr_dir): FILL_FUNC_BODYif __name__ == "__main__": if len(sys.argv) < 4:...
# determine existing builds, so as to not overwrite existing_builds = [] for line in open(build_file): try: if line.startswith("#"): continue existing_builds.append(line.replace("\n", "").replace("\r", "").split("\t")[0]) except Exception: ...
# determine existing builds, so as to not overwrite existing_builds = [] for line in open(build_file): try: if line.startswith("#"): continue existing_builds.append(line.replace("\n", "").replace("\r", "").split("\t")[0]) except Exception: ...
120
215
394
609
#!/usr/bin/env python """ Adds Manually created builds and chrom info to Galaxy's info tables Usage: python add_manual_builds.py input_file builds.txt chrom_length_dir """ import os import sys def add_manual_builds(input_file, build_file, chr_dir): FILL_FUNC_BODYif __name__ == "__main__": if len(sys.argv) < 4:...
#!/usr/bin/env python """ Adds Manually created builds and chrom info to Galaxy's info tables Usage: python add_manual_builds.py input_file builds.txt chrom_length_dir """ import os import sys def add_manual_builds(input_file, build_file, chr_dir): FILL_FUNC_BODYif __name__ == "__main__": if len(sys.argv) < 4:...
45,486
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/cron/build_chrom_db.py
24,25
1,84
getchrominfo
25,52
25,52
#!/usr/bin/env python """ Connects to a UCSC table browser and scrapes chrominfo for every build specified by an input file (such as one output by parse_builds.py). If not input file specified, it will connect using parse_builds.py to retrieve a list of available builds. All chromInfo is placed in a path with the conv...
#!/usr/bin/env python """ Connects to a UCSC table browser and scrapes chrominfo for every build specified by an input file (such as one output by parse_builds.py). If not input file specified, it will connect using parse_builds.py to retrieve a list of available builds. All chromInfo is placed in a path with the conv...
tableURL = "http://genome-test.gi.ucsc.edu/cgi-bin/hgTables?" URL = tableURL + urlencode( { "clade": "", "org": "", "db": db, "hgta_outputType": "primaryTable", "hgta_group": "allTables", "hgta_table": "chromInfo", "hgta...
tableURL = "http://genome-test.gi.ucsc.edu/cgi-bin/hgTables?" URL = tableURL + urlencode( { "clade": "", "org": "", "db": db, "hgta_outputType": "primaryTable", "hgta_group": "allTables", "hgta_table": "chromInfo", "hgta...
78
572
320
892
#!/usr/bin/env python """ Connects to a UCSC table browser and scrapes chrominfo for every build specified by an input file (such as one output by parse_builds.py). If not input file specified, it will connect using parse_builds.py to retrieve a list of available builds. All chromInfo is placed in a path with the conv...
#!/usr/bin/env python """ Connects to a UCSC table browser and scrapes chrominfo for every build specified by an input file (such as one output by parse_builds.py). If not input file specified, it will connect using parse_builds.py to retrieve a list of available builds. All chromInfo is placed in a path with the conv...
45,487
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/cron/parse_builds.py
14,15
1,53
getbuilds
15,46
15,46
#!/usr/bin/env python """ Connects to the URL specified and outputs builds available at that DSN in tabular format. UCSC Main gateway is used as default. build description """ import sys import xml.etree.ElementTree as ElementTree import requests def getbuilds(url): FILL_FUNC_BODYif __name__ == "__main__": i...
#!/usr/bin/env python """ Connects to the URL specified and outputs builds available at that DSN in tabular format. UCSC Main gateway is used as default. build description """ import sys import xml.etree.ElementTree as ElementTree import requests def getbuilds(url): FILL_FUNC_BODYif __name__ == "__main__": i...
try: text = requests.get(url).text except Exception: print("#Unable to open " + url) print("?\tunspecified (?)") sys.exit(1) try: tree = ElementTree.fromstring(text) except Exception: print("#Invalid xml passed back from " + url) print("?\tunspeci...
try: text = requests.get(url).text except Exception: print("#Unable to open " + url) print("?\tunspecified (?)") sys.exit(1) try: tree = ElementTree.fromstring(text) except Exception: print("#Invalid xml passed back from " + url) print("?\tunspeci...
93
195
317
512
#!/usr/bin/env python """ Connects to the URL specified and outputs builds available at that DSN in tabular format. UCSC Main gateway is used as default. build description """ import sys import xml.etree.ElementTree as ElementTree import requests def getbuilds(url): FILL_FUNC_BODYif __name__ == "__main__": i...
#!/usr/bin/env python """ Connects to the URL specified and outputs builds available at that DSN in tabular format. UCSC Main gateway is used as default. build description """ import sys import xml.etree.ElementTree as ElementTree import requests def getbuilds(url): FILL_FUNC_BODYif __name__ == "__main__": i...
45,488
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/cron/parse_builds_3_sites.py
18,19
1,49
main
19,46
19,46
#!/usr/bin/env python """ Connects to sites and determines which builds are available at each. """ import xml.etree.ElementTree as ElementTree import requests sites = [ "http://genome.ucsc.edu/cgi-bin/", "http://archaea.ucsc.edu/cgi-bin/", "http://genome-test.gi.ucsc.edu/cgi-bin/", ] names = ["main", "ar...
#!/usr/bin/env python """ Connects to sites and determines which builds are available at each. """ import xml.etree.ElementTree as ElementTree import requests sites = [ "http://genome.ucsc.edu/cgi-bin/", "http://archaea.ucsc.edu/cgi-bin/", "http://genome-test.gi.ucsc.edu/cgi-bin/", ] names = ["main", "ar...
for i in range(len(sites)): site = sites[i] + "das/dsn" trackurl = sites[i] + "hgTracks?" builds = [] try: text = requests.get(site).text except Exception: print("#Unable to connect to " + site) continue try: tree = Ele...
for i in range(len(sites)): site = sites[i] + "das/dsn" trackurl = sites[i] + "hgTracks?" builds = [] try: text = requests.get(site).text except Exception: print("#Unable to connect to " + site) continue try: tree = Ele...
74
192
247
439
#!/usr/bin/env python """ Connects to sites and determines which builds are available at each. """ import xml.etree.ElementTree as ElementTree import requests sites = [ "http://genome.ucsc.edu/cgi-bin/", "http://archaea.ucsc.edu/cgi-bin/", "http://genome-test.gi.ucsc.edu/cgi-bin/", ] names = ["main", "ar...
#!/usr/bin/env python """ Connects to sites and determines which builds are available at each. """ import xml.etree.ElementTree as ElementTree import requests sites = [ "http://genome.ucsc.edu/cgi-bin/", "http://archaea.ucsc.edu/cgi-bin/", "http://genome-test.gi.ucsc.edu/cgi-bin/", ] names = ["main", "ar...
45,489
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/auth/providers/alwaysreject.py
21,22
14,35
authenticate
AlwaysReject
25,27
22,27
class AlwaysReject(AuthProvider): """A simple authenticator that just accepts users (does not care about their password). """ plugin_type = "alwaysreject" def authenticate(self, email, username, password, options, request): FILL_FUNC_BODY def authenticate_user(self, user, password, options, req...
class AlwaysReject(AuthProvider): """A simple authenticator that just accepts users (does not care about their password). """ plugin_type = "alwaysreject" def authenticate(self, email, username, password, options, request): """ See abstract method documentation. """ FILL_FU...
return (None, "", "")
""" See abstract method documentation. """ return (None, "", "")
4
165
12
177
""" Created on 16/07/2014 @author: Andrew Robinson """ import logging from . import AuthProvider log = logging.getLogger(__name__) class AlwaysReject(AuthProvider): """A simple authenticator that just accepts users (does not care about their password). """ plugin_type = "alwaysreject" def au...
""" Created on 16/07/2014 @author: Andrew Robinson """ import logging from . import AuthProvider log = logging.getLogger(__name__) class AlwaysReject(AuthProvider): """A simple authenticator that just accepts users (does not care about their password). """ plugin_type = "alwaysreject" def au...
45,490
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/auth/providers/localdb.py
19,20
14,34
authenticate
LocalDB
23,25
20,25
class LocalDB(AuthProvider): """Authenticate users against the local Galaxy database (as per usual).""" plugin_type = "localdb" def authenticate(self, email, username, password, options, request): FILL_FUNC_BODY def authenticate_user(self, user, password, options, request): """ See abst...
class LocalDB(AuthProvider): """Authenticate users against the local Galaxy database (as per usual).""" plugin_type = "localdb" def authenticate(self, email, username, password, options, request): """ See abstract method documentation. """ FILL_FUNC_BODY def authenticate_user(se...
return (False, "", "") # it can never auto-create based of localdb (chicken-egg)
""" See abstract method documentation. """ return (False, "", "") # it can never auto-create based of localdb (chicken-egg)
13
174
31
205
""" Created on 16/07/2014 @author: Andrew Robinson """ import logging from . import AuthProvider log = logging.getLogger(__name__) class LocalDB(AuthProvider): """Authenticate users against the local Galaxy database (as per usual).""" plugin_type = "localdb" def authenticate(self, email, username, p...
""" Created on 16/07/2014 @author: Andrew Robinson """ import logging from . import AuthProvider log = logging.getLogger(__name__) class LocalDB(AuthProvider): """Authenticate users against the local Galaxy database (as per usual).""" plugin_type = "localdb" def authenticate(self, email, username, p...
45,491
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/auth/providers/pam_auth.py
61,62
58,163
authenticate
PAM
62,159
62,159
class PAM(AuthProvider): plugin_type = "PAM" def authenticate(self, email, username, password, options, request): FILL_FUNC_BODY def authenticate_user(self, user, password, options, request): return self.authenticate(user.email, user.username, password, options, request)[0]
class PAM(AuthProvider): plugin_type = "PAM" def authenticate(self, email, username, password, options, request): FILL_FUNC_BODY def authenticate_user(self, user, password, options, request): return self.authenticate(user.email, user.username, password, options, request)[0]
pam_username = None auto_register_username = None auto_register_email = None force_fail = False if not options["redact_username_in_logs"]: log.debug( f"use username: {options.get('login-use-username')} use email {options.get('login-use-email', False)} ...
pam_username = None auto_register_username = None auto_register_email = None force_fail = False if not options["redact_username_in_logs"]: log.debug( f"use username: {options.get('login-use-username')} use email {options.get('login-use-email', False)} ...
397
92
1,214
1,306
""" Created on 13/07/2015 Author Peter van Heusden (pvh@sanbi.ac.za) """ import logging import shlex from galaxy.util import ( commands, string_as_bool, ) from . import AuthProvider log = logging.getLogger(__name__) """ This module provides an AuthProvider for PAM (pluggable authentication module) authenti...
""" Created on 13/07/2015 Author Peter van Heusden (pvh@sanbi.ac.za) """ import logging import shlex from galaxy.util import ( commands, string_as_bool, ) from . import AuthProvider log = logging.getLogger(__name__) """ This module provides an AuthProvider for PAM (pluggable authentication module) authenti...
45,492
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/auth/util.py
31,32
1,110
get_authenticators
32,76
32,76
import errno import logging from collections import namedtuple import galaxy.auth.providers from galaxy.exceptions import Conflict from galaxy.security.validate_user_input import validate_publicname from galaxy.util import ( parse_xml, parse_xml_string, plugin_config, string_as_bool, ) log = logging.g...
import errno import logging from collections import namedtuple import galaxy.auth.providers from galaxy.exceptions import Conflict from galaxy.security.validate_user_input import validate_publicname from galaxy.util import ( parse_xml, parse_xml_string, plugin_config, string_as_bool, ) log = logging.g...
__plugins_dict = plugin_config.plugins_dict(galaxy.auth.providers, "plugin_type") # parse XML try: ct = parse_xml(auth_config_file) conf_root = ct.getroot() except OSError as exc: if exc.errno == errno.ENOENT and not auth_config_file_set: conf_root = parse_xml_string(...
__plugins_dict = plugin_config.plugins_dict(galaxy.auth.providers, "plugin_type") # parse XML try: ct = parse_xml(auth_config_file) conf_root = ct.getroot() except OSError as exc: if exc.errno == errno.ENOENT and not auth_config_file_set: conf_root = parse_xml_string(...
115
695
451
1,146
import errno import logging from collections import namedtuple import galaxy.auth.providers from galaxy.exceptions import Conflict from galaxy.security.validate_user_input import validate_publicname from galaxy.util import ( parse_xml, parse_xml_string, plugin_config, string_as_bool, ) log = logging.g...
import errno import logging from collections import namedtuple import galaxy.auth.providers from galaxy.exceptions import Conflict from galaxy.security.validate_user_input import validate_publicname from galaxy.util import ( parse_xml, parse_xml_string, plugin_config, string_as_bool, ) log = logging.g...
45,494
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/authnz/util.py
5,6
1,12
provider_name_to_backend
6,12
6,12
from .custos_authnz import KEYCLOAK_BACKENDS from .psa_authnz import BACKENDS_NAME def provider_name_to_backend(provider): FILL_FUNC_BODY
from .custos_authnz import KEYCLOAK_BACKENDS from .psa_authnz import BACKENDS_NAME def provider_name_to_backend(provider): FILL_FUNC_BODY
if provider.lower() in KEYCLOAK_BACKENDS: return provider.lower() for k, v in BACKENDS_NAME.items(): if k.lower() == provider: return v return None
if provider.lower() in KEYCLOAK_BACKENDS: return provider.lower() for k, v in BACKENDS_NAME.items(): if k.lower() == provider: return v return None
19
60
64
124
from .custos_authnz import KEYCLOAK_BACKENDS from .psa_authnz import BACKENDS_NAME def provider_name_to_backend(provider): FILL_FUNC_BODY
from .custos_authnz import KEYCLOAK_BACKENDS from .psa_authnz import BACKENDS_NAME def provider_name_to_backend(provider): FILL_FUNC_BODY
45,495
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/celery/_serialization.py
33,34
1,57
schema_decoder
34,50
34,50
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
if "__type__" in obj: if obj["__type__"] == "__pydantic_object__": clazz_str = obj["__class__"] assert ( clazz_str.startswith(SCHEMA_MODELS_PACKAGE_BASE) and ".." not in clazz_str ), f"Invalid class str {clazz_str}" module_name, class_name = cl...
if "__type__" in obj: if obj["__type__"] == "__pydantic_object__": clazz_str = obj["__class__"] assert ( clazz_str.startswith(SCHEMA_MODELS_PACKAGE_BASE) and ".." not in clazz_str ), f"Invalid class str {clazz_str}" module_name, class_name = cl...
46
341
190
531
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
45,496
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/celery/_serialization.py
20,21
19,33
default
SchemaEncoder
21,33
21,33
class SchemaEncoder(json.JSONEncoder): def default(self, obj): FILL_FUNC_BODY
class SchemaEncoder(json.JSONEncoder): def default(self, obj): FILL_FUNC_BODY
if isinstance(obj, BaseModel): return { "__type__": "__pydantic_object__", "__class__": fullname(obj), "__object__": obj.model_dump(mode="json"), } if isinstance(obj, UUID): return str(obj) else: retu...
if isinstance(obj, BaseModel): return { "__type__": "__pydantic_object__", "__class__": fullname(obj), "__object__": obj.model_dump(mode="json"), } if isinstance(obj, UUID): return str(obj) else: retu...
21
32
114
146
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
import json from importlib import import_module from uuid import UUID from pydantic import BaseModel SCHEMA_MODELS_PACKAGE_BASE = "galaxy.schema." # https://stackoverflow.com/a/2020083 def fullname(o): klass = o.__class__ module = klass.__module__ if module == "builtins": return klass.__qualname...
45,497
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/config/schema.py
50,51
38,127
_preprocess
AppSchema
52,72
51,72
class AppSchema(Schema): def __init__(self, schema_path: Traversable, app_name: str): self.raw_schema = self._read_schema(schema_path) self.description = self.raw_schema.get("desc", None) app_schema = self.raw_schema["mapping"][app_name]["mapping"] self._preprocess(app_schema) ...
class AppSchema(Schema): def __init__(self, schema_path: Traversable, app_name: str): self.raw_schema = self._read_schema(schema_path) self.description = self.raw_schema.get("desc", None) app_schema = self.raw_schema["mapping"][app_name]["mapping"] self._preprocess(app_schema) ...
self._defaults = {} # {config option: default value or null} self._reloadable_options = set() # config options we can reload at runtime self._paths_to_resolve = {} # {config option: referenced config option} self._per_host_options = set() # config options that can be set using a per_...
"""Populate schema collections used for app configuration.""" self._defaults = {} # {config option: default value or null} self._reloadable_options = set() # config options we can reload at runtime self._paths_to_resolve = {} # {config option: referenced config option} self._p...
79
697
314
1,011
import logging from galaxy.exceptions import ConfigurationError from galaxy.util.resources import Traversable from galaxy.util.yaml_util import ordered_load log = logging.getLogger(__name__) OPTION_DEFAULTS = { "type": "str", "unknown_option": False, "default": None, "desc": None, } UNKNOWN_OPTION =...
import logging from galaxy.exceptions import ConfigurationError from galaxy.util.resources import Traversable from galaxy.util.yaml_util import ordered_load log = logging.getLogger(__name__) OPTION_DEFAULTS = { "type": "str", "unknown_option": False, "default": None, "desc": None, } UNKNOWN_OPTION =...
45,498
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/config/schema.py
28,29
24,38
get_app_option
Schema
29,38
29,38
class Schema: def __init__(self, mapping): self.app_schema = mapping def get_app_option(self, name): FILL_FUNC_BODY
class Schema: def __init__(self, mapping): self.app_schema = mapping def get_app_option(self, name): FILL_FUNC_BODY
try: raw_option = self.app_schema[name] except KeyError: raw_option = UNKNOWN_OPTION option = OPTION_DEFAULTS.copy() option.update(raw_option) return option
try: raw_option = self.app_schema[name] except KeyError: raw_option = UNKNOWN_OPTION option = OPTION_DEFAULTS.copy() option.update(raw_option) return option
15
48
77
125
import logging from galaxy.exceptions import ConfigurationError from galaxy.util.resources import Traversable from galaxy.util.yaml_util import ordered_load log = logging.getLogger(__name__) OPTION_DEFAULTS = { "type": "str", "unknown_option": False, "default": None, "desc": None, } UNKNOWN_OPTION =...
import logging from galaxy.exceptions import ConfigurationError from galaxy.util.resources import Traversable from galaxy.util.yaml_util import ordered_load log = logging.getLogger(__name__) OPTION_DEFAULTS = { "type": "str", "unknown_option": False, "default": None, "desc": None, } UNKNOWN_OPTION =...
45,499
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/config/script.py
114,115
1,158
_handle_galaxy_yml
115,142
115,142
#!/usr/bin/env python import os import string import sys from argparse import ArgumentParser try: import pip except ImportError: pip = None # type: ignore[assignment] CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/" DESCRIPTION = "Initialize a directory with a minimal Galaxy config." HELP...
#!/usr/bin/env python import os import string import sys from argparse import ArgumentParser try: import pip except ImportError: pip = None # type: ignore[assignment] CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/" DESCRIPTION = "Initialize a directory with a minimal Galaxy config." HELP...
force = args.force yml_file = _determine_yml_file(config_dir) _check_file(yml_file, force) config_dict = dict( port=args.port, host=_determine_host(args), config_dir=config_dir, data_dir=data_dir, client_dir=CLIENT_PATH, static_path=STATIC_PATH, da...
force = args.force yml_file = _determine_yml_file(config_dir) _check_file(yml_file, force) config_dict = dict( port=args.port, host=_determine_host(args), config_dir=config_dir, data_dir=data_dir, client_dir=CLIENT_PATH, static_path=STATIC_PATH, da...
54
1,655
318
1,973
#!/usr/bin/env python import os import string import sys from argparse import ArgumentParser try: import pip except ImportError: pip = None # type: ignore[assignment] CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/" DESCRIPTION = "Initialize a directory with a minimal Galaxy config." HELP...
#!/usr/bin/env python import os import string import sys from argparse import ArgumentParser try: import pip except ImportError: pip = None # type: ignore[assignment] CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/" DESCRIPTION = "Initialize a directory with a minimal Galaxy config." HELP...
45,500
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/config/templates.py
34,35
1,41
_get_template_path
36,41
35,41
"""Render customizable templates e.g. emails with Jinja. Templates are preferentially read from a custom template directory (the value of `templates_dir`, passed to the `render` function). If the requested template path cannot be resolved with respect to this directory, the default template will be read from `config/t...
"""Render customizable templates e.g. emails with Jinja. Templates are preferentially read from a custom template directory (the value of `templates_dir`, passed to the `render` function). If the requested template path cannot be resolved with respect to this directory, the default template will be read from `config/t...
default_path = resource_path("galaxy.config", "templates") / relpath custom_path = Path(custom_templates_dir) / relpath if custom_path.exists(): return custom_path return default_path
"""Return template file path.""" default_path = resource_path("galaxy.config", "templates") / relpath custom_path = Path(custom_templates_dir) / relpath if custom_path.exists(): return custom_path return default_path
17
374
66
440
"""Render customizable templates e.g. emails with Jinja. Templates are preferentially read from a custom template directory (the value of `templates_dir`, passed to the `render` function). If the requested template path cannot be resolved with respect to this directory, the default template will be read from `config/t...
"""Render customizable templates e.g. emails with Jinja. Templates are preferentially read from a custom template directory (the value of `templates_dir`, passed to the `render` function). If the requested template path cannot be resolved with respect to this directory, the default template will be read from `config/t...
45,501
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/config_watchers.py
77,78
15,152
start
ConfigWatchers
78,109
78,109
class ConfigWatchers: """Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects.""" def __init__(self, app: StructuredApp): self.app = app self.active = False # ToolConfWatcher objects will watch the tool_cache if the tool_cache is passed into get_tool_conf_watcher. #...
class ConfigWatchers: """Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects.""" def __init__(self, app: StructuredApp): self.app = app self.active = False # ToolConfWatcher objects will watch the tool_cache if the tool_cache is passed into get_tool_conf_watcher. #...
for watcher in self.watchers: watcher.start() [self.tool_config_watcher.watch_file(config) for config in self.tool_config_paths] [self.data_manager_config_watcher.watch_file(config) for config in self.data_manager_configs] for tool_data_path in self.tool_data_paths: ...
for watcher in self.watchers: watcher.start() [self.tool_config_watcher.watch_file(config) for config in self.tool_config_paths] [self.data_manager_config_watcher.watch_file(config) for config in self.data_manager_configs] for tool_data_path in self.tool_data_paths: ...
63
1,456
457
1,913
import logging from os.path import dirname from galaxy.queue_worker import job_rule_modules from galaxy.structured_app import StructuredApp from galaxy.tool_util.toolbox.watcher import ( get_tool_conf_watcher, get_tool_watcher, ) from galaxy.util.watcher import get_watcher log = logging.getLogger(__name__) ...
import logging from os.path import dirname from galaxy.queue_worker import job_rule_modules from galaxy.structured_app import StructuredApp from galaxy.tool_util.toolbox.watcher import ( get_tool_conf_watcher, get_tool_watcher, ) from galaxy.util.watcher import get_watcher log = logging.getLogger(__name__) ...
45,510
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/annotation.py
68,69
45,92
sniff
Augustus
72,92
69,92
class Augustus(CompressedArchive): """ Class describing an Augustus prediction model """ file_ext = "augustus" edam_data = "data_0950" compressed = True def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: if not dataset.dataset.purged: dataset.peek = "Augustus ...
class Augustus(CompressedArchive): """ Class describing an Augustus prediction model """ file_ext = "augustus" edam_data = "data_0950" compressed = True def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: if not dataset.dataset.purged: dataset.peek = "Augustus ...
if filename and tarfile.is_tarfile(filename): with tarfile.open(filename, "r") as temptar: for f in temptar: if not f.isfile(): continue if ( f.name.endswith("_exon_probs.pbl") ...
""" Augustus archives always contain the same files """ if filename and tarfile.is_tarfile(filename): with tarfile.open(filename, "r") as temptar: for f in temptar: if not f.isfile(): continue if ...
44
257
270
527
import logging import tarfile from galaxy.datatypes.binary import CompressedArchive from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import nice_...
import logging import tarfile from galaxy.datatypes.binary import CompressedArchive from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import nice_...
45,511
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/annotation.py
24,25
19,45
set_peek
SnapHmm
25,32
25,32
@build_sniff_from_prefix class SnapHmm(Text): file_ext = "snaphmm" edam_data = "data_1364" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: FILL_FUNC_BODY def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: ...
@build_sniff_from_prefix class SnapHmm(Text): file_ext = "snaphmm" edam_data = "data_1364" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: FILL_FUNC_BODY def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Exception: ...
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name()) dataset.blurb = "SNAP HMM model" else: dataset.peek = "file does not exist" dataset.blurb = "file purged from disc"
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name()) dataset.blurb = "SNAP HMM model" else: dataset.peek = "file does not exist" dataset.blurb = "file purged from disc"
24
198
86
284
import logging import tarfile from galaxy.datatypes.binary import CompressedArchive from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import nice_...
import logging import tarfile from galaxy.datatypes.binary import CompressedArchive from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import nice_...
45,512
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/anvio.py
30,31
21,86
generate_primary_file
AnvioComposite
35,65
31,65
class AnvioComposite(Html): """ Base class to use for Anvi'o composite datatypes. Generally consist of a sqlite database, plus optional additional files """ file_ext = "anvio_composite" composite_type = "auto_primary_file" def generate_primary_file(self, dataset: HasExtraFilesAndMetadata) ...
class AnvioComposite(Html): """ Base class to use for Anvi'o composite datatypes. Generally consist of a sqlite database, plus optional additional files """ file_ext = "anvio_composite" composite_type = "auto_primary_file" def generate_primary_file(self, dataset: HasExtraFilesAndMetadata) ...
defined_files = self.get_composite_files(dataset=dataset).items() rval = [f"<html><head><title>Files for Anvi'o Composite Dataset ({self.file_ext})</title></head>"] if defined_files: rval.append("<p/>This composite dataset is composed of the following defined files:<p/><ul>") ...
""" This is called only at upload to write the html file cannot rename the datasets here - they come with the default unfortunately """ defined_files = self.get_composite_files(dataset=dataset).items() rval = [f"<html><head><title>Files for Anvi'o Composite Dataset ({self...
115
357
552
909
""" Datatypes for Anvi'o https://github.com/merenlab/anvio """ import glob import logging import os from typing import Optional from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) from galaxy.datatypes.text import Html lo...
""" Datatypes for Anvi'o https://github.com/merenlab/anvio """ import glob import logging import os from typing import Optional from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) from galaxy.datatypes.text import Html lo...
45,513
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/anvio.py
98,99
86,118
set_meta
AnvioDB
102,118
99,118
class AnvioDB(AnvioComposite): """Class for AnvioDB database files.""" _anvio_basename: Optional[str] = None MetadataElement(name="anvio_basename", default=_anvio_basename, desc="Basename", readonly=True) file_ext = "anvio_db" def __init__(self, *args, **kwd): super().__init__(*args, **kwd...
class AnvioDB(AnvioComposite): """Class for AnvioDB database files.""" _anvio_basename: Optional[str] = None MetadataElement(name="anvio_basename", default=_anvio_basename, desc="Basename", readonly=True) file_ext = "anvio_db" def __init__(self, *args, **kwd): super().__init__(*args, **kwd...
super().set_meta(dataset, overwrite=overwrite, **kwd) if dataset.metadata.anvio_basename is not None and os.path.exists( os.path.join(dataset.extra_files_path, dataset.metadata.anvio_basename) ): return found = False for basename in [dataset.metadata.anvio...
""" Set the anvio_basename based upon actual extra_files_path contents. """ super().set_meta(dataset, overwrite=overwrite, **kwd) if dataset.metadata.anvio_basename is not None and os.path.exists( os.path.join(dataset.extra_files_path, dataset.metadata.anvio_basename)...
46
233
230
463
""" Datatypes for Anvi'o https://github.com/merenlab/anvio """ import glob import logging import os from typing import Optional from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) from galaxy.datatypes.text import Html lo...
""" Datatypes for Anvi'o https://github.com/merenlab/anvio """ import glob import logging import os from typing import Optional from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) from galaxy.datatypes.text import Html lo...
45,514
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/assembly.py
37,38
29,72
sniff_prefix
Amos
61,72
38,72
@build_sniff_from_prefix class Amos(data.Text): """Class describing the AMOS assembly file""" edam_data = "data_0925" edam_format = "format_3582" file_ext = "afg" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_FUNC_BODY
@build_sniff_from_prefix class Amos(data.Text): """Class describing the AMOS assembly file""" edam_data = "data_0925" edam_format = "format_3582" file_ext = "afg" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: """ Determines whether the file is an amos assembly file forma...
for line in file_prefix.line_iterator(): if not line: break # EOF line = line.strip() if line: # first non-empty line if line.startswith("{"): if re.match(r"{(RED|CTG|TLE)$", line): return True ...
""" Determines whether the file is an amos assembly file format Example:: {CTG iid:1 eid:1 seq: CCTCTCCTGTAGAGTTCAACCGA-GCCGGTAGAGTTTTATCA . qlt: DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD . {TLE...
28
261
100
361
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
45,515
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/assembly.py
113,114
106,136
sniff_prefix
Roadmaps
121,136
114,136
@build_sniff_from_prefix class Roadmaps(data.Text): """Class describing the Sequences file generated by velveth""" edam_format = "format_2561" file_ext = "roadmaps" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_FUNC_BODY
@build_sniff_from_prefix class Roadmaps(data.Text): """Class describing the Sequences file generated by velveth""" edam_format = "format_2561" file_ext = "roadmaps" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: """ Determines whether the file is a velveth produced RoadMap:: ...
fh = file_prefix.string_io() for line in fh: line = line.strip() if line: # first non-empty line if not re.match(r"\d+\t\d+\t\d+$", line): return False # The next line.strip() should be 'ROADMAP 1' line = fh.re...
""" Determines whether the file is a velveth produced RoadMap:: 142858 21 1 ROADMAP 1 ROADMAP 2 ... """ fh = file_prefix.string_io() for line in fh: line = line.strip() if line: # first non-empty line ...
54
145
170
315
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
45,516
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/assembly.py
79,80
72,106
sniff_prefix
Sequences
89,106
80,106
@build_sniff_from_prefix class Sequences(sequence.Fasta): """Class describing the Sequences file generated by velveth""" edam_data = "data_0925" file_ext = "sequences" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_FUNC_BODY
@build_sniff_from_prefix class Sequences(sequence.Fasta): """Class describing the Sequences file generated by velveth""" edam_data = "data_0925" file_ext = "sequences" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: """ Determines whether the file is a velveth produced fasta ...
fh = file_prefix.string_io() for line in fh: line = line.strip() if line: # first non-empty line if line.startswith(">"): if not re.match(r">[^\t]+\t\d+\t\d+$", line): return False # The next line.st...
""" Determines whether the file is a velveth produced fasta format The id line has 3 fields separated by tabs: sequence_name sequence_index category:: >SEQUENCE_0_length_35 1 1 GGATATAGGGCCAACCCAACTCAACGGCCTGTCTT >SEQUENCE_1_length_35 2 1 ...
53
218
173
391
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
45,517
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/assembly.py
175,176
136,248
generate_primary_file
Velvet
176,194
176,194
class Velvet(Html): MetadataElement( name="base_name", desc="base name for velveth dataset", default="velvet", readonly=True, set_in_upload=True ) MetadataElement( name="paired_end_reads", desc="has paired-end reads", default="False", readonly=False, set_in_upload=True ) MetadataElem...
class Velvet(Html): MetadataElement( name="base_name", desc="base name for velveth dataset", default="velvet", readonly=True, set_in_upload=True ) MetadataElement( name="paired_end_reads", desc="has paired-end reads", default="False", readonly=False, set_in_upload=True ) MetadataElem...
log.debug(f"Velvet log info JJ generate_primary_file {dataset}") rval = ["<html><head><title>Velvet Galaxy Composite Dataset </title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_compos...
log.debug(f"Velvet log info JJ generate_primary_file {dataset}") rval = ["<html><head><title>Velvet Galaxy Composite Dataset </title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_compos...
61
1,410
344
1,754
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
""" velvet datatypes James E Johnson - University of Minnesota for velvet assembler tool in galaxy """ import logging import os import re from galaxy.datatypes import ( data, sequence, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( DatasetProtocol, Has...
45,518
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/chain.py
67,68
23,131
sniff_prefix
Chain
96,131
68,131
@build_sniff_from_prefix class Chain(data.Text): """Class describing a chain format alignment file""" edam_format = "format_3982" file_ext = "chain" strands = ["+", "-"] MetadataElement( name="chains", default=0, desc="Number of chains", readonly=True, visible=False, optional=False, no_va...
@build_sniff_from_prefix class Chain(data.Text): """Class describing a chain format alignment file""" edam_format = "format_3982" file_ext = "chain" strands = ["+", "-"] MetadataElement( name="chains", default=0, desc="Number of chains", readonly=True, visible=False, optional=False, no_va...
fh = file_prefix.string_io() for line in fh: line = line.strip() if line: # first non-empty line if line.startswith("chain"): tokens = line.split() if not ( len(tokens) in [12, 13] ...
""" Determines whether the file is in chain format For complete details see https://genome.ucsc.edu/goldenPath/help/chain.html Rules for sniffing as True: We don't care about line length (other than empty lines). The first non-empty line must start with 'chain...
100
773
323
1,096
""" Genome browser alignment formats """ import logging from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import ( commaify, compression_utils, ni...
""" Genome browser alignment formats """ import logging from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import ( commaify, compression_utils, ni...
45,519
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/chain.py
138,139
131,195
sniff_prefix
Net
161,195
139,195
@build_sniff_from_prefix class Net(data.Text): """Class describing a net format alignment file""" edam_format = "format_3983" file_ext = "ucsc.net" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_FUNC_BODY
@build_sniff_from_prefix class Net(data.Text): """Class describing a net format alignment file""" edam_format = "format_3983" file_ext = "ucsc.net" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: """ Determines whether the file is in net format For details see https:/...
allowed_classes = ["fill", "gap"] strands = ["+", "-"] fh = file_prefix.string_io() for line in fh: line = line.strip() if line: # first non-empty line if line.startswith("net"): tokens = line.split() if no...
""" Determines whether the file is in net format For details see https://genome.ucsc.edu/goldenPath/help/net.html Rules for sniffing as True: We don't care about line length (other than empty lines). The first non-empty line must start with 'net' followed by c...
113
302
335
637
""" Genome browser alignment formats """ import logging from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import ( commaify, compression_utils, ni...
""" Genome browser alignment formats """ import logging from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from galaxy.util import ( commaify, compression_utils, ni...
45,521
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
770,771
744,795
set_meta
GmshMsh
771,786
771,786
@build_sniff_from_prefix class GmshMsh(Binary): """Gmsh Mesh File""" file_ext = "gmsh.msh" is_binary = "maybe" MetadataElement(name="version", default=None, desc="version", readonly=True, visible=True) MetadataElement(name="format", default=None, desc="format", readonly=True, visible=True) def...
@build_sniff_from_prefix class GmshMsh(Binary): """Gmsh Mesh File""" file_ext = "gmsh.msh" is_binary = "maybe" MetadataElement(name="version", default=None, desc="version", readonly=True, visible=True) MetadataElement(name="format", default=None, desc="format", readonly=True, visible=True) def...
if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: for i, line in enumerate(fh): line = line.strip() if not line or i > 1: break if i == 0 and not line.startswith("$Mesh...
if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: for i, line in enumerate(fh): line = line.strip() if not line or i > 1: break if i == 0 and not line.startswith("$Mesh...
58
479
177
656
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,522
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
688,689
670,713
_get_dimension
NeperPoints
689,707
689,707
class NeperPoints(data.Text): """ Neper Position File Neper position format has 1 - 3 floats per line separated by white space. """ file_ext = "neper.points" MetadataElement(name="dimension", default=None, desc="dimension", readonly=True, visible=True) def __init__(self, **kwd): da...
class NeperPoints(data.Text): """ Neper Position File Neper position format has 1 - 3 floats per line separated by white space. """ file_ext = "neper.points" MetadataElement(name="dimension", default=None, desc="dimension", readonly=True, visible=True) def __init__(self, **kwd): da...
dim = None try: for i, line in enumerate(fh): if not line: break pts = len([float(x) for x in line.strip().split(sep=sep)]) if dim is not None and pts != dim: return None elif 1 <= pts <= ...
dim = None try: for i, line in enumerate(fh): if not line: break pts = len([float(x) for x in line.strip().split(sep=sep)]) if dim is not None and pts != dim: return None elif 1 <= pts <= ...
54
346
142
488
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,523
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
724,725
713,736
set_meta
NeperPointsTabular
725,730
725,730
class NeperPointsTabular(NeperPoints, Tabular): """ Neper Position File Neper position format has 1 - 3 floats per line separated by TABs. """ file_ext = "neper.points.tsv" def __init__(self, **kwd): Tabular.__init__(self, **kwd) def set_meta(self, dataset: DatasetProtocol, overwr...
class NeperPointsTabular(NeperPoints, Tabular): """ Neper Position File Neper position format has 1 - 3 floats per line separated by TABs. """ file_ext = "neper.points.tsv" def __init__(self, **kwd): Tabular.__init__(self, **kwd) def set_meta(self, dataset: DatasetProtocol, overwr...
Tabular.set_meta(self, dataset, overwrite=overwrite, **kwd) if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: dataset.metadata.dimension = self._get_dimension(fh)
Tabular.set_meta(self, dataset, overwrite=overwrite, **kwd) if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: dataset.metadata.dimension = self._get_dimension(fh)
14
205
79
284
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,524
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
661,662
583,670
set_peek
NeperTesr
662,670
662,670
@build_sniff_from_prefix class NeperTesr(Binary): """ Neper Raster Tessellation File Example:: ***tesr **format format **general dimension size_x size_y [size_z] voxsize_x voxsize_y [voxsize_z] [*origin origin_x or...
@build_sniff_from_prefix class NeperTesr(Binary): """ Neper Raster Tessellation File Example:: ***tesr **format format **general dimension size_x size_y [size_z] voxsize_x voxsize_y [voxsize_z] [*origin origin_x or...
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name(), line_count=9) dataset.blurb = f"format: {str(dataset.metadata.format)} dim: {str(dataset.metadata.dimension)} cells: {str(dataset.metadata.cells)}" else: dataset.peek = "File does not...
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name(), line_count=9) dataset.blurb = f"format: {str(dataset.metadata.format)} dim: {str(dataset.metadata.dimension)} cells: {str(dataset.metadata.cells)}" else: dataset.peek = "File does not...
28
855
125
980
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,525
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
558,559
520,583
set_meta
NeperTess
559,574
559,574
@build_sniff_from_prefix class NeperTess(data.Text): """ Neper Tessellation File Example:: ***tess **format format **general dim type **cell number_of_cells """ file_ext = "neper.tess" MetadataElement(name="format", default=N...
@build_sniff_from_prefix class NeperTess(data.Text): """ Neper Tessellation File Example:: ***tess **format format **general dim type **cell number_of_cells """ file_ext = "neper.tess" MetadataElement(name="format", default=N...
if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: for i, line in enumerate(fh): line = line.strip() if not line or i > 6: break if i == 0 and not line.startswith("***te...
if dataset.has_data(): with open(dataset.get_file_name(), errors="ignore") as fh: for i, line in enumerate(fh): line = line.strip() if not line or i > 6: break if i == 0 and not line.startswith("***te...
52
554
164
718
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,526
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/constructive_solid_geometry.py
78,79
41,145
_is_ply_header
Ply
83,107
79,107
@build_sniff_from_prefix class Ply: """ The PLY format describes an object as a collection of vertices, faces and other elements, along with properties such as color and normal direction that can be attached to these elements. A PLY file contains the description of exactly one object. """ ...
@build_sniff_from_prefix class Ply: """ The PLY format describes an object as a collection of vertices, faces and other elements, along with properties such as color and normal direction that can be attached to these elements. A PLY file contains the description of exactly one object. """ ...
valid_header_items = ["comment", "obj_info", "element", "property"] # Line 1: ply line = get_next_line(fh) if line != "ply": return False # Line 2: format ascii 1.0 line = get_next_line(fh) if line.find(subtype) < 0: return False st...
""" The header is a series of carriage-return terminated lines of text that describe the remainder of the file. """ valid_header_items = ["comment", "obj_info", "element", "property"] # Line 1: ply line = get_next_line(fh) if line != "ply": ret...
88
880
262
1,142
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this # this file is challenging, it should be broken into true mixins. """ Constructive Solid Geometry file formats. """ import abc from typing import ( List, Optional, Tuple, TYPE_CHECKING, ) from galaxy import util...
45,528
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/fasta_to_len.py
12,13
1,53
compute_fasta_length
13,51
13,51
#!/usr/bin/env python """ Input: fasta, int Output: tabular Return titles with lengths of corresponding seq """ import sys assert sys.version_info[:2] >= (2, 4) def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word=False): FILL_FUNC_BODYif __name__ == "__main__": compute_fasta_length(sy...
#!/usr/bin/env python """ Input: fasta, int Output: tabular Return titles with lengths of corresponding seq """ import sys assert sys.version_info[:2] >= (2, 4) def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word=False): FILL_FUNC_BODYif __name__ == "__main__": compute_fasta_length(sy...
infile = fasta_file keep_first_char = int(keep_first_char) fasta_title = "" seq_len = 0 # number of char to keep in the title if keep_first_char == 0: keep_first_char = None else: keep_first_char += 1 first_entry = True with open(out_file, "w") as out: wit...
infile = fasta_file keep_first_char = int(keep_first_char) fasta_title = "" seq_len = 0 # number of char to keep in the title if keep_first_char == 0: keep_first_char = None else: keep_first_char += 1 first_entry = True with open(out_file, "w") as out: wit...
100
141
387
528
#!/usr/bin/env python """ Input: fasta, int Output: tabular Return titles with lengths of corresponding seq """ import sys assert sys.version_info[:2] >= (2, 4) def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word=False): FILL_FUNC_BODYif __name__ == "__main__": compute_fasta_length(sy...
#!/usr/bin/env python """ Input: fasta, int Output: tabular Return titles with lengths of corresponding seq """ import sys assert sys.version_info[:2] >= (2, 4) def compute_fasta_length(fasta_file, out_file, keep_first_char, keep_first_word=False): FILL_FUNC_BODYif __name__ == "__main__": compute_fasta_length(sy...
45,529
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/fastq_to_fqtoc.py
8,9
1,48
main
20,46
9,46
#!/usr/bin/env python import sys from galaxy.util.checkers import is_gzip def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python import sys from galaxy.util.checkers import is_gzip def main(): """ The format of the file is JSON:: { "sections" : [ { "start" : "x", "end" : "y", "sequences" : "z" }, ... ]} This works only for UNCOMPRESSED fastq files. The Python...
input_fname = sys.argv[1] if is_gzip(input_fname): sys.exit("Conversion is only possible for uncompressed files") current_line = 0 sequences = 1000000 lines_per_chunk = 4 * sequences chunk_begin = 0 with open(input_fname) as in_file, open(sys.argv[2], "w") as out_file: out_...
""" The format of the file is JSON:: { "sections" : [ { "start" : "x", "end" : "y", "sequences" : "z" }, ... ]} This works only for UNCOMPRESSED fastq files. The Python GzipFile does not provide seekable offsets via tell(), so clients just have to split ...
69
156
338
494
#!/usr/bin/env python import sys from galaxy.util.checkers import is_gzip def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python import sys from galaxy.util.checkers import is_gzip def main(): """ The format of the file is JSON:: { "sections" : [ { "start" : "x", "end" : "y", "sequences" : "z" }, ... ]} This works only for UNCOMPRESSED fastq files. The Python...
45,530
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/fastqsolexa_to_fasta_converter.py
21,22
1,53
stop_err
22,25
22,25
#!/usr/bin/env python """ convert fastqsolexa file to separated sequence and quality files. assume each sequence and quality score are contained in one line the order should be: 1st line: @title_of_seq 2nd line: nucleotides 3rd line: +title_of_qualityscore (might be skipped) 4th line: quality scores (in three forms: a...
#!/usr/bin/env python """ convert fastqsolexa file to separated sequence and quality files. assume each sequence and quality score are contained in one line the order should be: 1st line: @title_of_seq 2nd line: nucleotides 3rd line: +title_of_qualityscore (might be skipped) 4th line: quality scores (in three forms: a...
sys.exit(f"{msg}")
sys.exit(f"{msg}")
1
548
17
565
#!/usr/bin/env python """ convert fastqsolexa file to separated sequence and quality files. assume each sequence and quality score are contained in one line the order should be: 1st line: @title_of_seq 2nd line: nucleotides 3rd line: +title_of_qualityscore (might be skipped) 4th line: quality scores (in three forms: a...
#!/usr/bin/env python """ convert fastqsolexa file to separated sequence and quality files. assume each sequence and quality score are contained in one line the order should be: 1st line: @title_of_seq 2nd line: nucleotides 3rd line: +title_of_qualityscore (might be skipped) 4th line: quality scores (in three forms: a...
45,531
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.py
22,23
1,45
main
23,43
23,43
#!/usr/bin/env python """ Convert from GFF file to interval index file. usage: python gff_to_interval_index_converter.py [input] [output] """ import fileinput import sys from bx.interval_index_file import Indexes from bx.intervals.io import GenomicInterval from galaxy.datatypes.util.gff_util import ( conve...
#!/usr/bin/env python """ Convert from GFF file to interval index file. usage: python gff_to_interval_index_converter.py [input] [output] """ import fileinput import sys from bx.interval_index_file import Indexes from bx.intervals.io import GenomicInterval from galaxy.datatypes.util.gff_util import ( conve...
# Arguments input_fname, out_fname = sys.argv[1:] # Do conversion. index = Indexes() offset = 0 reader_wrapper = GFFReaderWrapper(fileinput.FileInput(input_fname), fix_strand=True) for feature in list(reader_wrapper): # Add feature; index expects BED coordinates. if isinstan...
# Arguments input_fname, out_fname = sys.argv[1:] # Do conversion. index = Indexes() offset = 0 reader_wrapper = GFFReaderWrapper(fileinput.FileInput(input_fname), fix_strand=True) for feature in list(reader_wrapper): # Add feature; index expects BED coordinates. if isinstan...
62
156
219
375
#!/usr/bin/env python """ Convert from GFF file to interval index file. usage: python gff_to_interval_index_converter.py [input] [output] """ import fileinput import sys from bx.interval_index_file import Indexes from bx.intervals.io import GenomicInterval from galaxy.datatypes.util.gff_util import ( conve...
#!/usr/bin/env python """ Convert from GFF file to interval index file. usage: python gff_to_interval_index_converter.py [input] [output] """ import fileinput import sys from bx.interval_index_file import Indexes from bx.intervals.io import GenomicInterval from galaxy.datatypes.util.gff_util import ( conve...
45,532
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/interval_to_bed_converter.py
11,12
1,80
stop_err
12,15
12,15
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io assert sys.version_info[:2] >= (2, 6) def stop_err(msg): FILL_FUNC_BODYdef __main__(): output_name = sys.argv[1] input_name = sys.argv[2] try: chromCol = int(sys.argv[3]) - 1 except Exception: stop_err( ...
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io assert sys.version_info[:2] >= (2, 6) def stop_err(msg): FILL_FUNC_BODYdef __main__(): output_name = sys.argv[1] input_name = sys.argv[2] try: chromCol = int(sys.argv[3]) - 1 except Exception: stop_err( ...
sys.exit(msg)
sys.exit(msg)
1
751
13
764
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io assert sys.version_info[:2] >= (2, 6) def stop_err(msg): FILL_FUNC_BODYdef __main__(): output_name = sys.argv[1] input_name = sys.argv[2] try: chromCol = int(sys.argv[3]) - 1 except Exception: stop_err( ...
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io assert sys.version_info[:2] >= (2, 6) def stop_err(msg): FILL_FUNC_BODYdef __main__(): output_name = sys.argv[1] input_name = sys.argv[2] try: chromCol = int(sys.argv[3]) - 1 except Exception: stop_err( ...
45,534
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/interval_to_fli.py
31,32
1,107
main
32,105
32,105
""" Creates a feature location index (FLI) for a given BED/GFF file. FLI index has the form:: [line_length] <symbol1_in_lowercase><tab><symbol1><tab><location> <symbol2_in_lowercase><tab><symbol2><tab><location> ... where location is formatted as: contig:start-end and symbols are sorted in lexig...
""" Creates a feature location index (FLI) for a given BED/GFF file. FLI index has the form:: [line_length] <symbol1_in_lowercase><tab><symbol1><tab><location> <symbol2_in_lowercase><tab><symbol2><tab><location> ... where location is formatted as: contig:start-end and symbols are sorted in lexig...
# Process arguments. parser = optparse.OptionParser() parser.add_option("-F", "--format", dest="input_format") (options, args) = parser.parse_args() in_fname, out_fname = args input_format = options.input_format.lower() # Create dict of name-location pairings. name_loc_dict = {} if ...
# Process arguments. parser = optparse.OptionParser() parser.add_option("-F", "--format", dest="input_format") (options, args) = parser.parse_args() in_fname, out_fname = args input_format = options.input_format.lower() # Create dict of name-location pairings. name_loc_dict = {} if ...
230
223
834
1,057
""" Creates a feature location index (FLI) for a given BED/GFF file. FLI index has the form:: [line_length] <symbol1_in_lowercase><tab><symbol1><tab><location> <symbol2_in_lowercase><tab><symbol2><tab><location> ... where location is formatted as: contig:start-end and symbols are sorted in lexig...
""" Creates a feature location index (FLI) for a given BED/GFF file. FLI index has the form:: [line_length] <symbol1_in_lowercase><tab><symbol1><tab><location> <symbol2_in_lowercase><tab><symbol2><tab><location> ... where location is formatted as: contig:start-end and symbols are sorted in lexig...
45,535
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/interval_to_interval_index_converter.py
17,18
1,52
main
18,50
18,50
#!/usr/bin/env python """ Convert from interval file to interval index file. usage: %prog <options> in_file out_file -c, --chr-col: chromosome column, default=1 -s, --start-col: start column, default=2 -e, --end-col: end column, default=3 """ import optparse from bx.interval_index_file import Indexes ...
#!/usr/bin/env python """ Convert from interval file to interval index file. usage: %prog <options> in_file out_file -c, --chr-col: chromosome column, default=1 -s, --start-col: start column, default=2 -e, --end-col: end column, default=3 """ import optparse from bx.interval_index_file import Indexes ...
# Read options, args. parser = optparse.OptionParser() parser.add_option("-c", "--chr-col", type="int", dest="chrom_col", default=1) parser.add_option("-s", "--start-col", type="int", dest="start_col", default=2) parser.add_option("-e", "--end-col", type="int", dest="end_col", default=3) (option...
# Read options, args. parser = optparse.OptionParser() parser.add_option("-c", "--chr-col", type="int", dest="chrom_col", default=1) parser.add_option("-s", "--start-col", type="int", dest="start_col", default=2) parser.add_option("-e", "--end-col", type="int", dest="end_col", default=3) (option...
97
140
414
554
#!/usr/bin/env python """ Convert from interval file to interval index file. usage: %prog <options> in_file out_file -c, --chr-col: chromosome column, default=1 -s, --start-col: start column, default=2 -e, --end-col: end column, default=3 """ import optparse from bx.interval_index_file import Indexes ...
#!/usr/bin/env python """ Convert from interval file to interval index file. usage: %prog <options> in_file out_file -c, --chr-col: chromosome column, default=1 -s, --start-col: start column, default=2 -e, --end-col: end column, default=3 """ import optparse from bx.interval_index_file import Indexes ...
45,536
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/lped_to_pbed_converter.py
35,36
1,111
getMissval
40,63
36,63
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
commonmissvals = {"N": "N", "0": "0", "n": "n", "9": "9", "-": "-", ".": "."} try: f = open(inped) except Exception: return None # signal no in file missval = None while missval is None: # doggedly continue until we solve the mystery try: line = f.readline() ...
""" read some lines...ugly hack - try to guess missing value should be N or 0 but might be . or - """ commonmissvals = {"N": "N", "0": "0", "n": "n", "9": "9", "-": "-", ".": "."} try: f = open(inped) except Exception: return None # signal no in file missval = None w...
80
1,157
223
1,380
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
45,537
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/pbed_ldreduced_converter.py
33,34
1,131
pruneLD
35,54
34,54
# converter for ldreduced rgenetics datatype # used for grr and eigenstrat - shellfish if we get around to it import os import subprocess import sys import tempfile import time prog = "pbed_ldreduced_converter.py" galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
# converter for ldreduced rgenetics datatype # used for grr and eigenstrat - shellfish if we get around to it import os import subprocess import sys import tempfile import time prog = "pbed_ldreduced_converter.py" galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
plinktasks = plinktasks or [] vclbase = vclbase or [] alog = ["## Rgenetics: http://rgenetics.org Galaxy Tools rgQC.py Plink pruneLD runner\n"] with tempfile.NamedTemporaryFile(mode="r+") as plog: for task in plinktasks: # each is a list vcl = vclbase + task subprocess.c...
""" """ plinktasks = plinktasks or [] vclbase = vclbase or [] alog = ["## Rgenetics: http://rgenetics.org Galaxy Tools rgQC.py Plink pruneLD runner\n"] with tempfile.NamedTemporaryFile(mode="r+") as plog: for task in plinktasks: # each is a list vcl = vclbase + task ...
81
1,387
274
1,661
# converter for ldreduced rgenetics datatype # used for grr and eigenstrat - shellfish if we get around to it import os import subprocess import sys import tempfile import time prog = "pbed_ldreduced_converter.py" galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
# converter for ldreduced rgenetics datatype # used for grr and eigenstrat - shellfish if we get around to it import os import subprocess import sys import tempfile import time prog = "pbed_ldreduced_converter.py" galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
45,538
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/pbed_to_lped_converter.py
42,43
1,75
main
50,73
43,73
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
nparm = 4 if len(sys.argv) < nparm: sys.exit("PBED to LPED converter called with %s - needs %d parameters \n" % (sys.argv, nparm)) inpedfilepath = sys.argv[1] outhtmlname = sys.argv[2] outfilepath = sys.argv[3] try: os.makedirs(outfilepath) except Exception: pass ...
""" need to work with rgenetics composite datatypes so in and out are html files with data in extrafiles path <command>python '$__tool_directory__/pbed_to_lped_converter.py' '$input1/$input1.metadata.base_name' '$output1' '$output1.extra_files_path' '${GALAXY_DATA_INDEX_DIR}/rg/bin/plink' </comm...
75
675
369
1,044
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
# for rgenetics - lped to pbed # where to stop with converters # pbed might be central # eg lped/eigen/fbat/snpmatrix all to pbed # and pbed to lped/eigen/fbat/snpmatrix ? # that's a lot of converters import os import subprocess import sys import time prog = os.path.split(sys.argv[0])[-1] myversion = "Oct 10 2009" g...
45,539
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/pileup_to_interval_index_converter.py
14,15
1,37
main
15,35
15,35
#!/usr/bin/env python """ Convert from pileup file to interval index file. usage: %prog <options> in_file out_file """ import optparse from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Convert from pileup file to interval index file. usage: %prog <options> in_file out_file """ import optparse from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
# Read options, args. parser = optparse.OptionParser() (options, args) = parser.parse_args() input_fname, output_fname = args # Do conversion. index = Indexes() offset = 0 with open(input_fname) as in_fh: for line in in_fh: chrom, start = line.split()[0:2] ...
# Read options, args. parser = optparse.OptionParser() (options, args) = parser.parse_args() input_fname, output_fname = args # Do conversion. index = Indexes() offset = 0 with open(input_fname) as in_fh: for line in in_fh: chrom, start = line.split()[0:2] ...
61
90
202
292
#!/usr/bin/env python """ Convert from pileup file to interval index file. usage: %prog <options> in_file out_file """ import optparse from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Convert from pileup file to interval index file. usage: %prog <options> in_file out_file """ import optparse from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
45,540
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/tabular_csv.py
34,35
1,43
convert_to_csv
35,41
35,41
#!/usr/bin/env python """ Uses the python csv library to convert to and from tabular usage: %prog [--from-tabular] -i in_file -o out_file """ import argparse import csv def main(): usage = "Usage: %prog [options]" parser = argparse.ArgumentParser(usage=usage) parser.add_argument("-f", "--from-tabular", ...
#!/usr/bin/env python """ Uses the python csv library to convert to and from tabular usage: %prog [--from-tabular] -i in_file -o out_file """ import argparse import csv def main(): usage = "Usage: %prog [options]" parser = argparse.ArgumentParser(usage=usage) parser.add_argument("-f", "--from-tabular", ...
with open(input_fname) as tabfile, open(output_fname, "w", newline="") as ofh: writer = csv.writer(ofh, delimiter=",") for line in tabfile.readlines(): writer.writerow(line.strip().split("\t"))
with open(input_fname) as tabfile, open(output_fname, "w", newline="") as ofh: writer = csv.writer(ofh, delimiter=",") for line in tabfile.readlines(): writer.writerow(line.strip().split("\t"))
18
389
85
474
#!/usr/bin/env python """ Uses the python csv library to convert to and from tabular usage: %prog [--from-tabular] -i in_file -o out_file """ import argparse import csv def main(): usage = "Usage: %prog [options]" parser = argparse.ArgumentParser(usage=usage) parser.add_argument("-f", "--from-tabular", ...
#!/usr/bin/env python """ Uses the python csv library to convert to and from tabular usage: %prog [--from-tabular] -i in_file -o out_file """ import argparse import csv def main(): usage = "Usage: %prog [options]" parser = argparse.ArgumentParser(usage=usage) parser.add_argument("-f", "--from-tabular", ...
45,541
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/vcf_to_interval_index_converter.py
12,13
1,35
main
13,33
13,33
#!/usr/bin/env python """ Convert from VCF file to interval index file. """ import optparse import galaxy_utils.sequence.vcf from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Convert from VCF file to interval index file. """ import optparse import galaxy_utils.sequence.vcf from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
# Read options, args. parser = optparse.OptionParser() (options, args) = parser.parse_args() in_file, out_file = args # Do conversion. index = Indexes() with open(in_file) as in_fh: reader = galaxy_utils.sequence.vcf.Reader(in_fh) offset = reader.metadata_len for vcf...
# Read options, args. parser = optparse.OptionParser() (options, args) = parser.parse_args() in_file, out_file = args # Do conversion. index = Indexes() with open(in_file) as in_fh: reader = galaxy_utils.sequence.vcf.Reader(in_fh) offset = reader.metadata_len for vcf...
67
83
244
327
#!/usr/bin/env python """ Convert from VCF file to interval index file. """ import optparse import galaxy_utils.sequence.vcf from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Convert from VCF file to interval index file. """ import optparse import galaxy_utils.sequence.vcf from bx.interval_index_file import Indexes def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
45,542
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/converters/wiggle_to_simple_converter.py
19,20
1,33
main
20,31
20,31
#!/usr/bin/env python # code is same as ~/tools/stats/wiggle_to_simple.py """ Read a wiggle track and print out a series of lines containing "chrom position score". Ignores track lines, handles bed, variableStep and fixedStep wiggle lines. """ import sys import bx.wiggle from galaxy.util.ucsc import ( UCSCLimitE...
#!/usr/bin/env python # code is same as ~/tools/stats/wiggle_to_simple.py """ Read a wiggle track and print out a series of lines containing "chrom position score". Ignores track lines, handles bed, variableStep and fixedStep wiggle lines. """ import sys import bx.wiggle from galaxy.util.ucsc import ( UCSCLimitE...
with open(sys.argv[1]) as in_file, open(sys.argv[2], "w") as out_file: try: for fields in bx.wiggle.IntervalReader(UCSCOutWrapper(in_file)): out_file.write("{}\n".format("\t".join(map(str, fields)))) except UCSCLimitException: # Wiggle data was truncated, at t...
with open(sys.argv[1]) as in_file, open(sys.argv[2], "w") as out_file: try: for fields in bx.wiggle.IntervalReader(UCSCOutWrapper(in_file)): out_file.write("{}\n".format("\t".join(map(str, fields)))) except UCSCLimitException: # Wiggle data was truncated, at t...
51
146
179
325
#!/usr/bin/env python # code is same as ~/tools/stats/wiggle_to_simple.py """ Read a wiggle track and print out a series of lines containing "chrom position score". Ignores track lines, handles bed, variableStep and fixedStep wiggle lines. """ import sys import bx.wiggle from galaxy.util.ucsc import ( UCSCLimitE...
#!/usr/bin/env python # code is same as ~/tools/stats/wiggle_to_simple.py """ Read a wiggle track and print out a series of lines containing "chrom position score". Ignores track lines, handles bed, variableStep and fixedStep wiggle lines. """ import sys import bx.wiggle from galaxy.util.ucsc import ( UCSCLimitE...
45,543
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/chunk.py
77,78
72,82
encode
Base64ChunkDataProvider
81,82
78,82
class Base64ChunkDataProvider(ChunkDataProvider): """ Data provider that yields chunks of base64 encoded data from its file. """ def encode(self, chunk): FILL_FUNC_BODY
class Base64ChunkDataProvider(ChunkDataProvider): """ Data provider that yields chunks of base64 encoded data from its file. """ def encode(self, chunk): """ Return chunks encoded in base 64. """ FILL_FUNC_BODY
return base64.b64encode(chunk)
""" Return chunks encoded in base 64. """ return base64.b64encode(chunk)
2
77
16
93
""" Chunk (N number of bytes at M offset to a source's beginning) provider. Primarily for file sources but usable by any iterator that has both seek and read( N ). """ import base64 import logging import os from . import ( base, exceptions, ) log = logging.getLogger(__name__) class ChunkDataProvider(base....
""" Chunk (N number of bytes at M offset to a source's beginning) provider. Primarily for file sources but usable by any iterator that has both seek and read( N ). """ import base64 import logging import os from . import ( base, exceptions, ) log = logging.getLogger(__name__) class ChunkDataProvider(base....
45,544
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/chunk.py
45,46
20,72
validate_source
ChunkDataProvider
50,55
46,55
class ChunkDataProvider(base.DataProvider): """ Data provider that yields chunks of data from its file. Note: this version does not account for lines and works with Binary datatypes. """ MAX_CHUNK_SIZE = 2**16 DEFAULT_CHUNK_SIZE = MAX_CHUNK_SIZE settings = {"chunk_index": "int", "chunk_siz...
class ChunkDataProvider(base.DataProvider): """ Data provider that yields chunks of data from its file. Note: this version does not account for lines and works with Binary datatypes. """ MAX_CHUNK_SIZE = 2**16 DEFAULT_CHUNK_SIZE = MAX_CHUNK_SIZE settings = {"chunk_index": "int", "chunk_siz...
source = super().validate_source(source) if (not hasattr(source, "seek")) or (not hasattr(source, "read")): raise exceptions.InvalidDataProviderSource(source) return source
""" Does the given source have both the methods `seek` and `read`? :raises InvalidDataProviderSource: if not. """ source = super().validate_source(source) if (not hasattr(source, "seek")) or (not hasattr(source, "read")): raise exceptions.InvalidDataProviderSo...
15
495
59
554
""" Chunk (N number of bytes at M offset to a source's beginning) provider. Primarily for file sources but usable by any iterator that has both seek and read( N ). """ import base64 import logging import os from . import ( base, exceptions, ) log = logging.getLogger(__name__) class ChunkDataProvider(base....
""" Chunk (N number of bytes at M offset to a source's beginning) provider. Primarily for file sources but usable by any iterator that has both seek and read( N ). """ import base64 import logging import os from . import ( base, exceptions, ) log = logging.getLogger(__name__) class ChunkDataProvider(base....
45,546
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/decorators.py
122,123
1,159
_parse_query_string_settings
127,159
123,159
""" DataProvider related decorators. """ # I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.: # @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias # def get_id_seq_provider( dataset, **settings ): # then in some central dispatch (maybe...
""" DataProvider related decorators. """ # I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.: # @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias # def get_id_seq_provider( dataset, **settings ): # then in some central dispatch (maybe...
# TODO: this was a relatively late addition: review and re-think def list_from_query_string(s): # assume csv return s.split(",") parsers = { "int": int, "float": float, "bool": bool, "list:str": lambda s: list_from_query_string(s), "list:escaped": la...
""" Parse the values in `query_kwargs` from strings to the proper types listed in the same key in `settings`. """ # TODO: this was a relatively late addition: review and re-think def list_from_query_string(s): # assume csv return s.split(",") parsers = { "int": int,...
167
1,531
430
1,961
""" DataProvider related decorators. """ # I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.: # @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias # def get_id_seq_provider( dataset, **settings ): # then in some central dispatch (maybe...
""" DataProvider related decorators. """ # I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.: # @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias # def get_id_seq_provider( dataset, **settings ): # then in some central dispatch (maybe...
45,547
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/external.py
54,55
32,84
subprocess
SubprocessDataProvider
59,70
55,70
class SubprocessDataProvider(base.DataProvider): """ Data provider that uses the output from an intermediate program and subprocess as its data source. """ # TODO: need better ways of checking returncode, stderr for errors and raising def __init__(self, *args, **kwargs): """ :p...
class SubprocessDataProvider(base.DataProvider): """ Data provider that uses the output from an intermediate program and subprocess as its data source. """ # TODO: need better ways of checking returncode, stderr for errors and raising def __init__(self, *args, **kwargs): """ :p...
try: # how expensive is this? popen = subprocess.Popen(command_list, stderr=subprocess.PIPE, stdout=subprocess.PIPE) log.info(f"opened subrocess ({str(command_list)}), PID: {str(popen.pid)}") except OSError as os_err: command_str = " ".join(self.command) ...
""" :param args: the list of strings used as commands. :type args: variadic function args """ try: # how expensive is this? popen = subprocess.Popen(command_list, stderr=subprocess.PIPE, stdout=subprocess.PIPE) log.info(f"opened subrocess ({str...
31
457
146
603
""" Data providers that iterate over a source that is not in memory or not in a file. """ import gzip import logging import subprocess import tempfile from urllib.parse import ( urlencode, urlparse, ) from urllib.request import urlopen from galaxy.util import DEFAULT_SOCKET_TIMEOUT from . import ( base, ...
""" Data providers that iterate over a source that is not in memory or not in a file. """ import gzip import logging import subprocess import tempfile from urllib.parse import ( urlencode, urlparse, ) from urllib.request import urlopen from galaxy.util import DEFAULT_SOCKET_TIMEOUT from . import ( base, ...
45,548
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/external.py
172,173
158,181
create_file
TempfileDataProvider
173,176
173,176
class TempfileDataProvider(base.DataProvider): """ Writes the data from the given source to a temp file, allowing it to be used as a source where a file_name is needed (e.g. as a parameter to a command line tool: samtools view -t <this_provider.source.get_file_name()>) """ def __init__(self, so...
class TempfileDataProvider(base.DataProvider): """ Writes the data from the given source to a temp file, allowing it to be used as a source where a file_name is needed (e.g. as a parameter to a command line tool: samtools view -t <this_provider.source.get_file_name()>) """ def __init__(self, so...
self.tmp_file = tempfile.NamedTemporaryFile() return self.tmp_file
self.tmp_file = tempfile.NamedTemporaryFile() return self.tmp_file
5
242
28
270
""" Data providers that iterate over a source that is not in memory or not in a file. """ import gzip import logging import subprocess import tempfile from urllib.parse import ( urlencode, urlparse, ) from urllib.request import urlopen from galaxy.util import DEFAULT_SOCKET_TIMEOUT from . import ( base, ...
""" Data providers that iterate over a source that is not in memory or not in a file. """ import gzip import logging import subprocess import tempfile from urllib.parse import ( urlencode, urlparse, ) from urllib.request import urlopen from galaxy.util import DEFAULT_SOCKET_TIMEOUT from . import ( base, ...
45,549
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/dataproviders/hierarchy.py
74,75
34,143
element_as_dict
XMLDataProvider
80,88
75,88
class XMLDataProvider(HierarchalDataProvider): """ Data provider that converts selected XML elements to dictionaries. """ # using lxml.etree's iterparse method to keep mem down # TODO: this, however (AFAIK), prevents the use of xpath settings = { "selector": "str", # urlencoded ...
class XMLDataProvider(HierarchalDataProvider): """ Data provider that converts selected XML elements to dictionaries. """ # using lxml.etree's iterparse method to keep mem down # TODO: this, however (AFAIK), prevents the use of xpath settings = { "selector": "str", # urlencoded ...
# TODO: Key collision is unlikely here, but still should be better handled return { "tag": element.tag, "text": element.text.strip() if element.text else None, # needs shallow copy to protect v. element.clear() "attrib": dict(element.attrib), }
""" Converts an XML element (its text, tag, and attributes) to dictionary form. :param element: an XML ``Element`` """ # TODO: Key collision is unlikely here, but still should be better handled return { "tag": element.tag, "text": element.text...
34
1,042
87
1,129
""" Dataproviders that iterate over lines from their sources. """ import logging from galaxy.util import ( Element, etree, ) from . import line _TODO = """ """ log = logging.getLogger(__name__) # ----------------------------------------------------------------------------- hierarchal/tree data providers c...
""" Dataproviders that iterate over lines from their sources. """ import logging from galaxy.util import ( Element, etree, ) from . import line _TODO = """ """ log = logging.getLogger(__name__) # ----------------------------------------------------------------------------- hierarchal/tree data providers c...
45,550
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/display_applications/util.py
16,17
1,30
decode_dataset_user
17,30
17,30
from galaxy.security.idencoding import IdEncodingHelper def encode_dataset_user(trans, dataset, user): # encode dataset id as usual # encode user id using the dataset create time as the key dataset_hash = trans.security.encode_id(dataset.id) if user is None: user_hash = "None" else: ...
from galaxy.security.idencoding import IdEncodingHelper def encode_dataset_user(trans, dataset, user): # encode dataset id as usual # encode user id using the dataset create time as the key dataset_hash = trans.security.encode_id(dataset.id) if user is None: user_hash = "None" else: ...
# decode dataset id as usual # decode user id using the dataset create time as the key dataset_id = trans.security.decode_id(dataset_hash) dataset = trans.sa_session.get(trans.app.model.HistoryDatasetAssociation, dataset_id) assert dataset, "Bad Dataset id provided to decode_dataset_user" if use...
# decode dataset id as usual # decode user id using the dataset create time as the key dataset_id = trans.security.decode_id(dataset_hash) dataset = trans.sa_session.get(trans.app.model.HistoryDatasetAssociation, dataset_id) assert dataset, "Bad Dataset id provided to decode_dataset_user" if use...
65
163
209
372
from galaxy.security.idencoding import IdEncodingHelper def encode_dataset_user(trans, dataset, user): # encode dataset id as usual # encode user id using the dataset create time as the key dataset_hash = trans.security.encode_id(dataset.id) if user is None: user_hash = "None" else: ...
from galaxy.security.idencoding import IdEncodingHelper def encode_dataset_user(trans, dataset, user): # encode dataset id as usual # encode user id using the dataset create time as the key dataset_hash = trans.security.encode_id(dataset.id) if user is None: user_hash = "None" else: ...
45,551
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/flow.py
24,25
18,55
set_peek
FCS
25,32
25,32
@build_sniff_from_prefix class FCS(Binary): """Class describing an FCS binary file""" file_ext = "fcs" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: FILL_FUNC_BODY def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Excepti...
@build_sniff_from_prefix class FCS(Binary): """Class describing an FCS binary file""" file_ext = "fcs" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: FILL_FUNC_BODY def display_peek(self, dataset: DatasetProtocol) -> str: try: return dataset.peek except Excepti...
if not dataset.dataset.purged: dataset.peek = "Binary FCS file" dataset.blurb = data.nice_size(dataset.get_size()) else: dataset.peek = "file does not exist" dataset.blurb = "file purged from disk"
if not dataset.dataset.purged: dataset.peek = "Binary FCS file" dataset.blurb = data.nice_size(dataset.get_size()) else: dataset.peek = "file does not exist" dataset.blurb = "file purged from disk"
24
364
83
447
""" Flow analysis datatypes. """ import logging from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from . import data log = logging.getLogger(__name__) @build_sniff_from_prefix class F...
""" Flow analysis datatypes. """ import logging from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, ) from . import data log = logging.getLogger(__name__) @build_sniff_from_prefix class F...
45,552
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
1211,1212
1196,1253
sniff_prefix
AllegroLOD
1231,1253
1212,1253
@build_sniff_from_prefix class AllegroLOD(LinkageStudies): """ Allegro output format for LOD scores """ file_ext = "allegro_fparam" def header_check(self, fio: IO) -> bool: header = fio.readline().splitlines()[0].split() if len(header) == 4 and header == ["family", "location", "LOD...
@build_sniff_from_prefix class AllegroLOD(LinkageStudies): """ Allegro output format for LOD scores """ file_ext = "allegro_fparam" def header_check(self, fio: IO) -> bool: header = fio.readline().splitlines()[0].split() if len(header) == 4 and header == ["family", "location", "LOD...
fio = file_prefix.string_io() if not self.header_check(fio): return False for lcount, line in enumerate(fio): if lcount > self.max_lines: return True tokens = line.split() try: int(tokens[0]) floa...
""" >>> classname = AllegroLOD >>> from galaxy.datatypes.sniff import get_test_fname >>> extn_true = classname().file_ext >>> file_true = get_test_fname("linkstudies." + extn_true) >>> classname().sniff(file_true) True >>> false_files = list(LinkageStudies...
37
372
158
530
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,553
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
1136,1137
1124,1196
sniff_prefix
DataIn
1156,1196
1137,1196
@build_sniff_from_prefix class DataIn(LinkageStudies): """ Common linkage input file for intermarker distances and recombination rates """ file_ext = "linkage_datain" def __init__(self, **kwd): super().__init__(**kwd) def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_F...
@build_sniff_from_prefix class DataIn(LinkageStudies): """ Common linkage input file for intermarker distances and recombination rates """ file_ext = "linkage_datain" def __init__(self, **kwd): super().__init__(**kwd) def sniff_prefix(self, file_prefix: FilePrefix) -> bool: ...
intermarkers = 0 num_markers = None def eof_function(): return intermarkers > 0 fio = file_prefix.string_io() for lcount, line in enumerate(fio): if lcount > self.max_lines: return eof_function() tokens = line.split() ...
""" >>> classname = DataIn >>> from galaxy.datatypes.sniff import get_test_fname >>> extn_true = classname().file_ext >>> file_true = get_test_fname("linkstudies." + extn_true) >>> classname().sniff(file_true) True >>> false_files = list(LinkageStudies.tes...
96
324
331
655
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,555
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
1018,1019
993,1060
sniff_prefix
GenotypeMatrix
1038,1060
1019,1060
@build_sniff_from_prefix class GenotypeMatrix(LinkageStudies): """ Sample matrix of genotypes - GTs as columns """ file_ext = "alohomora_gts" def __init__(self, **kwd): super().__init__(**kwd) def header_check(self, fio: IO) -> bool: header_elems = fio.readline().split("\t...
@build_sniff_from_prefix class GenotypeMatrix(LinkageStudies): """ Sample matrix of genotypes - GTs as columns """ file_ext = "alohomora_gts" def __init__(self, **kwd): super().__init__(**kwd) def header_check(self, fio: IO) -> bool: header_elems = fio.readline().split("\t...
fio = file_prefix.string_io() num_cols = -1 if not self.header_check(fio): return False for lcount, line in enumerate(fio): if lcount > self.max_lines: return True tokens = line.split("\t") if num_cols == -1: ...
""" >>> classname = GenotypeMatrix >>> from galaxy.datatypes.sniff import get_test_fname >>> extn_true = classname().file_ext >>> file_true = get_test_fname("linkstudies." + extn_true) >>> classname().sniff(file_true) True >>> false_files = list(LinkageStu...
45
426
176
602
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,556
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
607,608
549,621
regenerate_primary_file
IdeasPre
608,621
608,621
class IdeasPre(Html): """ This datatype defines the input format required by IDEAS: https://academic.oup.com/nar/article/44/14/6721/2468150 The IDEAS preprocessor tool produces an output using this format. The extra_files_path of the primary input dataset contains the following files and direct...
class IdeasPre(Html): """ This datatype defines the input format required by IDEAS: https://academic.oup.com/nar/article/44/14/6721/2468150 The IDEAS preprocessor tool produces an output using this format. The extra_files_path of the primary input dataset contains the following files and direct...
# Cannot do this until we are setting metadata. rval = ["<html><head></head><body>"] rval.append("<h3>Files prepared for IDEAS</h3>") rval.append("<ul>") for fname in os.listdir(dataset.extra_files_path): fn = os.path.split(fname)[-1] rval.append(f'<li><a ...
# Cannot do this until we are setting metadata. rval = ["<html><head></head><body>"] rval.append("<h3>Files prepared for IDEAS</h3>") rval.append("<ul>") for fname in os.listdir(dataset.extra_files_path): fn = os.path.split(fname)[-1] rval.append(f'<li><a ...
34
988
201
1,189
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,557
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
1079,1080
1060,1124
sniff_prefix
MarkerMap
1099,1124
1080,1124
@build_sniff_from_prefix class MarkerMap(LinkageStudies): """ Map of genetic markers including physical and genetic distance Common input format for linkage programs chrom, genetic pos, markername, physical pos, Nr """ file_ext = "linkage_map" def header_check(self, fio: IO) -> bool: ...
@build_sniff_from_prefix class MarkerMap(LinkageStudies): """ Map of genetic markers including physical and genetic distance Common input format for linkage programs chrom, genetic pos, markername, physical pos, Nr """ file_ext = "linkage_map" def header_check(self, fio: IO) -> bool: ...
fio = file_prefix.string_io() if not self.header_check(fio): return False for lcount, line in enumerate(fio): if lcount > self.max_lines: return True try: chrm, gpos, nam, bpos, row = line.split() float(gpos) ...
""" >>> classname = MarkerMap >>> from galaxy.datatypes.sniff import get_test_fname >>> extn_true = classname().file_ext >>> file_true = get_test_fname("linkstudies." + extn_true) >>> classname().sniff(file_true) True >>> false_files = list(LinkageStudies....
48
379
188
567
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,559
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
326,327
291,381
regenerate_primary_file
Rgenetics
330,344
327,344
class Rgenetics(Html): """ base class to use for rgenetics datatypes derived from html - composite datatype elements stored in extra files path """ MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="Rgenetic...
class Rgenetics(Html): """ base class to use for rgenetics datatypes derived from html - composite datatype elements stored in extra files path """ MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="Rgenetic...
efp = dataset.extra_files_path flist = os.listdir(efp) rval = [ f"<html><head><title>Files for Composite Dataset {dataset.name}</title></head><body><p/>Composite {dataset.name} contains:<p/><ul>" ] for fname in flist: sfname = os.path.split(fname)[-1] ...
""" cannot do this until we are setting metadata """ efp = dataset.extra_files_path flist = os.listdir(efp) rval = [ f"<html><head><title>Files for Composite Dataset {dataset.name}</title></head><body><p/>Composite {dataset.name} contains:<p/><ul>" ] ...
38
893
234
1,127
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,560
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
396,397
381,407
sniff
SNPMatrix
398,407
397,407
class SNPMatrix(Rgenetics): """ BioC SNPMatrix Rgenetics data collections """ file_ext = "snpmatrix" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: if not dataset.dataset.purged: dataset.peek = "Binary RGenetics file" dataset.blurb = nice_size(dataset....
class SNPMatrix(Rgenetics): """ BioC SNPMatrix Rgenetics data collections """ file_ext = "snpmatrix" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: if not dataset.dataset.purged: dataset.peek = "Binary RGenetics file" dataset.blurb = nice_size(dataset....
with open(filename, "b") as infile: head = infile.read(16) head = [hex(x) for x in head] if head != "": return False else: return True
"""need to check the file header hex code""" with open(filename, "b") as infile: head = infile.read(16) head = [hex(x) for x in head] if head != "": return False else: return True
24
179
71
250
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,561
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/genetics.py
244,245
229,253
display_peek
rgTabList
246,248
245,248
class rgTabList(Tabular): """ for sampleid and for featureid lists of exclusions or inclusions in the clean tool featureid subsets on statistical criteria -> specialized display such as gg """ file_ext = "rgTList" def __init__(self, **kwd): """ Initialize featurelistt datatype ...
class rgTabList(Tabular): """ for sampleid and for featureid lists of exclusions or inclusions in the clean tool featureid subsets on statistical criteria -> specialized display such as gg """ file_ext = "rgTList" def __init__(self, **kwd): """ Initialize featurelistt datatype ...
return self.make_html_table(dataset, column_names=self.column_names)
"""Returns formated html of peek""" return self.make_html_table(dataset, column_names=self.column_names)
3
192
26
218
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
""" rgenetics datatypes Use at your peril Ross Lazarus for the rgenetics and galaxy projects genome graphs datatypes derived from Interval datatypes genome graphs datasets have a header row with appropriate columnames The first column is always the marker - eg columname = rs, first row= rs12345 if the rows are snps su...
45,562
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/gis.py
68,69
12,100
generate_primary_file
Shapefile
69,85
69,85
class Shapefile(Binary): """The Shapefile data format: For more information please see http://en.wikipedia.org/wiki/Shapefile """ composite_type = "auto_primary_file" file_ext = "shp" def __init__(self, **kwd): super().__init__(**kwd) self.add_composite_file("shapefile.shp", de...
class Shapefile(Binary): """The Shapefile data format: For more information please see http://en.wikipedia.org/wiki/Shapefile """ composite_type = "auto_primary_file" file_ext = "shp" def __init__(self, **kwd): super().__init__(**kwd) self.add_composite_file("shapefile.shp", de...
rval = ["<html><head><title>Shapefile Galaxy Composite Dataset</title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_composite_files(dataset=dataset).items(): fn = composite_name ...
rval = ["<html><head><title>Shapefile Galaxy Composite Dataset</title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_composite_files(dataset=dataset).items(): fn = composite_name ...
47
940
288
1,228
""" GIS classes """ from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) class Shapefile(Binary): """The Shapefile data format: For more information please see http://en.wikipedia.org/wiki/Shapefile """ composite_typ...
""" GIS classes """ from galaxy.datatypes.binary import Binary from galaxy.datatypes.protocols import ( DatasetProtocol, HasExtraFilesAndMetadata, ) class Shapefile(Binary): """The Shapefile data format: For more information please see http://en.wikipedia.org/wiki/Shapefile """ composite_typ...
45,563
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
215,217
109,230
num_lines
AGPFile
218,220
217,220
class AGPFile: """ A class storing the contents of an AGP v2.1 file. https://www.ncbi.nlm.nih.gov/assembly/agp/AGP_Specification/ The class is able to read new AGP lines in order to sequentially build the complete file. The class should be capable of checking the validity of the file, as well as writi...
class AGPFile: """ A class storing the contents of an AGP v2.1 file. https://www.ncbi.nlm.nih.gov/assembly/agp/AGP_Specification/ The class is able to read new AGP lines in order to sequentially build the complete file. The class should be capable of checking the validity of the file, as well as writi...
return len(self._comment_lines) + sum(obj.num_lines for obj in self._objects)
"""Calculate the number of lines in the current state of the AGP file.""" return len(self._comment_lines) + sum(obj.num_lines for obj in self._objects)
8
1,171
29
1,200
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,564
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
538,539
463,606
_validate_numerics
AGPGapLine
539,561
539,561
class AGPGapLine(AGPLine): """ A subclass of AGPLine specifically for AGP lines that represent sequence gaps. """ allowed_comp_types = {"N", "U"} allowed_linkage_types = {"yes", "no"} allowed_gap_types = { "scaffold", "contig", "centromere", "short_arm", ...
class AGPGapLine(AGPLine): """ A subclass of AGPLine specifically for AGP lines that represent sequence gaps. """ allowed_comp_types = {"N", "U"} allowed_linkage_types = {"yes", "no"} allowed_gap_types = { "scaffold", "contig", "centromere", "short_arm", ...
# Convert all numeric types to integers try: self.line_number = int(self.line_number) self.obj_beg = int(self.obj_beg) self.obj_end = int(self.obj_end) self.pid = int(self.pid) self.gap_len = int(self.gap_len) except TypeError: ...
# Convert all numeric types to integers try: self.line_number = int(self.line_number) self.obj_beg = int(self.obj_beg) self.obj_end = int(self.obj_end) self.pid = int(self.pid) self.gap_len = int(self.gap_len) except TypeError: ...
99
1,278
330
1,608
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,565
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
352,353
308,367
_validate_obj_coords
AGPLine
353,358
353,358
class AGPLine(metaclass=abc.ABCMeta): """ An abstract base class representing a single AGP file line. Inheriting subclasses should override or implement new methods to check the validity of a single AFP line. Validity checks that involve multiple lines should not be considered. """ allowed_comp...
class AGPLine(metaclass=abc.ABCMeta): """ An abstract base class representing a single AGP file line. Inheriting subclasses should override or implement new methods to check the validity of a single AFP line. Validity checks that involve multiple lines should not be considered. """ allowed_comp...
if self.obj_beg > self.obj_end: raise AGPError( self.fname, self.line_number, f"object_beg ({self.obj_beg}) must be <= object_end ({self.obj_end})" )
if self.obj_beg > self.obj_end: raise AGPError( self.fname, self.line_number, f"object_beg ({self.obj_beg}) must be <= object_end ({self.obj_end})" )
16
503
72
575
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,566
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
282,283
230,308
add_line
AGPObject
283,304
283,304
class AGPObject: """ Represents an AGP object. Objects will consist of AGP lines, and have to adhere to certain rules. By organizing AGP lines into the objects that they comprise, we can easily calculate stats about the assembly (the collection of objects). """ def __init__(self, agp_fname, in_...
class AGPObject: """ Represents an AGP object. Objects will consist of AGP lines, and have to adhere to certain rules. By organizing AGP lines into the objects that they comprise, we can easily calculate stats about the assembly (the collection of objects). """ def __init__(self, agp_fname, in_...
# Perform validity checks if this is a new object if agp_line.obj != self.obj: raise AGPError(self.fname, agp_line, f"cannot add line from object {agp_line.obj} to object {self.obj}") # Check that our PID is sequential if agp_line.pid - self.previous_pid != 1: ra...
# Perform validity checks if this is a new object if agp_line.obj != self.obj: raise AGPError(self.fname, agp_line, f"cannot add line from object {agp_line.obj} to object {self.obj}") # Check that our PID is sequential if agp_line.pid - self.previous_pid != 1: ra...
83
595
317
912
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,567
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
418,419
367,463
_validate_numerics
AGPSeqLine
419,449
419,449
class AGPSeqLine(AGPLine): """ A subclass of AGPLine specifically for AGP lines that represent sequences. """ allowed_comp_types = {"A", "D", "F", "G", "O", "P", "W"} allowed_orientations = {"+", "-", "?", "0", "na"} def __init__( self, fname, line_number, obj, obj_beg, obj_end, pid, c...
class AGPSeqLine(AGPLine): """ A subclass of AGPLine specifically for AGP lines that represent sequences. """ allowed_comp_types = {"A", "D", "F", "G", "O", "P", "W"} allowed_orientations = {"+", "-", "?", "0", "na"} def __init__( self, fname, line_number, obj, obj_beg, obj_end, pid, c...
# Convert all numeric types to integers try: self.line_number = int(self.line_number) self.obj_beg = int(self.obj_beg) self.obj_end = int(self.obj_end) self.pid = int(self.pid) self.comp_beg = int(self.comp_beg) self.comp_end = int(...
# Convert all numeric types to integers try: self.line_number = int(self.line_number) self.obj_beg = int(self.obj_beg) self.obj_end = int(self.obj_end) self.pid = int(self.pid) self.comp_beg = int(self.comp_beg) self.comp_end = int(...
127
674
451
1,125
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,568
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/goldenpath.py
32,33
20,94
sniff_prefix
GoldenPath
50,94
33,94
@build_sniff_from_prefix class GoldenPath(Tabular): """Class describing NCBI's Golden Path assembly format""" edam_format = "format_3693" file_ext = "agp" def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> None: # AGPFile reads and validates entire file. AGP...
@build_sniff_from_prefix class GoldenPath(Tabular): """Class describing NCBI's Golden Path assembly format""" edam_format = "format_3693" file_ext = "agp" def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> None: # AGPFile reads and validates entire file. AGP...
found_non_comment_lines = False try: for line in iter_headers(file_prefix, "\t", comment_designator="#"): if line: if len(line) != 9: return False assert line[4] in ["A", "D", "F", "G", "O", "P", "W", "N", "U"] ...
""" Checks for and does cursory validation on data that looks like AGP >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('eg1.agp') >>> GoldenPath().sniff(fname) True >>> fname = get_test_fname('eg2.agp') >>> GoldenPath().sn...
109
343
473
816
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
import abc import logging import os from typing import ( Set, Union, ) from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, iter_headers, ) from .tabular import Tabular log = logging.getLogger(__name__) @build_sniff_from...
45,569
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/graph.py
80,81
67,108
set_peek
Sif
84,91
81,91
@dataproviders.decorators.has_dataproviders class Sif(tabular.Tabular): """ SIF graph format (http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats). First column: node id Second column: relationship type Third to Nth column: target ids for link """ file_ext = "sif" def ...
@dataproviders.decorators.has_dataproviders class Sif(tabular.Tabular): """ SIF graph format (http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats). First column: node id Second column: relationship type Third to Nth column: target ids for link """ file_ext = "sif" def ...
if not dataset.dataset.purged: dataset.peek = data.get_file_peek(dataset.get_file_name()) dataset.blurb = "SIF data" else: dataset.peek = "file does not exist" dataset.blurb = "file purged from disk"
""" Set the peek and blurb text """ if not dataset.dataset.purged: dataset.peek = data.get_file_peek(dataset.get_file_name()) dataset.blurb = "SIF data" else: dataset.peek = "file does not exist" dataset.blurb = "file purged from di...
23
339
86
425
""" Graph content classes. """ import logging from typing import List from galaxy.datatypes.dataproviders.column import ColumnarDataProvider from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider from galaxy.datatypes.protocols impor...
""" Graph content classes. """ import logging from typing import List from galaxy.datatypes.dataproviders.column import ColumnarDataProvider from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider from galaxy.datatypes.protocols impor...
45,570
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/graph.py
49,51
23,67
merge
Xgmml
54,61
51,61
@dataproviders.decorators.has_dataproviders class Xgmml(xml.GenericXml): """ XGMML graph format (http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats). """ file_ext = "xgmml" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: """ Set the peek and blurb text...
@dataproviders.decorators.has_dataproviders class Xgmml(xml.GenericXml): """ XGMML graph format (http://wiki.cytoscape.org/Cytoscape_User_Manual/Network_Formats). """ file_ext = "xgmml" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: """ Set the peek and blurb text...
if len(split_files) > 1: raise NotImplementedError( "Merging multiple XML files is non-trivial " + "and must be implemented for each XML type" ) # For one file only, use base class method (move/copy) data.Text.merge(split_files, output_file)
""" Merging multiple XML files is non-trivial and must be done in subclasses. """ if len(split_files) > 1: raise NotImplementedError( "Merging multiple XML files is non-trivial " + "and must be implemented for each XML type" ) # For one fil...
35
398
90
488
""" Graph content classes. """ import logging from typing import List from galaxy.datatypes.dataproviders.column import ColumnarDataProvider from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider from galaxy.datatypes.protocols impor...
""" Graph content classes. """ import logging from typing import List from galaxy.datatypes.dataproviders.column import ColumnarDataProvider from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider from galaxy.datatypes.protocols impor...
45,571
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/hdf5.py
59,60
16,85
generate_primary_file
HDF5SummarizedExperiment
61,76
60,76
class HDF5SummarizedExperiment(Data): """Composite datatype to represent HDF5SummarizedExperiment objects. A lightweight shell file `se.rds` is read into memory by R, and provides an interface to the much larger `assays.h5` files which contains the experiment data. Within R, the HDF5SummarizedExpe...
class HDF5SummarizedExperiment(Data): """Composite datatype to represent HDF5SummarizedExperiment objects. A lightweight shell file `se.rds` is read into memory by R, and provides an interface to the much larger `assays.h5` files which contains the experiment data. Within R, the HDF5SummarizedExpe...
return f""" <html> <head> <title> Files for Composite Dataset ({self.file_ext})</title> </head> <p/> This composite dataset is composed of the following files: </p> <ul> ...
"""Generate primary file to represent dataset.""" return f""" <html> <head> <title> Files for Composite Dataset ({self.file_ext})</title> </head> <p/> This composite dataset is composed of the following fil...
30
536
139
675
"""Composite datatype for the HDF5SummarizedExperiment R data object. This datatype was created for use with the iSEE interactive tool. """ from typing import Optional from galaxy.datatypes.data import Data from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( HasExtraFil...
"""Composite datatype for the HDF5SummarizedExperiment R data object. This datatype was created for use with the iSEE interactive tool. """ from typing import Optional from galaxy.datatypes.data import Data from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import ( HasExtraFil...
45,572
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
384,385
362,402
generate_primary_file
Analyze75
385,402
385,402
class Analyze75(Binary): """ Mayo Analyze 7.5 files http://www.imzml.org """ file_ext = "analyze75" composite_type = "auto_primary_file" def __init__(self, **kwd): super().__init__(**kwd) # The header file provides information about dimensions, identification, # an...
class Analyze75(Binary): """ Mayo Analyze 7.5 files http://www.imzml.org """ file_ext = "analyze75" composite_type = "auto_primary_file" def __init__(self, **kwd): super().__init__(**kwd) # The header file provides information about dimensions, identification, # an...
rval = ["<html><head><title>Analyze75 Composite Dataset.</title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_composite_files(dataset=dataset).items(): fn = composite_name ...
rval = ["<html><head><title>Analyze75 Composite Dataset.</title></head><p/>"] rval.append("<div>This composite dataset is composed of the following files:<p/><ul>") for composite_name, composite_file in self.get_composite_files(dataset=dataset).items(): fn = composite_name ...
46
269
289
558
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,573
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
456,457
450,486
sniff_prefix
Gifti
473,486
457,486
@build_sniff_from_prefix class Gifti(GenericXml): """Class describing a Gifti format""" file_ext = "gii" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: FILL_FUNC_BODY
@build_sniff_from_prefix class Gifti(GenericXml): """Class describing a Gifti format""" file_ext = "gii" def sniff_prefix(self, file_prefix: FilePrefix) -> bool: """Determines whether the file is a Gifti file >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_te...
handle = file_prefix.string_io() line = handle.readline() if not line.strip().startswith('<?xml version="1.0"'): return False line = handle.readline() if line.strip() == '<!DOCTYPE GIFTI SYSTEM "http://www.nitrc.org/frs/download.php/1594/gifti.dtd">': retu...
"""Determines whether the file is a Gifti file >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('Human.colin.R.activations.label.gii') >>> Gifti().sniff(fname) True >>> fname = get_test_fname('interval.interval') >>> Gifti().sniff(...
33
275
159
434
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,574
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
357,358
351,362
get_mime
Gmaj
359,362
358,362
class Gmaj(data.Data): """Deprecated class. Exists for limited backwards compatibility.""" edam_format = "format_3547" file_ext = "gmaj.zip" def get_mime(self) -> str: FILL_FUNC_BODY
class Gmaj(data.Data): """Deprecated class. Exists for limited backwards compatibility.""" edam_format = "format_3547" file_ext = "gmaj.zip" def get_mime(self) -> str: """Returns the mime type of the datatype""" FILL_FUNC_BODY
return "application/zip"
"""Returns the mime type of the datatype""" return "application/zip"
2
92
13
105
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,575
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
69,70
46,77
handle_dataset_as_image
Image
70,77
70,77
class Image(data.Data): """Class describing an image""" edam_data = "data_2968" edam_format = "format_3547" file_ext = "" def __init__(self, **kwd): super().__init__(**kwd) self.image_formats = [self.file_ext.upper()] def set_peek(self, dataset: DatasetProtocol, **kwd) -> None...
class Image(data.Data): """Class describing an image""" edam_data = "data_2968" edam_format = "format_3547" file_ext = "" def __init__(self, **kwd): super().__init__(**kwd) self.image_formats = [self.file_ext.upper()] def set_peek(self, dataset: DatasetProtocol, **kwd) -> None...
dataset = hda.dataset name = hda.name or "" with open(dataset.get_file_name(), "rb") as f: base64_image_data = base64.b64encode(f.read()).decode("utf-8") return f"![{name}](data:image/{self.file_ext};base64,{base64_image_data})"
dataset = hda.dataset name = hda.name or "" with open(dataset.get_file_name(), "rb") as f: base64_image_data = base64.b64encode(f.read()).decode("utf-8") return f"![{name}](data:image/{self.file_ext};base64,{base64_image_data})"
18
283
109
392
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,576
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
340,341
324,351
sniff
Mrc2014
341,351
341,351
class Mrc2014(Binary): """ MRC/CCP4 2014 file format (.mrc). https://www.ccpem.ac.uk/mrc_format/mrc2014.php >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('1.mrc') >>> Mrc2014().sniff(fname) True >>> fname = get_test_fname('2.txt') >>> Mrc2014().sni...
class Mrc2014(Binary): """ MRC/CCP4 2014 file format (.mrc). https://www.ccpem.ac.uk/mrc_format/mrc2014.php >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('1.mrc') >>> Mrc2014().sniff(fname) True >>> fname = get_test_fname('2.txt') >>> Mrc2014().sni...
try: # An exception is thrown # if the file is not an # mrc2014 file. mrcfile.load_functions.open(filename, header_only=True) return True except Exception: return False
try: # An exception is thrown # if the file is not an # mrc2014 file. mrcfile.load_functions.open(filename, header_only=True) return True except Exception: return False
24
194
76
270
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,577
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
419,420
402,426
sniff_prefix
Nifti1
420,426
420,426
@build_sniff_from_prefix class Nifti1(Binary): """ Nifti1 format https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('T1_top_350bytes.nii1') >>> Nifti1().sniff( fname ) True >>> fname = get_test_fname...
@build_sniff_from_prefix class Nifti1(Binary): """ Nifti1 format https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('T1_top_350bytes.nii1') >>> Nifti1().sniff( fname ) True >>> fname = get_test_fname...
magic = file_prefix.contents_header_bytes[344:348] if magic == b"n+1\0": return True return False
magic = file_prefix.contents_header_bytes[344:348] if magic == b"n+1\0": return True return False
11
208
51
259
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,578
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
443,444
426,450
sniff_prefix
Nifti2
444,450
444,450
@build_sniff_from_prefix class Nifti2(Binary): """ Nifti2 format https://brainder.org/2015/04/03/the-nifti-2-file-format/ >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('avg152T1_LR_nifti2_top_100bytes.nii2') >>> Nifti2().sniff( fname ) True >>> fname =...
@build_sniff_from_prefix class Nifti2(Binary): """ Nifti2 format https://brainder.org/2015/04/03/the-nifti-2-file-format/ >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('avg152T1_LR_nifti2_top_100bytes.nii2') >>> Nifti2().sniff( fname ) True >>> fname =...
magic = file_prefix.contents_header_bytes[4:8] if magic in [b"n+2\0", b"ni2\0"]: return True return False
magic = file_prefix.contents_header_bytes[4:8] if magic in [b"n+2\0", b"ni2\0"]: return True return False
12
228
56
284
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,579
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
123,124
120,130
sniff
OMETiff
124,130
124,130
class OMETiff(Tiff): file_ext = "ome.tiff" def sniff(self, filename: str) -> bool: FILL_FUNC_BODY
class OMETiff(Tiff): file_ext = "ome.tiff" def sniff(self, filename: str) -> bool: FILL_FUNC_BODY
with tifffile.TiffFile(filename) as tif: if tif.is_ome: return True return False
with tifffile.TiffFile(filename) as tif: if tif.is_ome: return True return False
10
48
44
92
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,580
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
220,221
216,226
sniff
Pdf
222,226
221,226
class Pdf(Image): edam_format = "format_3508" file_ext = "pdf" def sniff(self, filename: str) -> bool: FILL_FUNC_BODY
class Pdf(Image): edam_format = "format_3508" file_ext = "pdf" def sniff(self, filename: str) -> bool: """Determine if the file is in pdf format.""" FILL_FUNC_BODY
with open(filename, "rb") as fh: return fh.read(4) == b"%PDF"
"""Determine if the file is in pdf format.""" with open(filename, "rb") as fh: return fh.read(4) == b"%PDF"
9
72
36
108
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,581
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
503,504
486,540
sniff_prefix
Star
518,540
504,540
@build_sniff_from_prefix class Star(data.Text): """Base format class for Relion STAR (Self-defining Text Archiving and Retrieval) image files. https://relion.readthedocs.io/en/latest/Reference/Conventions.html""" file_ext = "star" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: ...
@build_sniff_from_prefix class Star(data.Text): """Base format class for Relion STAR (Self-defining Text Archiving and Retrieval) image files. https://relion.readthedocs.io/en/latest/Reference/Conventions.html""" file_ext = "star" def set_peek(self, dataset: DatasetProtocol, **kwd) -> None: ...
in_data_block = False for line in file_prefix.line_iterator(): # All lines before the first # data_ block must be comments. line = line.strip() if len(line) == 0: continue if line.startswith("data_"): in_data_blo...
"""Each file must have one or more data blocks. The start of a data block is defined by the keyword ``data_`` followed by an optional string for identification (e.g., ``data_images``). All text before the first ``data_`` keyword are comments >>> from galaxy.datatypes.sn...
67
382
190
572
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,582
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
243,244
226,262
sniff_prefix
Tck
244,262
244,262
@build_sniff_from_prefix class Tck(Binary): """ Tracks file format (.tck) format https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#tracks-file-format-tck >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('fibers_sparse_top_6_lines.tck') >>> T...
@build_sniff_from_prefix class Tck(Binary): """ Tracks file format (.tck) format https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#tracks-file-format-tck >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('fibers_sparse_top_6_lines.tck') >>> T...
format_def = [ [b"mrtrix tracks"], [b"datatype: Float32LE", b"datatype: Float32BE", b"datatype: Float64BE", b"datatype: Float64LE"], [b"count: "], [b"file: ."], [b"END"], ] matches = 0 for elem in format_def: for id...
format_def = [ [b"mrtrix tracks"], [b"datatype: Float32LE", b"datatype: Float32BE", b"datatype: Float64BE", b"datatype: Float64LE"], [b"count: "], [b"file: ."], [b"END"], ] matches = 0 for elem in format_def: for id...
45
212
174
386
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,583
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
104,107
91,120
set_meta
Tiff
107,120
107,120
class Tiff(Image): edam_format = "format_3591" file_ext = "tiff" MetadataElement( name="offsets", desc="Offsets File", param=FileParameter, file_ext="json", readonly=True, visible=False, optional=True, ) def set_meta( self, dataset: Da...
class Tiff(Image): edam_format = "format_3591" file_ext = "tiff" MetadataElement( name="offsets", desc="Offsets File", param=FileParameter, file_ext="json", readonly=True, visible=False, optional=True, ) def set_meta( self, dataset: Da...
spec_key = "offsets" offsets_file = dataset.metadata.offsets if not offsets_file: offsets_file = dataset.metadata.spec[spec_key].param.new_file( dataset=dataset, metadata_tmp_files_dir=metadata_tmp_files_dir ) with tifffile.TiffFile(dataset.get_fil...
spec_key = "offsets" offsets_file = dataset.metadata.offsets if not offsets_file: offsets_file = dataset.metadata.spec[spec_key].param.new_file( dataset=dataset, metadata_tmp_files_dir=metadata_tmp_files_dir ) with tifffile.TiffFile(dataset.get_fil...
36
152
181
333
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,584
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/images.py
279,280
262,324
sniff_prefix
Trk
280,324
280,324
@build_sniff_from_prefix class Trk(Binary): """ Track File format (.trk) is the tractography file format. http://trackvis.org/docs/?subsect=fileformat >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('IIT2mean_top_2000bytes.trk') >>> Trk().sniff( fname ) True...
@build_sniff_from_prefix class Trk(Binary): """ Track File format (.trk) is the tractography file format. http://trackvis.org/docs/?subsect=fileformat >>> from galaxy.datatypes.sniff import get_test_fname >>> fname = get_test_fname('IIT2mean_top_2000bytes.trk') >>> Trk().sniff( fname ) True...
# quick check header_raw = None header_raw = file_prefix.contents_header_bytes[:1000] if header_raw[:5] != b"TRACK": return False # detailed check header_def = [ ("magic", "S6"), ("dim", "h", 3), ("voxel_size", "f4", 3), ...
# quick check header_raw = None header_raw = file_prefix.contents_header_bytes[:1000] if header_raw[:5] != b"TRACK": return False # detailed check header_def = [ ("magic", "S6"), ("dim", "h", 3), ("voxel_size", "f4", 3), ...
107
195
513
708
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
""" Image classes """ import base64 import json import logging from typing import Optional import mrcfile import numpy as np import tifffile from galaxy.datatypes.binary import Binary from galaxy.datatypes.metadata import ( FileParameter, MetadataElement, ) from galaxy.datatypes.protocols import ( Datase...
45,585
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/datatypes/larch.py
105,106
16,123
set_peek
AthenaProject
106,123
106,123
@build_sniff_from_prefix class AthenaProject(Text): """ Athena project format """ file_ext = "prj" compressed = True compressed_format = "gzip" MetadataElement( name="atsym", desc="Atom symbol", readonly=True, visible=True, ) MetadataElement( ...
@build_sniff_from_prefix class AthenaProject(Text): """ Athena project format """ file_ext = "prj" compressed = True compressed_format = "gzip" MetadataElement( name="atsym", desc="Atom symbol", readonly=True, visible=True, ) MetadataElement( ...
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name()) dataset.info = ( f"atsym: {dataset.metadata.atsym}\n" f"bkg_e0: {dataset.metadata.bkg_e0}\n" f"edge: {dataset.metadata.edge}\n" f"npts: {da...
if not dataset.dataset.purged: dataset.peek = get_file_peek(dataset.get_file_name()) dataset.info = ( f"atsym: {dataset.metadata.atsym}\n" f"bkg_e0: {dataset.metadata.bkg_e0}\n" f"edge: {dataset.metadata.edge}\n" f"npts: {da...
44
769
232
1,001
from typing import List from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, get_headers, ) @build_sniff_fro...
from typing import List from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, get_headers, ) @build_sniff_fro...