#!/usr/bin/perl
# ***************************************************************
# Name: collateResults.pl
# Purpose: This script collates the results produced by AMPLICONprocessing and TAXAassign
# Say you have a Main_Folder, where each subfolder contains a CSV file.
# Using -f path_to_Main_Folder -p _PHYLUM.csv, the contents of *_PHYLUM.csv file will be collated together.
#
# BEFORE:
#
# Main_Folder/Folder_1/*_PHYLUM.csv:
#
# species_A,2
# species_B,4
# species_C,5
#
# Main_Folder/Folder_2/*_PHYLUM.csv:
#
# species_A,3
# species_D,5
#
# AFTER:
#
# Samples,Folder_1,Folder_2
# species_A,2,3
# species_B,4,0
# species_C,5,0
# species_D,0,5
#
#
# Version: 0.1
# Authors: Umer Zeeshan Ijaz (Umer.Ijaz@glasgow.ac.uk)
# http://userweb.eng.gla.ac.uk/umer.ijaz/index.htm
# Created: 2013-08-1
# License: Copyright (c) 2013 Computational Microbial Genomics Group, University of Glasgow, UK
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# **************************************************************/
use warnings;
use strict;
use File::Slurp qw(read_dir);
use Getopt::Long;
my %opts; #store the input arguments
GetOptions(\%opts,
'folder|f=s',
'pattern|p=s',
);
if((not defined $opts{"folder"}) || (not defined $opts{"pattern"}))
{
print < -p >