Here you can find the source of extractFileNameFromBAMLocation(String location)
Parameter | Description |
---|---|
location | file path to bam file. String should end in .bam (case insensitive) |
public static String extractFileNameFromBAMLocation(String location)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . ja v a 2 s.c o m*/ * Converts strings like /data/results/DNA1234049.bam or DNA1234049.bam * to DNA1234049 * @param location file path to bam file. String should end in .bam (case insensitive) * @return */ public static String extractFileNameFromBAMLocation(String location) { String fileName = ""; location = location.toLowerCase(); String[] split = location.split("/"); for (String s : split) { if (s.endsWith(".bam")) { fileName = s.replaceAll(".bam$", ""); } } return fileName; } }