INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Decorate function to return LazyProxy.
def lazy_result(f): """Decorate function to return LazyProxy.""" @wraps(f) def decorated(ctx, param, value): return LocalProxy(lambda: f(ctx, param, value)) return decorated
Return an action if exists.
def process_action(ctx, param, value): """Return an action if exists.""" actions = current_app.extensions['invenio-access'].actions if value not in actions: raise click.BadParameter('Action "%s" is not registered.', value) return actions[value]
Return an user if it exists.
def process_email(ctx, param, value): """Return an user if it exists.""" user = User.query.filter(User.email == value).first() if not user: raise click.BadParameter('User with email \'%s\' not found.', value) return user
Return a role if it exists.
def process_role(ctx, param, value): """Return a role if it exists.""" role = Role.query.filter(Role.name == value).first() if not role: raise click.BadParameter('Role with name \'%s\' not found.', value) return role
Allow a user identified by an email address.
def allow_user(user): """Allow a user identified by an email address.""" def processor(action, argument): db.session.add( ActionUsers.allow(action, argument=argument, user_id=user.id) ) return processor
Allow a role identified by an email address.
def allow_role(role): """Allow a role identified by an email address.""" def processor(action, argument): db.session.add( ActionRoles.allow(action, argument=argument, role_id=role.id) ) return processor
Process allow action.
def process_allow_action(processors, action, argument): """Process allow action.""" for processor in processors: processor(action, argument) db.session.commit()
Deny a role identified by an email address.
def deny_role(role): """Deny a role identified by an email address.""" def processor(action, argument): db.session.add( ActionRoles.deny(action, argument=argument, role_id=role.id) ) return processor
Deny a user identified by an email address.
def deny_user(user): """Deny a user identified by an email address.""" def processor(action, argument): db.session.add( ActionUsers.deny(action, argument=argument, user_id=user.id) ) return processor
Process deny action.
def process_deny_action(processors, action, argument): """Process deny action.""" for processor in processors: processor(action, argument) db.session.commit()
Remove global action rule.
def remove_global(): """Remove global action rule.""" def processor(action, argument): ActionUsers.query_by_action(action, argument=argument).filter( ActionUsers.user_id.is_(None) ).delete(synchronize_session=False) return processor
Remove a action for a user.
def remove_user(user): """Remove a action for a user.""" def processor(action, argument): ActionUsers.query_by_action(action, argument=argument).filter( ActionUsers.user_id == user.id ).delete(synchronize_session=False) return processor
Remove a action for a role.
def remove_role(role): """Remove a action for a role.""" def processor(action, argument): ActionRoles.query_by_action(action, argument=argument).filter( ActionRoles.role_id == role.id ).delete(synchronize_session=False) return processor
Process action removals.
def process_remove_action(processors, action, argument): """Process action removals.""" for processor in processors: processor(action, argument) db.session.commit()
List all registered actions.
def list_actions(): """List all registered actions.""" for name, action in _current_actions.items(): click.echo('{0}:{1}'.format( name, '*' if hasattr(action, 'argument') else '' ))
Show all assigned actions.
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, ...
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 used by almost all tools :param dict reports_options: Options specific to reporting modules :re...
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...
Assess the prevalence of the various genes in the MHC pathway and return a report in the tsv format. :param toil.fileStore.FileID gene_expression: fsID for the rsem gene expression file :param toil.fileStore.FileID|None rna_haplotype: fsID for the RNA PHLAT file :param dict univ_options: Dict of univer...
def assess_mhc_genes(job, gene_expression, rna_haplotype, univ_options, reports_options): """ Assess the prevalence of the various genes in the MHC pathway and return a report in the tsv format. :param toil.fileStore.FileID gene_expression: fsID for the rsem gene expression file :param toil.fileSto...
Setter method for af_ipv4_uc_and_vrf_cmds_call_point_holder, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/af_ipv4_uc_and_vrf_cmds_call_point_holder (container) If this variable is read-only (config: false) in the source YANG file, then _set_af_ipv4_uc_and_...
def _set_af_ipv4_uc_and_vrf_cmds_call_point_holder(self, v, load=False): """ Setter method for af_ipv4_uc_and_vrf_cmds_call_point_holder, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/af_ipv4_uc_and_vrf_cmds_call_point_holder (container) If this variabl...
Setter method for post, mapped from YANG variable /diag/post (container) If this variable is read-only (config: false) in the source YANG file, then _set_post is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_post() directly.
def _set_post(self, v, load=False): """ Setter method for post, mapped from YANG variable /diag/post (container) If this variable is read-only (config: false) in the source YANG file, then _set_post is considered as a private method. Backends looking to populate this variable should do so via ca...
Setter method for static_network, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/static_network (list) If this variable is read-only (config: false) in the source YANG file, then _set_static_network is considered as a private method. Backends looking to ...
def _set_static_network(self, v, load=False): """ Setter method for static_network, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/static_network (list) If this variable is read-only (config: false) in the source YANG file, then _set_static_network i...
Setter method for network, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/network (list) If this variable is read-only (config: false) in the source YANG file, then _set_network is considered as a private method. Backends looking to populate this variabl...
def _set_network(self, v, load=False): """ Setter method for network, mapped from YANG variable /rbridge_id/router/router_bgp/address_family/ipv4/ipv4_unicast/default_vrf/network (list) If this variable is read-only (config: false) in the source YANG file, then _set_network is considered as a private ...
Setter method for ptp, mapped from YANG variable /interface/port_channel/protocol/ptp (container) If this variable is read-only (config: false) in the source YANG file, then _set_ptp is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_ptp()...
def _set_ptp(self, v, load=False): """ Setter method for ptp, mapped from YANG variable /interface/port_channel/protocol/ptp (container) If this variable is read-only (config: false) in the source YANG file, then _set_ptp is considered as a private method. Backends looking to populate this variable ...
Setter method for nssa_area_no_summary, mapped from YANG variable /rbridge_id/ipv6/router/ospf/area/nssa/nssa_area_no_summary (empty) If this variable is read-only (config: false) in the source YANG file, then _set_nssa_area_no_summary is considered as a private method. Backends looking to populate this var...
def _set_nssa_area_no_summary(self, v, load=False): """ Setter method for nssa_area_no_summary, mapped from YANG variable /rbridge_id/ipv6/router/ospf/area/nssa/nssa_area_no_summary (empty) If this variable is read-only (config: false) in the source YANG file, then _set_nssa_area_no_summary is considere...
Setter method for l1_auth_profile, mapped from YANG variable /isis_state/router_isis_config/l1_auth_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_auth_profile is considered as a private method. Backends looking to populate this variable should do...
def _set_l1_auth_profile(self, v, load=False): """ Setter method for l1_auth_profile, mapped from YANG variable /isis_state/router_isis_config/l1_auth_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_auth_profile is considered as a private metho...
Setter method for l2_auth_profile, mapped from YANG variable /isis_state/router_isis_config/l2_auth_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_l2_auth_profile is considered as a private method. Backends looking to populate this variable should do...
def _set_l2_auth_profile(self, v, load=False): """ Setter method for l2_auth_profile, mapped from YANG variable /isis_state/router_isis_config/l2_auth_profile (container) If this variable is read-only (config: false) in the source YANG file, then _set_l2_auth_profile is considered as a private metho...
Setter method for l1_spf_timer, mapped from YANG variable /isis_state/router_isis_config/l1_spf_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_spf_timer is considered as a private method. Backends looking to populate this variable should do so via c...
def _set_l1_spf_timer(self, v, load=False): """ Setter method for l1_spf_timer, mapped from YANG variable /isis_state/router_isis_config/l1_spf_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_spf_timer is considered as a private method. Backends ...
Setter method for l1_spf6_timer, mapped from YANG variable /isis_state/router_isis_config/l1_spf6_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_spf6_timer is considered as a private method. Backends looking to populate this variable should do so vi...
def _set_l1_spf6_timer(self, v, load=False): """ Setter method for l1_spf6_timer, mapped from YANG variable /isis_state/router_isis_config/l1_spf6_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l1_spf6_timer is considered as a private method. Backe...
Setter method for l2_spf6_timer, mapped from YANG variable /isis_state/router_isis_config/l2_spf6_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l2_spf6_timer is considered as a private method. Backends looking to populate this variable should do so vi...
def _set_l2_spf6_timer(self, v, load=False): """ Setter method for l2_spf6_timer, mapped from YANG variable /isis_state/router_isis_config/l2_spf6_timer (container) If this variable is read-only (config: false) in the source YANG file, then _set_l2_spf6_timer is considered as a private method. Backe...
Setter method for name_of_keychain, mapped from YANG variable /keychain/name_of_keychain (string) If this variable is read-only (config: false) in the source YANG file, then _set_name_of_keychain is considered as a private method. Backends looking to populate this variable should do so via calling thisO...
def _set_name_of_keychain(self, v, load=False): """ Setter method for name_of_keychain, mapped from YANG variable /keychain/name_of_keychain (string) If this variable is read-only (config: false) in the source YANG file, then _set_name_of_keychain is considered as a private method. Backends looking ...
Setter method for key, mapped from YANG variable /keychain/key (list) If this variable is read-only (config: false) in the source YANG file, then _set_key is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_key() directly.
def _set_key(self, v, load=False): """ Setter method for key, mapped from YANG variable /keychain/key (list) If this variable is read-only (config: false) in the source YANG file, then _set_key is considered as a private method. Backends looking to populate this variable should do so via calling...
Setter method for ma_type, mapped from YANG variable /cfm_state/cfm_detail/domain/ma/ma_type (ma-types) If this variable is read-only (config: false) in the source YANG file, then _set_ma_type is considered as a private method. Backends looking to populate this variable should do so via calling thisObj....
def _set_ma_type(self, v, load=False): """ Setter method for ma_type, mapped from YANG variable /cfm_state/cfm_detail/domain/ma/ma_type (ma-types) If this variable is read-only (config: false) in the source YANG file, then _set_ma_type is considered as a private method. Backends looking to populate ...
Setter method for ccm_interval, mapped from YANG variable /cfm_state/cfm_detail/domain/ma/ccm_interval (ccm-intervals) If this variable is read-only (config: false) in the source YANG file, then _set_ccm_interval is considered as a private method. Backends looking to populate this variable should do so ...
def _set_ccm_interval(self, v, load=False): """ Setter method for ccm_interval, mapped from YANG variable /cfm_state/cfm_detail/domain/ma/ccm_interval (ccm-intervals) If this variable is read-only (config: false) in the source YANG file, then _set_ccm_interval is considered as a private method. Back...
Setter method for bfd_static_route, mapped from YANG variable /rbridge_id/vrf/address_family/ip/unicast/ip/route/static/bfd/bfd_static_route (list) If this variable is read-only (config: false) in the source YANG file, then _set_bfd_static_route is considered as a private method. Backends looking to populat...
def _set_bfd_static_route(self, v, load=False): """ Setter method for bfd_static_route, mapped from YANG variable /rbridge_id/vrf/address_family/ip/unicast/ip/route/static/bfd/bfd_static_route (list) If this variable is read-only (config: false) in the source YANG file, then _set_bfd_static_route is con...
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 at https://s3-us-west-2.amaz...
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...
The precision immuno pipeline begins at this module. The DAG can be viewed in Flowchart.txt This module corresponds to node 0 on the tree
def pipeline_launchpad(job, fastqs, univ_options, tool_options): """ The precision immuno pipeline begins at this module. The DAG can be viewed in Flowchart.txt This module corresponds to node 0 on the tree """ # Add Patient id to univ_options as is is passed to every major node in the DAG and can ...
This module will delete the fastqs from teh job Store once their purpose has been achieved (i.e. after all mapping steps) ARGUMENTS 1. fastqs: Dict of list of input fastqs fastqs +- 'tumor_rna': [<JSid for 1.fastq> , <JSid for 2.fastq>] +- 'tumor_dna': [<JSid for 1.fastq> ,...
def delete_fastqs(job, fastqs): """ This module will delete the fastqs from teh job Store once their purpose has been achieved (i.e. after all mapping steps) ARGUMENTS 1. fastqs: Dict of list of input fastqs fastqs +- 'tumor_rna': [<JSid for 1.fastq> , <JSid for 2.fastq>] ...
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>] 2. univ_options: Dict of universal arguments used by almost all tools ...
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>] ...
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': <dockerhub to use> 3. star_options: Dict of parameters speci...
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...
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': [<JSid for 1.fastq> , <JSid for 2.fastq>] 2. sample_type: string of 'tumor_...
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': [...
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_options +- 'dockerhub': <dockerhub to use> RETURN VALUES...
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...
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_options +- 'dockerhub': <dockerhub to use> RETURN VALUES ...
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...
This module adds the appropriate read groups to the bam file 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_options |- 'dockerhub': <dockerhub to use> ...
def add_readgroups(job, bamfile, sample_type, univ_options): """ This module adds the appropriate read groups to the bam file 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 ...
This module indexes 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_options +- 'dockerhub': <dockerhub to use> RETURN VALUES 1. output_fil...
def index_bamfile(job, bamfile, sample_type, univ_options): """ This module indexes 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_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 all tools univ_options +- 'dockerhub': <docker...
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...
This module will assess the prevalence of the various genes in the MHC pathway and return a report in the tsv format :param isoform_expression: Isoform expression from run_rsem :param rna_haplotype: PHLAT output from running on rna :param univ_options: Universal options for the pipeline :param mhc_g...
def assess_mhc_genes(job, isoform_expression, rna_haplotype, univ_options, mhc_genes_options): """ This module will assess the prevalence of the various genes in the MHC pathway and return a report in the tsv format :param isoform_expression: Isoform expression from run_rsem :param rna_haplotype: PH...
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 1. output_files: Dict of outputs ...
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 ...
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': <JSid> |- 'normal_dna': <JSid> +- 'normal_dnai': <JSid> ...
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': ...
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()> 3. radia_options: REFER ARGUMENTS of run_radia() 4. chrom: REFER ARGUMENTS of run_rad...
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()> ...
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 VALUES 1. output_files: <JSid for mutect_passing...
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...
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. mutect_options: REFER ARGUMENTS of spawn_mutect() 5. chrom: String containing chromosome n...
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...
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
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...
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
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']...
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 generated by the fusion caller> 2. radia_output: <JSid for vcf generated by radia> 3. mutect_output: <JSid for vcf generated by mutect> 4...
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...
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_mutation_file: <JSid for merged vcf> 2. univ_options: Dict of universal arguments ...
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...
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 by almost all tools univ_options +- 'dockerhub': <dockerhub...
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 ...
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 fastqs +- '<ST>': [<JSid for 1.fastq> , <JSid for 2.fastq>] 2. sampl...
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...
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 tumor RNA called alleles> RETURN VALUES 1. output_files: Dict of JSi...
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...
Based on the number of alleles obtained from node 14, this module will spawn callers to predict MHCI:peptide and MHCII:peptide binding on the peptide files from node 17. Once all MHC:peptide predictions are made, merge them via a follow-on job. ARGUMENTS 1. transgened_files: REFER RETURN VALUE of run_...
def spawn_antigen_predictors(job, transgened_files, phlat_files, univ_options, mhc_options): """ Based on the number of alleles obtained from node 14, this module will spawn callers to predict MHCI:peptide and MHCII:peptide binding on the peptide files from node 17. Once all MHC:peptide predictions are...
This module will predict MHC:peptide binding for peptides in the files created in node XX to ALLELE. ALLELE represents an MHCI allele. This module corresponds to node 18 on the tree
def predict_mhci_binding(job, peptfile, allele, peplen, univ_options, mhci_options): """ This module will predict MHC:peptide binding for peptides in the files created in node XX to ALLELE. ALLELE represents an MHCI allele. This module corresponds to node 18 on the tree ""...
This module will predict MHC:peptide binding for peptides in the files created in node YY to ALLELE. ALLELE represents an MHCII allele. The module returns (PREDFILE, PREDICTOR) where PREDFILE contains the predictions and PREDICTOR is the predictor used (Consensus, NetMHCIIpan, or Sturniolo). This mod...
def predict_mhcii_binding(job, peptfile, allele, univ_options, mhcii_options): """ This module will predict MHC:peptide binding for peptides in the files created in node YY to ALLELE. ALLELE represents an MHCII allele. The module returns (PREDFILE, PREDICTOR) where PREDFILE contains the predictions an...
This module will merge all the calls from nodes 18 and 19, and will filter for the top X%% of binders of each allele. The module will then call the rank boosting script to finish off the pipeline. This module corresponds to node 19 on the tree
def merge_mhc_peptide_calls(job, antigen_predictions, transgened_files): """ This module will merge all the calls from nodes 18 and 19, and will filter for the top X%% of binders of each allele. The module will then call the rank boosting script to finish off the pipeline. This module corresponds ...
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
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...
This is a generator function to parse and yield the various groups of parameters from CONFIG_FILE one at a time. Input arguments: config_file - a file handle to an open file stream that is reading the input config file to the pipeline. Return (Yielded) Values: group_nam...
def tool_specific_param_generator(job, config_file): """ This is a generator function to parse and yield the various groups of parameters from CONFIG_FILE one at a time. Input arguments: config_file - a file handle to an open file stream that is reading the input config fil...
Get the input file from s3 or disk, untargz if necessary and then write to file job store. :param job: job :param str input_flag: The name of the flag :param str input_file: The value passed in the config file :return: The jobstore ID for the file
def get_pipeline_inputs(job, input_flag, input_file): """ Get the input file from s3 or disk, untargz if necessary and then write to file job store. :param job: job :param str input_flag: The name of the flag :param str input_file: The value passed in the config file :return: The jobstore ID for...
This module will accept a dict object holding the 3 input prefixes and the patient id and will attempt to store the fastqs to the jobstore. The input files must satisfy the following 1. File extensions can only be fastq or fq (.gz is also allowed) 2. Forward and reverse reads MUST be in the same folder wit...
def prepare_samples(job, fastqs, univ_options): """ This module will accept a dict object holding the 3 input prefixes and the patient id and will attempt to store the fastqs to the jobstore. The input files must satisfy the following 1. File extensions can only be fastq or fq (.gz is also allowed) ...
This module accepts a list of tuples of (allele, p_value) pairs. It returns the 2 most probable alleles for that group.
def most_probable_alleles(allele_list): """ This module accepts a list of tuples of (allele, p_value) pairs. It returns the 2 most probable alleles for that group. """ all_alleles = defaultdict() # First collect all the keys. Make a dict with allele as key and list of pvalues as value for a...
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 extension is tar.gz, then tar -zxvf it. files is a dict with: keys = the name...
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 ...
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 : dict with key: (chrom, pos, ref, alt) ...
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...
This function will parse the vcf to detect sites having multiple alt alleles and pick out on the most likely ones. INFILE : open file handle for the input vcf OUTFILE : open file handle for the output vcf The columns in INFILE are [0] CHROM [1] POS [2] ID [3] REF [4] ALT [...
def parse_radia_multi_alt(infile, outfile): """ This function will parse the vcf to detect sites having multiple alt alleles and pick out on the most likely ones. INFILE : open file handle for the input vcf OUTFILE : open file handle for the output vcf The columns in INFILE are [0] CHROM ...
To reduce code redundancy, this module will accept data from merge_mhc_peptide_calls for a given neoepitope and print it to outfile ARGUMENTS 1. neoepitope_info: Tuple of (<allele>, <peptide_sequence>, <binding_prediction>) 2. peptides: Dict of all IARS considered ...
def print_mhc_peptide(neoepitope_info, peptides, pepmap, outfile): """ To reduce code redundancy, this module will accept data from merge_mhc_peptide_calls for a given neoepitope and print it to outfile ARGUMENTS 1. neoepitope_info: Tuple of (<allele>, <peptide_sequence>, ...
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 file.
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 ...
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.
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...
This function attempts to ascertain the gzip status of a file based on the "magic signatures" of the file. This was taken from the stack overflow http://stackoverflow.com/questions/13044562/python-mechanism-to-identify-compressed-file-type\ -and-uncompress
def is_gzipfile(filename): """ This function attempts to ascertain the gzip status of a file based on the "magic signatures" of the file. This was taken from the stack overflow http://stackoverflow.com/questions/13044562/python-mechanism-to-identify-compressed-file-type\ -and-uncompress """ ...
This function will download the file from cghub using the xml specified by cghub_xml ARGUMENTS 1. cghub_xml: Path to an xml file for cghub. 2. cghub_key: Credentials for a cghub download operation. 3. write_to_jobstore: Flag indicating whether the final product should be written to jobStore. RETUR...
def get_file_from_cghub(job, cghub_xml, cghub_key, univ_options, write_to_jobstore=True): """ This function will download the file from cghub using the xml specified by cghub_xml ARGUMENTS 1. cghub_xml: Path to an xml file for cghub. 2. cghub_key: Credentials for a cghub download operation. 3. ...
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': value for max heap passed to java
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': ...
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. TODO: Azure support :param file_path: The path to the file that neeeds to be transferred to the new location. :param univ_options: A dict of the universal options passed t...
def export_results(file_path, univ_options): """ 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. TODO: Azure support :param file_path: The path to the file that neeeds to be transferred to the new location. :par...
Parse the input phlat file to pull out the alleles it contains :param phlatfile: Open file descriptor for a phlat output sum file :param mhc_alleles: dictionary of alleles.
def parse_phlat_file(phlatfile, mhc_alleles): """ Parse the input phlat file to pull out the alleles it contains :param phlatfile: Open file descriptor for a phlat output sum file :param mhc_alleles: dictionary of alleles. """ for line in phlatfile: if line.startswith('Locus'): ...
Get the file extension wrt compression from the filename (is it tar or targz) :param str filepath: Path to the file :return str ext: Compression extension name
def file_xext(filepath): """ Get the file extension wrt compression from the filename (is it tar or targz) :param str filepath: Path to the file :return str ext: Compression extension name """ ext = os.path.splitext(filepath)[1] if ext == '.gz': xext = os.path.splitext(os.path.splite...
Strips the compression extension from the filename :param filepath: Path to compressed file. :return str filepath: Path to the file with the compression extension stripped off.
def strip_xext(filepath): """ Strips the compression extension from the filename :param filepath: Path to compressed file. :return str filepath: Path to the file with the compression extension stripped off. """ ext_size = len(file_xext(filepath).split('.')) - 1 for i in xrange(0, ext_size): ...
This is the main function for the UCSC Precision Immuno pipeline.
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...
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 universal options used by almost all tools :param dict strelka_options: Options specific to strel...
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...
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 normal DNA-Seq :param dict univ_options: Dict of universal options used by almost all tools ...
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 ...
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 almost all tools :param dict strelka_options: Options specific to strelka :return: Dic...
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...
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 :param dict univ_options: Dict of universal options used by almost all tools :return: D...
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 ...
Setter method for prefix_list, mapped from YANG variable /rbridge_id/ip/prefix_list (list) If this variable is read-only (config: false) in the source YANG file, then _set_prefix_list is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_pref...
def _set_prefix_list(self, v, load=False): """ Setter method for prefix_list, mapped from YANG variable /rbridge_id/ip/prefix_list (list) If this variable is read-only (config: false) in the source YANG file, then _set_prefix_list is considered as a private method. Backends looking to populate this ...
Setter method for rtm_config, mapped from YANG variable /rbridge_id/ip/rtm_config (container) If this variable is read-only (config: false) in the source YANG file, then _set_rtm_config is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_rt...
def _set_rtm_config(self, v, load=False): """ Setter method for rtm_config, mapped from YANG variable /rbridge_id/ip/rtm_config (container) If this variable is read-only (config: false) in the source YANG file, then _set_rtm_config is considered as a private method. Backends looking to populate this...
Setter method for rsvp_reservable_bandwidth, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_reservable_bandwidth (container) If this variable is read-only (config: false) in the source YANG file, then _set_rsvp_reservable_bandwidth is considered as a private met...
def _set_rsvp_reservable_bandwidth(self, v, load=False): """ Setter method for rsvp_reservable_bandwidth, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_reservable_bandwidth (container) If this variable is read-only (config: false) in the source YANG file, t...
Setter method for rsvp_authentication, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_authentication (container) If this variable is read-only (config: false) in the source YANG file, then _set_rsvp_authentication is considered as a private method. Backends look...
def _set_rsvp_authentication(self, v, load=False): """ Setter method for rsvp_authentication, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_authentication (container) If this variable is read-only (config: false) in the source YANG file, then _set_rsvp_auth...
Setter method for interface_rsvp_hello, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_rsvp_hello (container) If this variable is read-only (config: false) in the source YANG file, then _set_interface_rsvp_hello is considered as a private method. Backends l...
def _set_interface_rsvp_hello(self, v, load=False): """ Setter method for interface_rsvp_hello, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_rsvp_hello (container) If this variable is read-only (config: false) in the source YANG file, then _set_interf...
Setter method for rsvp_hello_disable, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_hello_disable (empty) If this variable is read-only (config: false) in the source YANG file, then _set_rsvp_hello_disable is considered as a private method. Backends looking to ...
def _set_rsvp_hello_disable(self, v, load=False): """ Setter method for rsvp_hello_disable, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/rsvp_hello_disable (empty) If this variable is read-only (config: false) in the source YANG file, then _set_rsvp_hello_disab...
Setter method for interface_refresh_reduction, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction (container) If this variable is read-only (config: false) in the source YANG file, then _set_interface_refresh_reduction is considered as a private ...
def _set_interface_refresh_reduction(self, v, load=False): """ Setter method for interface_refresh_reduction, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_refresh_reduction (container) If this variable is read-only (config: false) in the source YANG f...
Setter method for interface_reliable_messaging, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_reliable_messaging (container) If this variable is read-only (config: false) in the source YANG file, then _set_interface_reliable_messaging is considered as a privat...
def _set_interface_reliable_messaging(self, v, load=False): """ Setter method for interface_reliable_messaging, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/mpls_interface/rsvp/interface_reliable_messaging (container) If this variable is read-only (config: false) in the source YAN...
Setter method for show_zoning_enabled_configuration, mapped from YANG variable /brocade_zone_rpc/show_zoning_enabled_configuration (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_show_zoning_enabled_configuration is considered as a private method. Backends looking to p...
def _set_show_zoning_enabled_configuration(self, v, load=False): """ Setter method for show_zoning_enabled_configuration, mapped from YANG variable /brocade_zone_rpc/show_zoning_enabled_configuration (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_show_zoning_enabl...
Setter method for set_dscp, mapped from YANG variable /policy_map/class/set/set_dscp (container) If this variable is read-only (config: false) in the source YANG file, then _set_set_dscp is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_s...
def _set_set_dscp(self, v, load=False): """ Setter method for set_dscp, mapped from YANG variable /policy_map/class/set/set_dscp (container) If this variable is read-only (config: false) in the source YANG file, then _set_set_dscp is considered as a private method. Backends looking to populate this ...
Setter method for speculate_mpls, mapped from YANG variable /lag/hash/speculate_mpls (container) If this variable is read-only (config: false) in the source YANG file, then _set_speculate_mpls is considered as a private method. Backends looking to populate this variable should do so via calling thisObj....
def _set_speculate_mpls(self, v, load=False): """ Setter method for speculate_mpls, mapped from YANG variable /lag/hash/speculate_mpls (container) If this variable is read-only (config: false) in the source YANG file, then _set_speculate_mpls is considered as a private method. Backends looking to po...
Get the ISO time string from a timestamp or date obj. Returns current time str if no timestamp is passed
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): ...
Truncates a value to the number of decimals corresponding to the currency
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)
Truncates money amount to the number of decimals corresponding to the currency
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)
Truncates a value to a number of decimals places
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)