Commit 5d2e6547 authored by Karl Kornel's avatar Karl Kornel
Browse files

nextseq: Only copy sample sheet if one doesn't exist already

If there is already a SampleSheet.csv, then don't copy over it.  Otherwise,
pick from gdrive.
parent 1bb5c1e0
Loading
Loading
Loading
Loading
+48 −49
Original line number Diff line number Diff line
@@ -440,12 +440,18 @@ EOF

	# Find our samplesheet
	dolog("Drive running complete!  Checking for samplesheet.\n");

    # If we have a SampleSheet.csv already, then we're fine
    if (-r "$RUNFOLDER/SampleSheet.csv") {
        dolog("A SampleSheet.csv already exists.  Not copying from gdrive\n");
    } else {
        # Build the list of candidate SampleSheet files.
    	my $samplesheet_search_path = "$DRIVEPATH/$LIBRARYID SampleSheet*.csv";
    	$samplesheet_search_path =~ s{[ ]}{\\\ }g;
    	my @samplesheets = glob $samplesheet_search_path;
    	dolog('Found ' . scalar(@samplesheets) . " candidate(s).\n");

	# Pick exactly which samplesheet to use
        # Pick exactly which samplesheet to use (if any were found).
    	my $samplesheet_path;
	    if (scalar(@samplesheets) == 0) {
		    dolog("No samplesheets found!\n");
@@ -474,14 +480,6 @@ EOF
    	dolog("Using samplesheet at path $samplesheet_path\n");

        # Copy the SampleSheet into place
	if (-r "$RUNFOLDER/SampleSheet.csv") {
		dolog(<<"EOF");
We found an existing SampleSheet.csv.
We are renaming this to SampleSheet.csv.old.
(If that file exists, we'll add another ".old" to that one, and so on, and ....)
EOF
		directory_rename("$RUNFOLDER/SampleSheet.csv");
	}
    	File::Copy::copy($samplesheet_path, "$RUNFOLDER/SampleSheet.csv") or do {
    		dolog(<<"EOF");
We were unable to copy the SampleSheet, because of an error.
@@ -495,6 +493,7 @@ EOF
                          $LOGPATH, \$LOG, $RealBin, $RealScript);
    	};
    	dolog("Samplesheet copied\n");
    }

	# Check to see if we have any Project directories
	my $basecalls_path = "$RUNFOLDER/Data/Intensities/BaseCalls";