Support for sample sets in AssignSomaticStatus
-- Also cleaned up SampleUtils.getSamplesFromCommandLine() to return a set, not a list, and trim the sample names.
This commit is contained in:
parent
41ffb25b74
commit
3e93f246f7
|
|
@ -190,11 +190,21 @@ public class SampleUtils {
|
|||
|
||||
}
|
||||
|
||||
public static List<String> getSamplesFromCommandLineInput(Collection<String> sampleArgs) {
|
||||
/**
|
||||
* Returns a new set of samples, containing a final list of samples expanded from sampleArgs
|
||||
*
|
||||
* Each element E of sampleArgs can either be a literal sample name or a file. For each E,
|
||||
* we try to read a file named E from disk, and if possible all lines from that file are expanded
|
||||
* into unique sample names.
|
||||
*
|
||||
* @param sampleArgs
|
||||
* @return
|
||||
*/
|
||||
public static Set<String> getSamplesFromCommandLineInput(Collection<String> sampleArgs) {
|
||||
if (sampleArgs != null) {
|
||||
// Let's first go through the list and see if we were given any files. We'll add every entry in the file to our
|
||||
// sample list set, and treat the entries as if they had been specified on the command line.
|
||||
List<String> samplesFromFiles = new ArrayList<String>();
|
||||
Set<String> samplesFromFiles = new HashSet<String>();
|
||||
for (String SAMPLE_EXPRESSION : sampleArgs) {
|
||||
File sampleFile = new File(SAMPLE_EXPRESSION);
|
||||
|
||||
|
|
@ -203,7 +213,7 @@ public class SampleUtils {
|
|||
|
||||
List<String> lines = reader.readLines();
|
||||
for (String line : lines) {
|
||||
samplesFromFiles.add(line);
|
||||
samplesFromFiles.add(line.trim());
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
samplesFromFiles.add(SAMPLE_EXPRESSION); // not a file, so must be a sample
|
||||
|
|
@ -212,7 +222,8 @@ public class SampleUtils {
|
|||
|
||||
return samplesFromFiles;
|
||||
}
|
||||
return new ArrayList<String>();
|
||||
|
||||
return new HashSet<String>();
|
||||
}
|
||||
|
||||
public static Set<String> getSamplesFromCommandLineInput(Collection<String> vcfSamples, Collection<String> sampleExpressions) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue