I'm trying to modify an existing perl script: Speciesmatch.pl
The script currently takes CSV files in the following naming convention: 20130730-p12-A1.csv
; i.e. "date, p-number, location.csv"
However, the structure of these files has now changed in that the file names have now been shortened to simply their location (e.g. "A1") followed with a short reference name (e.g. "DOL1").
I've attached 3 example csv data files to this question.
Briefly about the script:
The script (speciesmatch.txt
) should process the CSV files one at a time.
For each csv file, it should look at the mass column (first column) and go through the column of scores.
For each score it should take this value and check this mass score against the scores for each animal species contained in SpeciesId.txt. It should record a running tally to see which animal species has the most number of matches to the mass column
in the CSV file. The results are recorded in a SpeciesID file where the "top 5 species
" are recorded with their number of matches and percentage match.
The script is already set up correctly to do this, although I'm struggling to run it with the altered ".csv" file naming convention (A1-DOL1.csv)
One other modification I'd like to make to this script is to take the top 5
animal species match for a file (say in this case A1)
12 matches 100%
2. Cow 5 matches...
3. Snake 2 matches...
Take the very top match-up (in this case Horse)
I would then like the script to open the A1_DOL1.csv file and then write to the very first row:
"Best match: Dolphin"
This would mean that the "mass/intensity/filename/s
table would need to be shifted down a couple of lines for the "Best match: Dolphin" to be written in to the CSV file.
Sorry to come across as long winded... but I just thought I'd put as much detail into this question as possible, as I found it quite hard to explain what I'm trying to achieve out of this. Hopefully the script will make sense and will have most of the hard work already done.
Any help with this would be very much appreciated.