Beispiel #1
0
    def __init__(self,illumina_run_dir):
        """Create and populate a new IlluminaRun object

        Arguments:
          illumina_run_dir: path to the top-level directory holding
            the 'raw' sequencing data

        """
        # Top-level directory
        self.run_dir = os.path.abspath(illumina_run_dir)
        # Platform
        self.platform = platforms.get_sequencer_platform(self.run_dir)
        if self.platform is None:
            raise Exception("Can't determine platform for %s" % self.run_dir)
        elif self.platform not in ('illumina-ga2x','hiseq','miseq'):
            raise Exception("%s: not an Illumina sequencer?" % self.run_dir)
        # Basecalls subdirectory
        self.basecalls_dir = os.path.join(self.run_dir,
                                          'Data','Intensities','BaseCalls')
        if os.path.isdir(self.basecalls_dir):
            # Locate sample sheet
            self.sample_sheet_csv = os.path.join(self.basecalls_dir,'SampleSheet.csv')
            if not os.path.isfile(self.sample_sheet_csv):
                self.sample_sheet_csv = None
        else:
            self.basecalls_dir = None
        # RunInfo.xml
        self.runinfo_xml = os.path.join(self.run_dir,'RunInfo.xml')
        if not os.path.isfile(self.runinfo_xml):
            self.runinfo_xml = None
Beispiel #2
0
    def __init__(self, illumina_run_dir):
        """Create and populate a new IlluminaRun object

        Arguments:
          illumina_run_dir: path to the top-level directory holding
            the 'raw' sequencing data

        """
        # Top-level directory
        self.run_dir = os.path.abspath(illumina_run_dir)
        # Platform
        self.platform = platforms.get_sequencer_platform(self.run_dir)
        if self.platform is None:
            raise Exception("Can't determine platform for %s" % self.run_dir)
        elif self.platform not in ('illumina-ga2x', 'hiseq', 'miseq'):
            raise Exception("%s: not an Illumina sequencer?" % self.run_dir)
        # Basecalls subdirectory
        self.basecalls_dir = os.path.join(self.run_dir, 'Data', 'Intensities',
                                          'BaseCalls')
        if os.path.isdir(self.basecalls_dir):
            # Locate sample sheet
            self.sample_sheet_csv = os.path.join(self.basecalls_dir,
                                                 'SampleSheet.csv')
            if not os.path.isfile(self.sample_sheet_csv):
                self.sample_sheet_csv = None
        else:
            self.basecalls_dir = None
        # RunInfo.xml
        self.runinfo_xml = os.path.join(self.run_dir, 'RunInfo.xml')
        if not os.path.isfile(self.runinfo_xml):
            self.runinfo_xml = None
Beispiel #3
0
     '--no-log',
     action='store_true',
     dest="no_log",
     default=False,
     help="write rsync output directly stdout, don't create a log file")
 options, args = p.parse_args()
 if len(args) != 2:
     p.error("input is a source directory and a destination")
 # Locate source directory (and strip any trailing slash)
 data_dir = os.path.abspath(args[0].rstrip(os.sep))
 if not os.path.isdir(data_dir):
     logging.error("%s: doesn't exist or is not a directory" % data_dir)
     sys.exit(1)
 # Determine platform
 if options.platform is None:
     platform = platforms.get_sequencer_platform(data_dir)
     if platform is None:
         logging.error("Can't determine platform: use --platform option?")
         sys.exit(1)
 else:
     platform = options.platform
 # Work out the destination
 if options.year is None:
     year = time.strftime("%Y")
 else:
     year = options.year
 destination = os.path.join(args[1], year, platform)
 # Log file
 if not options.no_log:
     log_file = "rsync.%s.log" % os.path.split(data_dir)[-1]
 else:
              help="mirror the source directory at the destination (update files "
              "that have changed and remove any that have been deleted i.e. "
              "rsync --delete-after)")
 p.add_option('--no-log',action='store_true',dest="no_log",default=False,
              help="write rsync output directly stdout, don't create a log file")
 options,args = p.parse_args()
 if len(args) != 2:
     p.error("input is a source directory and a destination")
 # Locate source directory (and strip any trailing slash)
 data_dir = os.path.abspath(args[0].rstrip(os.sep))
 if not os.path.isdir(data_dir):
     logging.error("%s: doesn't exist or is not a directory" % data_dir)
     sys.exit(1)
 # Determine platform
 if options.platform is None:
     platform = platforms.get_sequencer_platform(data_dir)
     if platform is None:
         logging.error("Can't determine platform: use --platform option?")
         sys.exit(1)
 else:
     platform = options.platform
 # Work out the destination
 if options.year is None:
     year = time.strftime("%Y")
 else:
     year = options.year
 destination = os.path.join(args[1],year,platform)
 # Log file
 if not options.no_log:
     log_file = "rsync.%s.log" % os.path.split(data_dir)[-1]
 else: