Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://doi.org/10.5281/zenodo.14747860
27 January 2025, 11:47:22 UTC
  • Code
  • Branches (0)
  • Releases (1)
  • Visits
    • Branches
    • Releases
      • 1
      • 1
    • 244c21a
    • /
    • plantpollinator-RedYellowMimulus-58e3e17
    • /
    • unknowns2tsv-layout.pl
    Raw File Download

    To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
    Select below a type of object currently browsed in order to display its associated SWHID and permalink.

    • content
    • directory
    • snapshot
    • release
    origin badgecontent badge
    swh:1:cnt:1663ae1de16b37996abff03a6172747f4abd5514
    origin badgedirectory badge
    swh:1:dir:51ea45d2c2f4e266d673273634cfdb7f0ef41b28
    origin badgesnapshot badge
    swh:1:snp:7048fb6efbf07dc1a620fa952e9c40eaff097d6d
    origin badgerelease badge
    swh:1:rel:185dcfd622bee2de06e2003b221d684d5d3fad1a

    This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
    Select below a type of object currently browsed in order to generate citations for them.

    • content
    • directory
    • snapshot
    • release
    (requires biblatex-software package)
    Generating citation ...
    (requires biblatex-software package)
    Generating citation ...
    (requires biblatex-software package)
    Generating citation ...
    (requires biblatex-software package)
    Generating citation ...
    unknowns2tsv-layout.pl
    #!/usr/bin/perl -w
    use strict;
    
    my $infile = $ARGV[0];
    my $outfile = $infile . ".parsed.tsv";
    open(IN,$infile) || die "Could not open $infile for reading: $!\n";
    open(OUT,">$outfile") || die "Could not open $outfile for writing: $!\n";
    print OUT "RT\tArea\tHit1\tHit1CAS\tHit1Formula\tHit1Match\tHit2\tHit2CAS\tHit2Formula\tHit2Match\tHit3\tHit3CAS\tHit3Formula\tHit3Match\n";
    
    my $originalsep = $/;
    undef $/;
    chomp(my $alldata = <IN>);
    $/ = $originalsep;
    
    close(IN);
    my @filelines = split(/\n+/,$alldata);
    
    my $maxlines = scalar(@filelines);
    my $count = 1;
    
    while ($count <= $maxlines+2) {
        my @entry1 = split(/\s\s+/,$filelines[$count]);
        my @entry2 = split(/\s\s+/,$filelines[$count+1]);
        my @entry3 = split(/\s\s+/,$filelines[$count+2]);
        my $RT = $entry1[0];
        my $Area = $entry1[4];
        my $Hit1 = $entry1[1];
        my $Hit1CAS = $entry1[2];
        my $Hit1Formula = $entry1[3];
        my $Hit1Match = $entry1[5];
        if ($entry1[0] == $entry3[0]) {
    	print "There are 3 lines of hits for RT $entry1[0]\n";
    	my $Hit2 = $entry2[1];
    	my $Hit2CAS = $entry2[2];
    	my $Hit2Formula = $entry2[3];
    	my $Hit2Match = $entry2[5];
    	my $Hit3 = $entry3[1];
    	my $Hit3CAS = $entry3[2];
    	my $Hit3Formula = $entry3[3];
    	my $Hit3Match = $entry3[5];
    	print OUT "$RT\t$Area\t$Hit1\t$Hit1CAS\t$Hit1Formula\t$Hit1Match\t$Hit2\t$Hit2CAS\t$Hit2Formula\t$Hit2Match\t$Hit3\t$Hit3CAS\t$Hit3Formula\t$Hit3Match\n";
    	$count=$count+3;
        } elsif ($entry1[0] == $entry2[0]) {
    	print "There are 2 lines of hits for RT $entry1[0]\n";
    	my $Hit2 = $entry2[1];
    	my $Hit2CAS = $entry2[2];
    	my $Hit2Formula = $entry2[3];
    	my $Hit2Match = $entry2[5];
    	my $Hit3 = "NA";
    	my $Hit3CAS = "NA";
    	my $Hit3Formula = "NA";
    	my $Hit3Match = "NA";
    	print OUT "$RT\t$Area\t$Hit1\t$Hit1CAS\t$Hit1Formula\t$Hit1Match\t$Hit2\t$Hit2CAS\t$Hit2Formula\t$Hit2Match\t$Hit3\t$Hit3CAS\t$Hit3Formula\t$Hit3Match\n";
    	$count=$count+2;
        } elsif ($entry1[0] != $entry2[0]) {
    	print "There is only a single hit for RT $entry1[0]\n";
    	my $Hit2 = "NA";
    	my $Hit2CAS = "NA";
    	my $Hit2Formula = "NA";
    	my $Hit2Match = "NA";
    	my $Hit3 = "NA";
    	my $Hit3CAS = "NA";
    	my $Hit3Formula = "NA";
    	my $Hit3Match = "NA";
    	print OUT "$RT\t$Area\t$Hit1\t$Hit1CAS\t$Hit1Formula\t$Hit1Match\t$Hit2\t$Hit2CAS\t$Hit2Formula\t$Hit2Match\t$Hit3\t$Hit3CAS\t$Hit3Formula\t$Hit3Match\n";
    	$count=$count+1;
        } else {
    	print "There's something funky going on with your logic...\n";
        }
    }
    
        
    

    back to top

    Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
    The source code of Software Heritage itself is available on our development forge.
    The source code files archived by Software Heritage are available under their own copyright and licenses.
    Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API