Exemple #1
0
    def get_sample_bams(self):
        """
        Handles ``yaml_config.cuffdiff_options.positional_args.sample_bams: from_conditions``.
        """
        def join_replicate_paths(top_level_conditions, paths):
            # I KNOW this has crappy big O time but the list sizes here are small
            joined_rep_paths = []
            for tlc in top_level_conditions:
                tlc_paths = []
                for path in paths:
                    if tlc in path:
                        tlc_paths.append(path)
                    else:
                        pass
                joined_rep_paths.append(','.join(tlc_paths))
            return joined_rep_paths

        #: .. todo:: support replicate bams as: " samp1_r1.bam,samp1_r2.bam samp2_r1.bam,samp2_r2.bam "
        option = self.prog_yargs.positional_args.sample_bams
        if option == 'from_conditions':
            paths = []
            for condition in self._conditions:
                bam_path = self.get_bam_path(condition)
                paths.append(bam_path)

            # join bam paths that are bio-replicates with commas
            top_level_conditions = [
                '_'.join(path.split('/')[-2].split('_')[:-1]) for path in paths
            ]
            top_level_conditions = uniques(top_level_conditions)
            joined_replicate_paths = join_replicate_paths(
                top_level_conditions, paths)
            return ' '.join(joined_replicate_paths)
        else:
            return option
Exemple #2
0
    def get_sample_bams(self):
        """
        Handles ``yaml_config.cuffdiff_options.positional_args.sample_bams: from_conditions``.
        """

        def join_replicate_paths(top_level_conditions, paths):
            # I KNOW this has crappy big O time but the list sizes here are small
            joined_rep_paths = []
            for tlc in top_level_conditions:
                tlc_paths = []
                for path in paths:
                    if tlc in path:
                        tlc_paths.append(path)
                    else:
                        pass
                joined_rep_paths.append(','.join(tlc_paths))
            return joined_rep_paths

        #: .. todo:: support replicate bams as: " samp1_r1.bam,samp1_r2.bam samp2_r1.bam,samp2_r2.bam "
        option = self.prog_yargs.positional_args.sample_bams
        if option == 'from_conditions':
            paths = []
            for condition in self._conditions:
                bam_path = self.get_bam_path(condition)
                paths.append(bam_path)

            # join bam paths that are bio-replicates with commas
            top_level_conditions = ['_'.join(path.split('/')[-2].split('_')[:-1]) for path in paths]
            top_level_conditions = uniques(top_level_conditions)
            joined_replicate_paths = join_replicate_paths(top_level_conditions, paths)
            return ' '.join(joined_replicate_paths)
        else:
            return option
Exemple #3
0
 def get_labels(self):
     """
     Handles ``yaml_config.cuffdiff_options.labels: from_conditions``.
     """
     option = self.prog_yargs['labels']
     if option == 'from_conditions':
         labels = []
         for condition in self._conditions:
             labels.append(condition['name'])
         labels = uniques(labels)
         return ','.join(labels)
     else:
         return option
Exemple #4
0
 def get_labels(self):
     """
     Handles ``yaml_config.cuffdiff_options.labels: from_conditions``.
     """
     option = self.prog_yargs['labels']
     if option == 'from_conditions':
         labels = []
         for condition in self._conditions:
             labels.append(condition['name'])
         labels = uniques(labels)
         return ','.join(labels)
     else:
         return option