public int getNumMappedReads(String path){
        int numReads = 0;
        try {
            TextFile filtSam;
            if (alnFnamePattern.isEmpty())
                filtSam = new TextFile(path.replace(fnamePattern, "accepted_hits.filtered.sam"), false);
            else
                filtSam = new TextFile(path.replace(fnamePattern, alnFnamePattern), false);
            String line ="";
            
            while ( (line = filtSam.readLine()) != null){
                if (! line.startsWith("@")){
                    numReads++;

                }
            }
            filtSam.close();
            //System.out.println("number of mapped reads: " + numReads);
            
        } catch (IOException ex) {
            Logger.getLogger(processreadcounts.ProcessTranscriptCounts.class.getName()).log(Level.SEVERE, null, ex);
        }
        return numReads;
    }