コード例 #1
0
ファイル: SolidData.py プロジェクト: mmoisse/genomics
    def __init__(self, name, parent_sample=None):
        """Create a new SolidLibrary instance.

        Inputs:
          name: name of the library (e.g. AS_07)
          parent_sample: (optional) parent SolidSample object
        """
        # Name
        self.name = str(name)
        # Name-based information
        self.initials = utils.extract_initials(self.name)
        self.prefix = utils.extract_prefix(self.name)
        self.index_as_string = utils.extract_index_as_string(self.name)
        self.index = utils.extract_index(self.name)
        # Barcoding
        self.is_barcoded = False
        # Associated canonical data files
        self.csfasta = None
        self.qual = None
        self.csfasta_f5 = None
        self.qual_f5 = None
        # References to all primary data
        self.primary_data = []
        # Parent sample
        self.parent_sample = parent_sample
コード例 #2
0
    def __init__(self,name,parent_sample=None):
        """Create a new SolidLibrary instance.

        Inputs:
          name: name of the library (e.g. AS_07)
          parent_sample: (optional) parent SolidSample object
        """
        # Name
        self.name = str(name)
        # Name-based information
        self.initials = utils.extract_initials(self.name)
        self.prefix = utils.extract_prefix(self.name)
        self.index_as_string = utils.extract_index_as_string(self.name)
        self.index = utils.extract_index(self.name)
        # Barcoding
        self.is_barcoded = False
        # Associated canonical data files
        self.csfasta = None
        self.qual = None
        self.csfasta_f5 = None
        self.qual_f5 = None
        # References to all primary data
        self.primary_data = []
        # Parent sample
        self.parent_sample = parent_sample
コード例 #3
0
ファイル: IlluminaData.py プロジェクト: fw1121/genomics
    def casava_sample_sheet(self, FCID='FC1', fix_empty_projects=True):
        """Return data as a CASAVA formatted sample sheet

        Create a new CasavaSampleSheet instance populated
        with data from the IEM sample sheet.

        Arguments:
          FCID: set the flow cell ID for the output Casava
            sample sheet (defaults to 'FCID')
          fix_empty_projects: if True then attempt to populate
            blank 'SampleProject' fields with values derived
            from sample names

        Returns:
          CasavaSampleSheet object.

        """
        sample_sheet = CasavaSampleSheet()
        for line in self._data:
            sample_sheet_line = sample_sheet.append()
            # Set the lane
            try:
                lane = line['Lane']
            except KeyError:
                # No lane column (e.g. MiSEQ)
                lane = 1
            # Set the index tag (if any)
            try:
                index_tag = "%s-%s" % (line['index'].strip(),
                                       line['index2'].strip())
            except KeyError:
                # Assume not dual-indexed (no index2)
                try:
                    index_tag = line['index'].strip()
                except KeyError:
                    # No index
                    index_tag = ''
            sample_sheet_line['FCID'] = FCID
            sample_sheet_line['Lane'] = lane
            sample_sheet_line['Index'] = index_tag
            sample_sheet_line['SampleID'] = line['Sample_ID']
            sample_sheet_line['Description'] = line['Description']
            # Deal with project name
            if line['Sample_Project'] == '' and fix_empty_projects:
                # No project name - try to use initials from sample name
                sample_sheet_line['SampleProject'] = \
                   utils.extract_initials(line['Sample_ID'])
            else:
                sample_sheet_line['SampleProject'] = line['Sample_Project']
        return sample_sheet
コード例 #4
0
ファイル: IlluminaData.py プロジェクト: fw1121/genomics
    def casava_sample_sheet(self, FCID="FC1", fix_empty_projects=True):
        """Return data as a CASAVA formatted sample sheet

        Create a new CasavaSampleSheet instance populated
        with data from the IEM sample sheet.

        Arguments:
          FCID: set the flow cell ID for the output Casava
            sample sheet (defaults to 'FCID')
          fix_empty_projects: if True then attempt to populate
            blank 'SampleProject' fields with values derived
            from sample names

        Returns:
          CasavaSampleSheet object.

        """
        sample_sheet = CasavaSampleSheet()
        for line in self._data:
            sample_sheet_line = sample_sheet.append()
            # Set the lane
            try:
                lane = line["Lane"]
            except KeyError:
                # No lane column (e.g. MiSEQ)
                lane = 1
            # Set the index tag (if any)
            try:
                index_tag = "%s-%s" % (line["index"].strip(), line["index2"].strip())
            except KeyError:
                # Assume not dual-indexed (no index2)
                try:
                    index_tag = line["index"].strip()
                except KeyError:
                    # No index
                    index_tag = ""
            sample_sheet_line["FCID"] = FCID
            sample_sheet_line["Lane"] = lane
            sample_sheet_line["Index"] = index_tag
            sample_sheet_line["SampleID"] = line["Sample_ID"]
            sample_sheet_line["Description"] = line["Description"]
            # Deal with project name
            if line["Sample_Project"] == "" and fix_empty_projects:
                # No project name - try to use initials from sample name
                sample_sheet_line["SampleProject"] = utils.extract_initials(line["Sample_ID"])
            else:
                sample_sheet_line["SampleProject"] = line["Sample_Project"]
        return sample_sheet
コード例 #5
0
ファイル: base.py プロジェクト: genomika/biotools
    def casava_samplesheet(self, FCID='FC1', fix_empty_projects=False):
        """Return data as a CASAVA formatted sample sheet
        """
        samplesheet = CasavaSampleSheet()
        for line in self._data:
            #Set the lane
            try:
                lane = line['Lane']
            except KeyError:
                "No lane column"
                lane = 1

            #set the index tag
            try:
                index_tag = '%s-%s' % (line['index'].strip(),
                                       line['index2'].strip())
            except KeyError:
                #Assume no index 2
                try:
                    index_tag = line['index'].strip()
                except KeyError:
                    #No index
                    index_tag = ''

            sample = OrderedDict()
            sample['FCID'] = FCID
            sample['Lane'] = lane
            sample['SampleID'] = line['Sample_ID']
            sample['Index'] = index_tag
            sample['Description'] = line['Description']

            samplesheet.append(sample)

            # Fix project name
            if line['Sample_Project'] == '' and fix_empty_projects:
                # No project name - try to use initials from sample name.
                sample['SampleProject'] =  extract_initials(line['Sample_ID'])
            else:
                sample['SampleProject'] = line['Sample_Project']

        return samplesheet