Fix for disallowed characters in GATKReportTable

-- Illegal characters are automatically replaced with _
This commit is contained in:
Mark DePristo 2011-08-26 13:24:06 -04:00
parent 0cb1605df0
commit e37a638e09
2 changed files with 8 additions and 9 deletions

View File

@ -92,6 +92,8 @@ import java.util.regex.Pattern;
* @author Khalid Shakir
*/
public class GATKReportTable {
/** REGEX that matches any table with an invalid name */
public final static String INVALID_TABLE_NAME_REGEX = "[^a-zA-Z0-9_\\-\\.]";
private static final GATKReportVersion LATEST_REPORT_VERSION = GATKReportVersion.V0_2;
private String tableName;
private String tableDescription;
@ -111,7 +113,7 @@ public class GATKReportTable {
* @return true if the name is valid, false if otherwise
*/
private boolean isValidName(String name) {
Pattern p = Pattern.compile("[^a-zA-Z0-9_\\-\\.]");
Pattern p = Pattern.compile(INVALID_TABLE_NAME_REGEX);
Matcher m = p.matcher(name);
return !m.find();

View File

@ -51,7 +51,7 @@ trait QJobReport extends Logging {
logger.info("info " + info)
reportFeatures = Map(
"iteration" -> 1,
"analysisName" -> self.analysisName,
"analysisName" -> getReportGroup,
"jobName" -> QJobReport.workAroundSameJobNames(this),
"intermediate" -> self.isIntermediate,
"startTime" -> info.getStartTime.getTime,
@ -59,15 +59,12 @@ trait QJobReport extends Logging {
"formattedStartTime" -> info.getFormattedStartTime,
"formattedDoneTime" -> info.getFormattedDoneTime,
"runtime" -> info.getRuntimeInMs).mapValues((x:Any) => if (x != null) x.toString else "null") ++ reportFeatures
// // handle the special case of iterations
// reportFeatures.get("iteration") match {
// case None => reportFeatures("iteration") = 1
// case _ => ;
// }
// note -- by adding reportFeatures second we override iteration
// (or any other binding) with the user provided value
}
def getReportGroup = analysisName
/** The report Group is the analysis name transform to only contain valid GATKReportTable characters */
def getReportGroup = self.analysisName.replaceAll(GATKReportTable.INVALID_TABLE_NAME_REGEX, "_")
def getReportFeatures = reportFeatures
def getReportFeatureNames: List[String] = getReportFeatures.keys.toList