_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q57900 | show_actions | train | def show_actions(email, role):
"""Show all assigned actions."""
if email:
actions = ActionUsers.query.join(ActionUsers.user).filter(
User.email.in_(email)
).all()
for action in actions:
click.secho('user:{0}:{1}:{2}:{3}'.format(
action.user.email,
... | python | {
"resource": ""
} |
q57901 | run_mhc_gene_assessment | train | def run_mhc_gene_assessment(job, rsem_files, rna_haplotype, univ_options, reports_options):
"""
A wrapper for assess_mhc_genes.
:param dict rsem_files: Results from running rsem
:param str rna_haplotype: The job store id for the rna haplotype file
:param dict univ_options: Dict of universal options... | python | {
"resource": ""
} |
q57902 | parse_config_file | train | def parse_config_file(job, config_file):
"""
This module will parse the config file withing params and set up the variables that will be
passed to the various tools in the pipeline.
ARGUMENTS
config_file: string containing path to a config file. An example config
file is available... | python | {
"resource": ""
} |
q57903 | run_cutadapt | train | def run_cutadapt(job, fastqs, univ_options, cutadapt_options):
"""
This module runs cutadapt on the input RNA fastq files and then calls the RNA aligners.
ARGUMENTS
1. fastqs: Dict of list of input RNA-Seq fastqs
fastqs
+- 'tumor_rna': [<JSid for 1.fastq> , <JSid for 2.fastq>]
... | python | {
"resource": ""
} |
q57904 | run_star | train | def run_star(job, fastqs, univ_options, star_options):
"""
This module uses STAR to align the RNA fastqs to the reference
ARGUMENTS
1. fastqs: REFER RETURN VALUE of run_cutadapt()
2. univ_options: Dict of universal arguments used by almost all tools
univ_options
+- 'dockerhub... | python | {
"resource": ""
} |
q57905 | run_bwa | train | def run_bwa(job, fastqs, sample_type, univ_options, bwa_options):
"""
This module aligns the SAMPLE_TYPE dna fastqs to the reference
ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor'/'normal'
1. fastqs: Dict of list of input WGS/WXS fastqs
fastqs
+- '<ST>_dna': [... | python | {
"resource": ""
} |
q57906 | bam_conversion | train | def bam_conversion(job, samfile, sample_type, univ_options):
"""
This module converts SAMFILE from sam to bam
ARGUMENTS
1. samfile: <JSid for a sam file>
2. sample_type: string of 'tumor_dna' or 'normal_dna'
3. univ_options: Dict of universal arguments used by almost all tools
univ_opt... | python | {
"resource": ""
} |
q57907 | fix_bam_header | train | def fix_bam_header(job, bamfile, sample_type, univ_options):
"""
This module modified the header in BAMFILE
ARGUMENTS
1. bamfile: <JSid for a bam file>
2. sample_type: string of 'tumor_dna' or 'normal_dna'
3. univ_options: Dict of universal arguments used by almost all tools
univ_optio... | python | {
"resource": ""
} |
q57908 | run_rsem | train | def run_rsem(job, star_bams, univ_options, rsem_options):
"""
This module will run rsem on the RNA Bam file.
ARGUMENTS
1. star_bams: Dict of input STAR bams
star_bams
+- 'rnaAligned.toTranscriptome.out.bam': <JSid>
2. univ_options: Dict of universal arguments used by almost a... | python | {
"resource": ""
} |
q57909 | merge_radia | train | def merge_radia(job, perchrom_rvs):
"""
This module will merge the per-chromosome radia files created by spawn_radia into a genome vcf.
It will make 2 vcfs, one for PASSing non-germline calls, and one for all calls.
ARGUMENTS
1. perchrom_rvs: REFER RETURN VALUE of spawn_radia()
RETURN VALUES
... | python | {
"resource": ""
} |
q57910 | run_radia | train | def run_radia(job, bams, univ_options, radia_options, chrom):
"""
This module will run radia on the RNA and DNA bams
ARGUMENTS
1. bams: Dict of bams and their indexes
bams
|- 'tumor_rna': <JSid>
|- 'tumor_rnai': <JSid>
|- 'tumor_dna': <JSid>
|- 'tumor_dnai': ... | python | {
"resource": ""
} |
q57911 | run_filter_radia | train | def run_filter_radia(job, bams, radia_file, univ_options, radia_options, chrom):
"""
This module will run filterradia on the RNA and DNA bams.
ARGUMENTS
1. bams: REFER ARGUMENTS of run_radia()
2. univ_options: REFER ARGUMENTS of run_radia()
3. radia_file: <JSid of vcf generated by run_radia()>
... | python | {
"resource": ""
} |
q57912 | merge_mutect | train | def merge_mutect(job, perchrom_rvs):
"""
This module will merge the per-chromosome mutect files created by spawn_mutect into a genome
vcf. It will make 2 vcfs, one for PASSing non-germline calls, and one for all calls.
ARGUMENTS
1. perchrom_rvs: REFER RETURN VALUE of spawn_mutect()
RETURN VAL... | python | {
"resource": ""
} |
q57913 | run_mutect | train | def run_mutect(job, tumor_bam, normal_bam, univ_options, mutect_options, chrom):
"""
This module will run mutect on the DNA bams
ARGUMENTS
1. tumor_bam: REFER ARGUMENTS of spawn_mutect()
2. normal_bam: REFER ARGUMENTS of spawn_mutect()
3. univ_options: REFER ARGUMENTS of spawn_mutect()
4. m... | python | {
"resource": ""
} |
q57914 | run_indel_caller | train | def run_indel_caller(job, tumor_bam, normal_bam, univ_options, indel_options):
"""
This module will run an indel caller on the DNA bams. This module will be
implemented in the future.
This module corresponds to node 13 on the tree
"""
job.fileStore.logToMaster('Running INDEL on %s' % univ_opti... | python | {
"resource": ""
} |
q57915 | run_fusion_caller | train | def run_fusion_caller(job, star_bam, univ_options, fusion_options):
"""
This module will run a fusion caller on DNA bams. This module will be
implemented in the future.
This module corresponds to node 10 on the tree
"""
job.fileStore.logToMaster('Running FUSION on %s' % univ_options['patient']... | python | {
"resource": ""
} |
q57916 | run_mutation_aggregator | train | def run_mutation_aggregator(job, fusion_output, radia_output, mutect_output, indel_output,
univ_options):
"""
This module will aggregate all the mutations called in the previous steps and will then call
snpeff on the results.
ARGUMENTS
1. fusion_output: <JSid for vcf gen... | python | {
"resource": ""
} |
q57917 | run_snpeff | train | def run_snpeff(job, merged_mutation_file, univ_options, snpeff_options):
"""
This module will run snpeff on the aggregated mutation calls. Currently the only mutations
called are SNPs hence SnpEff suffices. This node will be replaced in the future with another
translator.
ARGUMENTS
1. merged_m... | python | {
"resource": ""
} |
q57918 | run_transgene | train | def run_transgene(job, snpeffed_file, univ_options, transgene_options):
"""
This module will run transgene on the input vcf file from the aggregator and produce the
peptides for MHC prediction
ARGUMENTS
1. snpeffed_file: <JSid for snpeffed vcf>
2. univ_options: Dict of universal arguments used ... | python | {
"resource": ""
} |
q57919 | run_phlat | train | def run_phlat(job, fastqs, sample_type, univ_options, phlat_options):
"""
This module will run PHLAT on SAMPLE_TYPE fastqs.
ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor_dna',
'normal_dna', or 'tumor_rna'
1. fastqs: Dict of list of input WGS/WXS fastqs
fast... | python | {
"resource": ""
} |
q57920 | merge_phlat_calls | train | def merge_phlat_calls(job, tumor_phlat, normal_phlat, rna_phlat):
"""
This module will merge the results form running PHLAT on the 3 input fastq
pairs.
ARGUMENTS
1. tumor_phlat: <JSid for tumor DNA called alleles>
2. normal_phlat: <JSid for normal DNA called alleles>
3. rna_phlat: <JSid for... | python | {
"resource": ""
} |
q57921 | boost_ranks | train | def boost_ranks(job, isoform_expression, merged_mhc_calls, transgene_out, univ_options,
rank_boost_options):
"""
This is the final module in the pipeline. It will call the rank boosting R
script.
This module corresponds to node 21 in the tree
"""
job.fileStore.logToMaster('Runn... | python | {
"resource": ""
} |
q57922 | get_files_from_filestore | train | def get_files_from_filestore(job, files, work_dir, cache=True, docker=False):
"""
This is adapted from John Vivian's return_input_paths from the RNA-Seq pipeline.
Returns the paths of files from the FileStore if they are not present.
If docker=True, return the docker path for the file.
If the file ... | python | {
"resource": ""
} |
q57923 | merge_vcfs | train | def merge_vcfs(vcf_file, merged_mut_file):
"""
This module will accept the vcf files for mutect and radia read into memory in a dict object
VCF_FILE and will merge the calls. Merged calls are printed to MERGED_MUT_FILE.
VCF_FILE is a dict with
key : mutation caller (mutect or radia)
value : di... | python | {
"resource": ""
} |
q57924 | docker_call | train | def docker_call(tool, tool_parameters, work_dir, java_opts=None, outfile=None,
dockerhub='aarjunrao', interactive=False):
"""
Makes subprocess call of a command to a docker container. work_dir MUST BE AN ABSOLUTE PATH or
the call will fail. outfile is an open file descriptor to a writeable ... | python | {
"resource": ""
} |
q57925 | untargz | train | def untargz(input_targz_file, untar_to_dir):
"""
This module accepts a tar.gz archive and untars it.
RETURN VALUE: path to the untar-ed directory/file
NOTE: this module expects the multiple files to be in a directory before
being tar-ed.
"""
assert tarfile.is_tarfile(input_targz_file... | python | {
"resource": ""
} |
q57926 | bam2fastq | train | def bam2fastq(job, bamfile, univ_options):
"""
split an input bam to paired fastqs.
ARGUMENTS
1. bamfile: Path to a bam file
2. univ_options: Dict of universal arguments used by almost all tools
univ_options
|- 'dockerhub': <dockerhub to use>
+- 'java_Xmx': ... | python | {
"resource": ""
} |
q57927 | main | train | def main():
"""
This is the main function for the UCSC Precision Immuno pipeline.
"""
parser = argparse.ArgumentParser()
parser.add_argument('--config_file', dest='config_file', help='Config file to be used in the' +
'run.', type=str, required=True, default=None)
Job.Runn... | python | {
"resource": ""
} |
q57928 | run_strelka_with_merge | train | def run_strelka_with_merge(job, tumor_bam, normal_bam, univ_options, strelka_options):
"""
A wrapper for the the entire strelka sub-graph.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of un... | python | {
"resource": ""
} |
q57929 | run_strelka | train | def run_strelka(job, tumor_bam, normal_bam, univ_options, strelka_options, split=True):
"""
Run the strelka subgraph on the DNA bams. Optionally split the results into per-chromosome
vcfs.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for ... | python | {
"resource": ""
} |
q57930 | run_strelka_full | train | def run_strelka_full(job, tumor_bam, normal_bam, univ_options, strelka_options):
"""
Run strelka on the DNA bams.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of universal options used by a... | python | {
"resource": ""
} |
q57931 | wrap_unmerge | train | def wrap_unmerge(job, strelka_out, chromosomes, strelka_options, univ_options):
"""
A wwrapper to unmerge the strelka snvs and indels
:param dict strelka_out: Results from run_strelka
:param list chromosomes: List of chromosomes to retain
:param dict strelka_options: Options specific to strelka
... | python | {
"resource": ""
} |
q57932 | get_iso_time_str | train | def get_iso_time_str(timestamp: Union[int, float, str, datetime]=None) -> str:
"""Get the ISO time string from a timestamp or date obj. Returns current time str if no timestamp is passed"""
if isinstance(timestamp, (int, float)):
maya_dt = maya.MayaDT(timestamp)
elif isinstance(timestamp, str):
... | python | {
"resource": ""
} |
q57933 | truncate | train | def truncate(value: Decimal, n_digits: int) -> Decimal:
"""Truncates a value to a number of decimals places"""
return Decimal(math.trunc(value * (10 ** n_digits))) / (10 ** n_digits) | python | {
"resource": ""
} |
q57934 | truncate_to | train | def truncate_to(value: Decimal, currency: str) -> Decimal:
"""Truncates a value to the number of decimals corresponding to the currency"""
decimal_places = DECIMALS.get(currency.upper(), 2)
return truncate(value, decimal_places) | python | {
"resource": ""
} |
q57935 | truncate_money | train | def truncate_money(money: Money) -> Money:
"""Truncates money amount to the number of decimals corresponding to the currency"""
amount = truncate_to(money.amount, money.currency)
return Money(amount, money.currency) | python | {
"resource": ""
} |
q57936 | spread_value | train | def spread_value(value: Decimal, spread_p: Decimal) -> Tuple[Decimal, Decimal]:
"""Returns a lower and upper value separated by a spread percentage"""
upper = value * (1 + spread_p)
lower = value / (1 + spread_p)
return lower, upper | python | {
"resource": ""
} |
q57937 | spread_money | train | def spread_money(money: Money, spread_p: Decimal) -> Tuple[Money, Money]:
"""Returns a lower and upper money amount separated by a spread percentage"""
upper, lower = spread_value(money.amount, spread_p)
return Money(upper, money.currency), Money(lower, money.currency) | python | {
"resource": ""
} |
q57938 | check_valid_ad_range | train | def check_valid_ad_range(date):
"""
Checks if the english date is in valid range for conversion
"""
if date < values.START_EN_DATE or date > values.END_EN_DATE:
raise ValueError("Date out of range")
return True | python | {
"resource": ""
} |
q57939 | check_valid_bs_range | train | def check_valid_bs_range(date):
"""
Checks if the nepali date is in valid range for conversion
"""
ERR_MSG = "%s out of range" % str(date)
if date.year < values.START_NP_YEAR or date.year > values.END_NP_YEAR:
raise ValueError(ERR_MSG)
if date.month < 1 or date.month > 12:
raise... | python | {
"resource": ""
} |
q57940 | nepali_number | train | def nepali_number(number):
"""
Convert a number to nepali
"""
nepnum = ""
for n in str(number):
nepnum += values.NEPDIGITS[int(n)]
return nepnum | python | {
"resource": ""
} |
q57941 | GeoModelSerializer.get_fields | train | def get_fields(self):
"""Returns a fields dict for this serializer with a 'geometry' field
added.
"""
fields = super(GeoModelSerializer, self).get_fields()
# Set the geometry field name when it's undeclared.
if not self.Meta.geom_field:
for name, field in fiel... | python | {
"resource": ""
} |
q57942 | run_muse_with_merge | train | def run_muse_with_merge(job, tumor_bam, normal_bam, univ_options, muse_options):
"""
A wrapper for the the entire MuSE sub-graph.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of universal o... | python | {
"resource": ""
} |
q57943 | run_muse | train | def run_muse(job, tumor_bam, normal_bam, univ_options, muse_options):
"""
Spawn a MuSE job for each chromosome on the DNA bams.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of universal opt... | python | {
"resource": ""
} |
q57944 | run_muse_perchrom | train | def run_muse_perchrom(job, tumor_bam, normal_bam, univ_options, muse_options, chrom):
"""
Run MuSE call on a single chromosome in the input bams.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dic... | python | {
"resource": ""
} |
q57945 | run_muse_sump_perchrom | train | def run_muse_sump_perchrom(job, muse_output, univ_options, muse_options, chrom):
"""
Run MuSE sump on the MuSE call generated vcf.
:param toil.fileStore.FileID muse_output: vcf generated by MuSE call
:param dict univ_options: Dict of universal options used by almost all tools
:param dict muse_optio... | python | {
"resource": ""
} |
q57946 | AbstractRasterStore.linear | train | def linear(self, limits=None, k=5):
"""Returns an ndarray of linear breaks."""
start, stop = limits or (self.minval, self.maxval)
return np.linspace(start, stop, k) | python | {
"resource": ""
} |
q57947 | AbstractRasterStore.quantiles | train | def quantiles(self, k=5):
"""Returns an ndarray of quantile breaks."""
arr = self.array()
q = list(np.linspace(0, 100, k))
return np.percentile(arr.compressed(), q) | python | {
"resource": ""
} |
q57948 | CommaSepFloatField.to_python | train | def to_python(self, value):
"""Normalize data to a list of floats."""
if not value:
return []
return map(super(CommaSepFloatField, self).to_python, value.split(',')) | python | {
"resource": ""
} |
q57949 | CommaSepFloatField.run_validators | train | def run_validators(self, values):
"""Run validators for each item separately."""
for val in values:
super(CommaSepFloatField, self).run_validators(val) | python | {
"resource": ""
} |
q57950 | BoundingBoxField.to_python | train | def to_python(self, value):
"""Returns a GEOS Polygon from bounding box values."""
value = super(BoundingBoxField, self).to_python(value)
try:
bbox = gdal.OGRGeometry.from_bbox(value).geos
except (ValueError, AttributeError):
return []
bbox.srid = self.sri... | python | {
"resource": ""
} |
q57951 | run_mutect_with_merge | train | def run_mutect_with_merge(job, tumor_bam, normal_bam, univ_options, mutect_options):
"""
A wrapper for the the entire MuTect sub-graph.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of unive... | python | {
"resource": ""
} |
q57952 | run_mutect | train | def run_mutect(job, tumor_bam, normal_bam, univ_options, mutect_options):
"""
Spawn a MuTect job for each chromosome on the DNA bams.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_options: Dict of univers... | python | {
"resource": ""
} |
q57953 | run_mutect_perchrom | train | def run_mutect_perchrom(job, tumor_bam, normal_bam, univ_options, mutect_options, chrom):
"""
Run MuTect call on a single chromosome in the input bams.
:param dict tumor_bam: Dict of bam and bai for tumor DNA-Seq
:param dict normal_bam: Dict of bam and bai for normal DNA-Seq
:param dict univ_option... | python | {
"resource": ""
} |
q57954 | process_mutect_vcf | train | def process_mutect_vcf(job, mutect_vcf, work_dir, univ_options):
"""
Process the MuTect vcf for accepted calls.
:param toil.fileStore.FileID mutect_vcf: fsID for a MuTect generated chromosome vcf
:param str work_dir: Working directory
:param dict univ_options: Dict of universal options used by almo... | python | {
"resource": ""
} |
q57955 | Utils.get_universe | train | def get_universe(self, as_str=False):
"""Returns universe the client is connected to. See ``Universe``.
:param bool as_str: Return human-friendly universe name instead of an ID.
:rtype: int|str
"""
result = self._iface.get_connected_universe()
if as_str:
ret... | python | {
"resource": ""
} |
q57956 | LogsMixin.EXTRA_LOGGING | train | def EXTRA_LOGGING(self):
"""
lista modulos con los distintos niveles a logear y su
nivel de debug
Por ejemplo:
[Logs]
EXTRA_LOGGING = oscar.paypal:DEBUG, django.db:INFO
"""
input_text = get('EXTRA_LOGGING', '')
modules = input_text.spli... | python | {
"resource": ""
} |
q57957 | NepDate.from_ad_date | train | def from_ad_date(cls, date):
""" Gets a NepDate object from gregorian calendar date """
functions.check_valid_ad_range(date)
days = values.START_EN_DATE - date
# Add the required number of days to the start nepali date
start_date = NepDate(values.START_NP_YEAR, 1, 1)
# N... | python | {
"resource": ""
} |
q57958 | NepDate.from_bs_date | train | def from_bs_date(cls, year, month, day):
""" Create and update an NepDate object for bikram sambat date """
return NepDate(year, month, day).update() | python | {
"resource": ""
} |
q57959 | NepDate.events_list | train | def events_list(self):
""" Returns the events today """
evt = []
evt.extend(events.NEPALI_EVENTS[self.month, self.day])
evt.extend(events.ENGLISH_EVENTS[self.en_date.month, self.en_date.day])
return evt | python | {
"resource": ""
} |
q57960 | NepDate.update | train | def update(self):
""" Updates information about the NepDate """
functions.check_valid_bs_range(self)
# Here's a trick to find the gregorian date:
# We find the number of days from earliest nepali date to the current
# day. We then add the number of days to the earliest english da... | python | {
"resource": ""
} |
q57961 | get_file_from_s3 | train | def get_file_from_s3(job, s3_url, encryption_key=None, write_to_jobstore=True):
"""
Downloads a supplied URL that points to an unencrypted, unprotected file on Amazon S3. The file
is downloaded and a subsequently written to the jobstore and the return value is a the path to
the file in the jobstore.
... | python | {
"resource": ""
} |
q57962 | filter_geometry | train | def filter_geometry(queryset, **filters):
"""Helper function for spatial lookups filters.
Provide spatial lookup types as keywords without underscores instead of the
usual "geometryfield__lookuptype" format.
"""
fieldname = geo_field(queryset).name
query = {'%s__%s' % (fieldname, k): v for k, v... | python | {
"resource": ""
} |
q57963 | geo_field | train | def geo_field(queryset):
"""Returns the GeometryField for a django or spillway GeoQuerySet."""
for field in queryset.model._meta.fields:
if isinstance(field, models.GeometryField):
return field
raise exceptions.FieldDoesNotExist('No GeometryField found') | python | {
"resource": ""
} |
q57964 | get_srid | train | def get_srid(queryset):
"""Returns the GeoQuerySet spatial reference identifier."""
try:
srid = list(six.viewvalues(queryset.query.annotations))[0].srid
except (AttributeError, IndexError):
srid = None
return srid or geo_field(queryset).srid | python | {
"resource": ""
} |
q57965 | agg_dims | train | def agg_dims(arr, stat):
"""Returns a 1D array with higher dimensions aggregated using stat fn.
Arguments:
arr -- ndarray
stat -- numpy or numpy.ma function as str to call
"""
axis = None
if arr.ndim > 2:
axis = 1
arr = arr.reshape(arr.shape[0], -1)
module = np.ma if has... | python | {
"resource": ""
} |
q57966 | GeoQuerySet.extent | train | def extent(self, srid=None):
"""Returns the GeoQuerySet extent as a 4-tuple.
Keyword args:
srid -- EPSG id for for transforming the output geometry.
"""
expr = self.geo_field.name
if srid:
expr = geofn.Transform(expr, srid)
expr = models.Extent(expr)
... | python | {
"resource": ""
} |
q57967 | GeoQuerySet.pbf | train | def pbf(self, bbox, geo_col=None, scale=4096):
"""Returns tranlated and scaled geometries suitable for Mapbox vector
tiles.
"""
col = geo_col or self.geo_field.name
w, s, e, n = bbox.extent
trans = self._trans_scale(col, -w, -s,
scale / (... | python | {
"resource": ""
} |
q57968 | GeoQuerySet.tile | train | def tile(self, bbox, z=0, format=None, clip=True):
"""Returns a GeoQuerySet intersecting a tile boundary.
Arguments:
bbox -- tile extent as geometry
Keyword args:
z -- tile zoom level used as basis for geometry simplification
format -- vector tile format as str (pbf, geo... | python | {
"resource": ""
} |
q57969 | RasterQuerySet.arrays | train | def arrays(self, field_name=None):
"""Returns a list of ndarrays.
Keyword args:
field_name -- raster field name as str
"""
fieldname = field_name or self.raster_field.name
arrays = []
for obj in self:
arr = getattr(obj, fieldname)
if isins... | python | {
"resource": ""
} |
q57970 | RasterQuerySet.aggregate_periods | train | def aggregate_periods(self, periods):
"""Returns list of ndarrays averaged to a given number of periods.
Arguments:
periods -- desired number of periods as int
"""
try:
fieldname = self.raster_field.name
except TypeError:
raise exceptions.FieldDoe... | python | {
"resource": ""
} |
q57971 | RasterQuerySet.raster_field | train | def raster_field(self):
"""Returns the raster FileField instance on the model."""
for field in self.model._meta.fields:
if isinstance(field, models.FileField):
return field
return False | python | {
"resource": ""
} |
q57972 | RasterQuerySet.zipfiles | train | def zipfiles(self, path=None, arcdirname='data'):
"""Returns a .zip archive of selected rasters."""
if path:
fp = open(path, 'w+b')
else:
prefix = '%s-' % arcdirname
fp = tempfile.NamedTemporaryFile(prefix=prefix, suffix='.zip')
with zipfile.ZipFile(fp... | python | {
"resource": ""
} |
q57973 | Api.init | train | def init(self, app_id=None):
"""Initializes Steam API library.
:param str|int app_id: Application ID.
:raises: SteamApiStartupError
"""
self.set_app_id(app_id)
err_msg = (
'Unable to initialize. Check Steam client is running '
'and Steam applicat... | python | {
"resource": ""
} |
q57974 | get_files_from_filestore | train | def get_files_from_filestore(job, files, work_dir, docker=False):
"""
Download a dict of files to the given directory and modify the path to a docker-friendly one if
requested.
:param dict files: A dictionary of filenames: fsIDs
:param str work_dir: The destination directory
:param bool docker:... | python | {
"resource": ""
} |
q57975 | gunzip | train | def gunzip(input_gzip_file, block_size=1024):
"""
Gunzips the input file to the same directory
:param input_gzip_file: File to be gunzipped
:return: path to the gunzipped file
:rtype: str
"""
assert os.path.splitext(input_gzip_file)[1] == '.gz'
assert is_gzipfile(input_gzip_file)
wi... | python | {
"resource": ""
} |
q57976 | is_gzipfile | train | def is_gzipfile(filename):
"""
Attempt to ascertain the gzip status of a file based on the "magic signatures" of the file.
This was taken from the stack overflow post
http://stackoverflow.com/questions/13044562/python-mechanism-to-identify-compressed-file-type\
-and-uncompress
:param str f... | python | {
"resource": ""
} |
q57977 | get_file_from_gdc | train | def get_file_from_gdc(job, gdc_url, gdc_download_token, write_to_jobstore=True):
"""
Download a supplied "URL" that points to a file in the NCBI GDC database. The path to the gdc
download token must be provided. The file is downloaded and written to the jobstore if
requested.
:param str gdc_url: ... | python | {
"resource": ""
} |
q57978 | get_file_from_url | train | def get_file_from_url(job, any_url, encryption_key=None, per_file_encryption=True,
write_to_jobstore=True):
"""
Download a supplied URL that points to a file on an http, https or ftp server. If the file is
found to be an https s3 link then the file is downloaded using `get_file_from_s... | python | {
"resource": ""
} |
q57979 | bam2fastq | train | def bam2fastq(bamfile, univ_options, picard_options):
"""
Split an input bam to paired fastqs.
:param str bamfile: Path to a bam file
:param dict univ_options: Dict of universal options used by almost all tools
:param dict picard_options: Dict of options specific to Picard
:return: Path to the ... | python | {
"resource": ""
} |
q57980 | export_results | train | def export_results(job, fsid, file_name, univ_options, subfolder=None):
"""
Write out a file to a given location. The location can be either a directory on the local
machine, or a folder with a bucket on AWS.
:param str fsid: The file store id for the file to be exported
:param str file_name: The n... | python | {
"resource": ""
} |
q57981 | parse_chromosome_string | train | def parse_chromosome_string(job, chromosome_string):
"""
Parse a chromosome string into a list.
:param chromosome_string: Input chromosome string
:return: list of chromosomes to handle
:rtype: list
"""
if chromosome_string is None:
return []
else:
assert isinstance(chrom... | python | {
"resource": ""
} |
q57982 | email_report | train | def email_report(job, univ_options):
"""
Send an email to the user when the run finishes.
:param dict univ_options: Dict of universal options used by almost all tools
"""
fromadd = "results@protect.cgl.genomics.ucsc.edu"
msg = MIMEMultipart()
msg['From'] = fromadd
if univ_options['mail... | python | {
"resource": ""
} |
q57983 | make_key_hippie | train | def make_key_hippie(obj, typed=True):
"""Return hashable structure from non-hashable structure using hippie means
dict and set are sorted and their content subjected to same hippie means.
Note that the key identifies the current content of the structure.
"""
ftype = type if typed else lambda o: N... | python | {
"resource": ""
} |
q57984 | undecorate | train | def undecorate(func):
"""Returns the decorator and the undecorated function of given object."""
orig_call_wrapper = lambda x: x
for call_wrapper, unwrap in SUPPORTED_DECORATOR.items():
if isinstance(func, call_wrapper):
func = unwrap(func)
orig_call_wrapper = call_wrapper
... | python | {
"resource": ""
} |
q57985 | item | train | def item(ctx, appid, title):
"""Market-related commands."""
ctx.obj['appid'] = appid
ctx.obj['title'] = title | python | {
"resource": ""
} |
q57986 | get_price | train | def get_price(ctx, currency):
"""Prints out market item price."""
appid = ctx.obj['appid']
title = ctx.obj['title']
item_ = Item(appid, title)
item_.get_price_data(currency)
click.secho('Lowest price: %s %s' % (item_.price_lowest, item_.price_currency), fg='green') | python | {
"resource": ""
} |
q57987 | get_cards | train | def get_cards(ctx):
"""Prints out cards available for application."""
appid = ctx.obj['appid']
app = Application(appid)
click.secho('Cards for `%s` [appid: %s]' % (app.title, appid), fg='green')
if not app.has_cards:
click.secho('This app has no cards.', fg='red', err=True)
return... | python | {
"resource": ""
} |
q57988 | get_card_prices | train | def get_card_prices(ctx, currency):
"""Prints out lowest card prices for an application.
Comma-separated list of application IDs is supported.
"""
appid = ctx.obj['appid']
detailed = True
appids = [appid]
if ',' in appid:
appids = [appid.strip() for appid in appid.split(',')]
... | python | {
"resource": ""
} |
q57989 | get_gems | train | def get_gems(ctx):
"""Prints out total gems count for a Steam user."""
username = ctx.obj['username']
click.secho(
'Total gems owned by `%s`: %d' % (username, User(username).gems_total),
fg='green') | python | {
"resource": ""
} |
q57990 | get_games | train | def get_games(ctx):
"""Prints out games owned by a Steam user."""
username = ctx.obj['username']
games = User(username).get_games_owned()
for game in sorted(games.values(), key=itemgetter('title')):
click.echo('%s [appid: %s]' % (game['title'], game['appid']))
click.secho('Total gems owne... | python | {
"resource": ""
} |
q57991 | get_booster_stats | train | def get_booster_stats(ctx, currency):
"""Prints out price stats for booster packs available in Steam user inventory."""
username = ctx.obj['username']
inventory = User(username)._get_inventory_raw()
boosters = {}
for item in inventory['rgDescriptions'].values():
is_booster = False
... | python | {
"resource": ""
} |
q57992 | get_cards_stats | train | def get_cards_stats(ctx, currency, skip_owned, appid, foil):
"""Prints out price stats for cards available in Steam user inventory."""
username = ctx.obj['username']
cards_by_app = defaultdict(list)
inventory = User(username).traverse_inventory(item_filter=TAG_ITEM_CLASS_CARD)
for item in inventor... | python | {
"resource": ""
} |
q57993 | run_radia_with_merge | train | def run_radia_with_merge(job, rna_bam, tumor_bam, normal_bam, univ_options, radia_options):
"""
A wrapper for the the entire RADIA sub-graph.
:param dict rna_bam: Dict dicts of bam and bai for tumor RNA-Seq obtained by running STAR within
ProTECT.
:param dict tumor_bam: Dict of bam and bai f... | python | {
"resource": ""
} |
q57994 | run_radia | train | def run_radia(job, rna_bam, tumor_bam, normal_bam, univ_options, radia_options):
"""
Spawn a RADIA job for each chromosome on the input bam trios.
:param dict rna_bam: Dict of bam and bai for tumor DNA-Seq. It can be one of two formats
rna_bam: # Just the genomic bam and bai
|... | python | {
"resource": ""
} |
q57995 | run_radia_perchrom | train | def run_radia_perchrom(job, bams, univ_options, radia_options, chrom):
"""
Run RADIA call on a single chromosome in the input bams.
:param dict bams: Dict of bam and bai for tumor DNA-Seq, normal DNA-Seq and tumor RNA-Seq
:param dict univ_options: Dict of universal options used by almost all tools
... | python | {
"resource": ""
} |
q57996 | run_filter_radia | train | def run_filter_radia(job, bams, radia_file, univ_options, radia_options, chrom):
"""
Run filterradia on the RADIA output.
:param dict bams: Dict of bam and bai for tumor DNA-Seq, normal DNA-Seq and tumor RNA-Seq
:param toil.fileStore.FileID radia_file: The vcf from runnning RADIA
:param dict univ_o... | python | {
"resource": ""
} |
q57997 | index_bamfile | train | def index_bamfile(job, bamfile, sample_type, univ_options, samtools_options, sample_info=None,
export=True):
"""
Index `bamfile` using samtools
:param toil.fileStore.FileID bamfile: fsID for the bam file
:param str sample_type: Description of the sample to inject into the filename
... | python | {
"resource": ""
} |
q57998 | sort_bamfile | train | def sort_bamfile(job, bamfile, sample_type, univ_options, samtools_options):
"""
Sort `bamfile` using samtools
:param toil.fileStore.FileID bamfile: fsID for the bam file
:param str sample_type: Description of the sample to inject into the filename
:param dict univ_options: Dict of universal option... | python | {
"resource": ""
} |
q57999 | get_identity | train | def get_identity(user):
"""Create an identity for a given user instance.
Primarily useful for testing.
"""
identity = Identity(user.id)
if hasattr(user, 'id'):
identity.provides.add(UserNeed(user.id))
for role in getattr(user, 'roles', []):
identity.provides.add(RoleNeed(role.... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.