Browse Source

Remove non-WiP packages

pjc 5 years ago
parent
commit
c7267f62e0

+ 0
- 104
_packages/extension-parser/classes/config.php View File

@@ -1,104 +0,0 @@
1
-<?php
2
-
3
-# Line 222
4
-# Sequencing Formats
5
-#
6
-# https://www.ncbi.nlm.nih.gov/sra/docs/submitformats/
7
-$Containers = [
8
-  'BAM'        => ['bam'],
9
-  'CRAM'       => ['cram'],
10
-  'EMBL'       => ['embl'],
11
-  'FASTA'      => ['fa', 'fasta', 'fsa'],
12
-  'FASTA+QUAL' => ['qual'],
13
-  'CSFASTA'    => ['csfa', 'csfasta', 'csfsa'],
14
-  'FASTQ'      => ['fastq', 'fq', 'sanfastq'],
15
-  'GFF'        => ['gff', 'gff2', 'gff3'],
16
-  'GTF'        => ['gtf'],
17
-  'GenBank'    => ['gb', 'gbk', 'genbank'],
18
-  'HDF5'       => ['bash5', 'baxh5', 'fast5', 'hdf5'],
19
-  'PIR'        => ['pir'],
20
-  'QSeq'       => ['qseq'],
21
-  'SAM'        => ['sam'],
22
-  'SFF'        => ['sff'],
23
-  'SRF'        => ['srf'],
24
-  'SnapGene'   => ['dna', 'seq'],
25
-  'SwissProt'  => ['dat'],
26
-  'VCF'        => ['vcf'],
27
-  'Plain'      => ['csv', 'txt'],
28
-  'Other'      => [],
29
-];
30
-
31
-# Imaging Formats
32
-#
33
-# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3948928/
34
-$ContainersGames = [
35
-  'Analyze'   => ['hdr', 'img'],
36
-  'Interfile' => ['h33'],
37
-  'DICOM'     => ['dcm', 'dicom'],
38
-  'NIfTI'     => ['nii', 'nifti'],
39
-  'MINC'      => ['minc', 'mnc'],
40
-  'JPEG'      => ['jfif', 'jpeg', 'jpg'],
41
-  'JPEG 2000' => ['j2k', 'jp2', 'jpf', 'jpm', 'jpx', 'mj2'],
42
-  'PNG'       => ['png'],
43
-  'TIFF'      => ['tif', 'tiff'],
44
-  'WebP'      => ['webp'],
45
-  'Other'     => [],
46
-];
47
-
48
-# Protein Formats
49
-# DON'T PARSE RAW FILES. TOO MANY COMPETING VENDORS
50
-#
51
-# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3518119/
52
-$ContainersProt = [
53
-  'ABI/Sciex'      => ['t2d', 'wiff'],
54
-  'APML'           => ['apml'],
55
-  'ASF'            => ['asf'],
56
-  'Agilent/Bruker' => ['baf', 'd', 'fid', 'tdf', 'yep'],
57
-  'BlibBuild'      => ['blib'],
58
-  'Bruker/Varian'  => ['sms', 'xms'],
59
-  'Finnigan'       => ['dat', 'ms'],
60
-  'ION-TOF'        => ['ita', 'itm'],
61
-  'JCAMP-DX'       => ['jdx'],
62
-  'MGF'            => ['mgf'],
63
-  'MS2'            => ['ms2'],
64
-  'MSF'            => ['msf'],
65
-  'mzData'         => ['mzdata'],
66
-  'mzML'           => ['mzml'],
67
-  'mzXML'          => ['mzxml'],
68
-  'OMSSA'          => ['omssa', 'omx'],
69
-  'PEFF'           => ['peff'],
70
-  'pepXML'         => ['pepxml'],
71
-  'protXML'        => ['protxml'],
72
-  'Shimadzu'       => ['lcd', 'qgd', 'spc'],
73
-  'Skyline'        => ['sky', 'skyd'],
74
-  'TPP/SPC'        => ['dta'],
75
-  'Tandem'         => ['tandem'],
76
-  'TraML'          => ['traml'],
77
-  'ULVAC-PHI'      => ['tdc'],
78
-  'Plain'          => ['csv', 'txt'],
79
-  'Other'          => [],
80
-];
81
-
82
-# Extra Formats
83
-# DON'T PARSE IMG OR ISO FILES
84
-#
85
-# https://en.wikipedia.org/wiki/Disk_image#File_formats
86
-# https://en.wikipedia.org/wiki/OpenDocument
87
-# https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
88
-# http://dcjtech.info/topic/python-file-extensions/
89
-$ContainersExtra = [
90
-  'Docker'           => ['dockerfile'],
91
-  'Hard Disk'        => ['fvd', 'dmg', 'esd', 'qcow', 'qcow2', 'qcow3', 'smi', 'swm', 'vdi', 'vhd', 'vhdx', 'vmdk', 'wim'],
92
-  'Optical Disc'     => ['bin', 'ccd', 'cso', 'cue', 'daa', 'isz', 'mdf', 'mds', 'mdx', 'nrg', 'uif'],
93
-  'Python'           => ['pxd', 'py', 'py3', 'pyc', 'pyd', 'pyde', 'pyi', 'pyo', 'pyp', 'pyt', 'pyw', 'pywz', 'pyx', 'pyz', 'rpy', 'xpy'],
94
-  'Jupyter Notebook' => ['ipynb'],
95
-  'Ontology'         => ['cgif', 'cl', 'clif', 'csv', 'htm', 'html', 'kif', 'obo', 'owl', 'rdf', 'rdfa', 'rdfs', 'rif', 'tsv', 'xcl', 'xht', 'xhtml', 'xml'],
96
-  'OpenDocument'     => ['odt', 'fodt', 'ods', 'fods', 'odp', 'fodp', 'odg', 'fodg', 'odf'],
97
-  'Word'             => ['doc', 'dot', 'wbk', 'docx', 'docm', 'dotx', 'dotm', 'docb'],
98
-  'Excel'            => ['xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xla', 'xlam', 'xll', 'xlw'],
99
-  'PowerPoint'       => ['ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppam', 'ppsx', 'ppsm', 'sldx', 'sldm'],
100
-  'PDF'              => ['pdf', 'fdf', 'xfdf'],
101
-  'Plain'            => ['csv', 'txt'],
102
-  'Other'            => [],
103
-];
104
-# Line 321

+ 0
- 132
_packages/extension-parser/classes/torrent_form.class.php View File

@@ -1,132 +0,0 @@
1
-<?php
2
-
3
-class TorrentForm
4
-{
5
-    # Line 13
6
-    public $Containers = [];
7
-    public $ContainersGames = [];
8
-    public $ContainersProt = [];
9
-    public $ContainersExtra = [];
10
-    # Line 16
11
-
12
-    public function __construct($Torrent = false, $Error = false, $NewTorrent = true)
13
-    {
14
-        # Line 45
15
-        $this->Containers = $Containers;
16
-        $this->ContainersGames = $ContainersGames;
17
-        $this->ContainersProt = $ContainersProt;
18
-        $this->ContainersExtra = $ContainersExtra;
19
-        # Line 48
20
-?>
21
-
22
-<!-- Line 510 -->
23
-  <!-- Multiple container fields -->
24
-  <tr id="container_tr">
25
-    <td class="label">
26
-      Format
27
-      <strong class="important_text">*</strong>
28
-    </td>
29
-    <td>
30
-      <select id="container" name="container">
31
-        <option value="Autofill">Autofill</option>
32
-        <?php
33
-            foreach ($this->Containers as $Name => $Container) {
34
-                echo "\t\t\t\t\t\t<option value=\"$Name\"";
35
-                if ($Name === ($Torrent['Container'] ?? false)) {
36
-                    echo " selected";
37
-                }
38
-                echo ">$Name</option>\n";
39
-            } ?>
40
-      </select><br />
41
-      Data file format, or detect from file list
42
-    </td>
43
-  </tr>
44
-
45
-  <!-- 2 -->
46
-  <tr id="container_games_tr">
47
-    <td class="label">
48
-      Format
49
-      <strong class="important_text">*</strong>
50
-    </td>
51
-    <td>
52
-      <select id="container" name="container">
53
-        <option value="Autofill">Autofill</option>
54
-        <?php
55
-            foreach ($this->ContainersGames as $Name => $Container) {
56
-                echo "\t\t\t\t\t\t<option value=\"$Name\"";
57
-                if ($Name === ($Torrent['Container'] ?? false)) {
58
-                    echo " selected";
59
-                }
60
-                echo ">$Name</option>\n";
61
-            } ?>
62
-      </select><br />
63
-      Data file format, or detect from file list
64
-    </td>
65
-  </tr>
66
-
67
-  <!-- 3 -->
68
-  <tr id="container_prot_tr">
69
-    <td class="label">
70
-      Format
71
-      <strong class="important_text">*</strong>
72
-    </td>
73
-    <td>
74
-      <select id="container" name="container">
75
-        <option value="Autofill">Autofill</option>
76
-        <?php
77
-            foreach ($this->ContainersProt as $Name => $Container) {
78
-                echo "\t\t\t\t\t\t<option value=\"$Name\"";
79
-                if ($Name === ($Torrent['Container'] ?? false)) {
80
-                    echo " selected";
81
-                }
82
-                echo ">$Name</option>\n";
83
-            } ?>
84
-      </select><br />
85
-      Data file format, or detect from file list
86
-    </td>
87
-  </tr>
88
-
89
-  <!-- 4 -->
90
-  <tr id="container_extra_tr">
91
-    <td class="label">
92
-      Format
93
-      <strong class="important_text">*</strong>
94
-    </td>
95
-    <td>
96
-      <select id="container" name="container">
97
-        <option value="Autofill">Autofill</option>
98
-        <?php
99
-            foreach ($this->ContainersExtra as $Name => $Container) {
100
-                echo "\t\t\t\t\t\t<option value=\"$Name\"";
101
-                if ($Name === ($Torrent['Container'] ?? false)) {
102
-                    echo " selected";
103
-                }
104
-                echo ">$Name</option>\n";
105
-            } ?>
106
-      </select><br />
107
-      Data file format, or detect from file list
108
-    </td>
109
-  </tr>
110
-
111
-  <!-- Compression -->
112
-  <tr id="archive_tr">
113
-    <td class="label">
114
-      Archive
115
-      <strong class="important_text">*</strong>
116
-    </td>
117
-    <td>
118
-      <select id="archive" name="archive">
119
-        <option value="Autofill">Autofill</option>
120
-        <?php
121
-            foreach ($this->Archives as $Name => $Archive) {
122
-                echo "\t\t\t\t\t\t<option value=\"$Name\"";
123
-                if ($Name === ($Torrent['Archive'] ?? false)) {
124
-                    echo " selected";
125
-                }
126
-                echo ">$Name</option>\n";
127
-            } ?>
128
-      </select><br />
129
-      Compression algorithm, or detect from file list
130
-    </td>
131
-  </tr>
132
-<!-- Line 618 -->

+ 0
- 66
_packages/extension-parser/classes/validate.class.php View File

@@ -1,66 +0,0 @@
1
-<?php
2
-
3
-class Validate
4
-{
5
-    # Line 171
6
-    /**
7
-     * Extension Parser
8
-     *
9
-     * Takes an associative array of file types and extension, e.g.,
10
-     * $Archives = [
11
-     *   '7z'     => ['7z'],
12
-     *   'bzip2'  => ['bz2', 'bzip2'],
13
-     *   'gzip'   => ['gz', 'gzip', 'tgz', 'tpz'],
14
-     *   ...
15
-     * ];
16
-     *
17
-     * Then it finds all the extensions in a torrent file list,
18
-     * organizes them by file size, and returns the heaviest match.
19
-     *
20
-     * That way, you can have, e.g., 5 GiB FASTQ sequence data in one file,
21
-     * and 100 other small files, and get the format of the actual data.
22
-     *
23
-     * todo: Incorporate into $this->ValidateForm (remove if statements first)
24
-     */
25
-    public function ParseExtensions($FileList, $Category, $FileTypes)
26
-    {
27
-        # Sort $Tor->file_list() output by size
28
-        $UnNested = array_values($FileList[1]);
29
-        $Sorted = (usort($UnNested, function ($a, $b) {
30
-            return $b <=> $a;
31
-        })) ? $UnNested : null;  # Ternary wrap because ↑ returns true
32
-        
33
-        # Harvest the wheat
34
-        # todo: Entries seem duplicated here
35
-        $Heaviest = array_slice($Sorted, 0, 20);
36
-        $Matches = [];
37
-
38
-        foreach ($Heaviest as $Heaviest) {
39
-            # Collect the last 2 period-separated tokens
40
-            $Extensions = array_slice(explode('.', strtolower($Heaviest[1])), -2, 2);
41
-            $Matches = array_merge($Extensions);
42
-
43
-            # Distill the file format
44
-            $FileTypes = $FileTypes[$Category];
45
-            $FileTypeNames = array_keys($FileTypes);
46
-
47
-            # todo: Find the smallest possible number of iterations
48
-            # todo: Reduce nesting by one level
49
-            foreach ($Matches as $Match) {
50
-                $Match = strtolower($Match);
51
-        
52
-                foreach ($FileTypeNames as $FileTypeName) {
53
-                    $SearchMe = [ $FileTypeName, $FileTypes[$FileTypeName] ];
54
-        
55
-                    if (in_array($Match, $SearchMe[1])) {
56
-                        return $SearchMe[0];
57
-                        break;
58
-                    } else {
59
-                        return 'Other';
60
-                    break;
61
-                    }
62
-                }
63
-            }
64
-        }
65
-    }
66
-    # Line 230

+ 0
- 40
_packages/extension-parser/readme.md View File

@@ -1,40 +0,0 @@
1
-## Detect and autofill file types by extension
2
-
3
-One of the challenges of tracking biology data is the overwhelming number of file formats.
4
-If a user leaves the container or archive dropdown blank, this tool:
5
-  * Adds the file sizes of each extension
6
-  * Sorts the torrent file list by size
7
-  * Returns the first matching extension key
8
-
9
-## In this repo
10
-Please find all the snippets you need to implement a similar feature on your own tracker.
11
-See `classes/config.php` for an idea of how the each format is associated with an array of file extensions.
12
-I'll reproduce an example below so you can see how powerful a general extension parser can be.
13
-
14
-```php
15
-$ContainersExtra = [
16
-  'Docker'           => ['dockerfile'],
17
-  'Hard Disk'        => ['fvd', 'dmg', 'esd', 'qcow', 'qcow2', 'qcow3', 'smi', 'swm', 'vdi', 'vhd', 'vhdx', 'vmdk', 'wim'],
18
-  'Optical Disc'     => ['bin', 'ccd', 'cso', 'cue', 'daa', 'isz', 'mdf', 'mds', 'mdx', 'nrg', 'uif'],
19
-  'Python'           => ['pxd', 'py', 'py3', 'pyc', 'pyd', 'pyde', 'pyi', 'pyo', 'pyp', 'pyt', 'pyw', 'pywz', 'pyx', 'pyz', 'rpy', 'xpy'],
20
-  'Jupyter Notebook' => ['ipynb'],
21
-  'Ontology'         => ['cgif', 'cl', 'clif', 'csv', 'htm', 'html', 'kif', 'obo', 'owl', 'rdf', 'rdfa', 'rdfs', 'rif', 'tsv', 'xcl', 'xht', 'xhtml', 'xml'],
22
-  'OpenDocument'     => ['odt', 'fodt', 'ods', 'fods', 'odp', 'fodp', 'odg', 'fodg', 'odf'],
23
-  'Word'             => ['doc', 'dot', 'wbk', 'docx', 'docm', 'dotx', 'dotm', 'docb'],
24
-  'Excel'            => ['xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xla', 'xlam', 'xll', 'xlw'],
25
-  'PowerPoint'       => ['ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppam', 'ppsx', 'ppsm', 'sldx', 'sldm'],
26
-  'PDF'              => ['pdf', 'fdf', 'xfdf'],
27
-  'Plain'            => ['csv', 'txt'],
28
-  'Other'            => [],
29
-];
30
-```
31
-
32
-## Caveats and todos
33
-Test thoroughly before implementing to ensure the behavior is what you expect!
34
-You don't want to ruin the database with unextected "Autofill" formats.
35
-
36
-For this reason, extension parsing is disabled on the torrent edit handler for now.
37
-The FileList stored in the database, available to the edit form, is a bencoded string instead of a nested array.
38
-$Validate->ParseExtensions currently only works with the $Tor->FileList object before its bencoded.
39
-
40
-That's all for now.

+ 0
- 3
_packages/extension-parser/sections/torrents/edit.php View File

@@ -1,3 +0,0 @@
1
-<?php
2
-
3
-# todo

+ 0
- 23
_packages/extension-parser/sections/torrents/takeedit.php View File

@@ -1,23 +0,0 @@
1
-<?php
2
-
3
-# Line 58
4
-$Properties['Container'] = (isset($_POST['container']) && $_POST['container'] !== '---') ? $_POST['container'] : 'Other';
5
-$Properties['Archive'] = (isset($_POST['archive']) && $_POST['archive'] !== '---') ? $_POST['archive'] : 'None';
6
-# Line 59
7
-
8
-# Line 294
9
-//******************************************************************************//
10
-//--------------- Autofill format and archive ----------------------------------//
11
-
12
-# Load FileList in lieu of $Tor object
13
-# todo: Format the output for  $Validate->ParseExtensions()
14
-#var_dump($T['FileList']);
15
-
16
-# Disable the extension parser for edits
17
-# todo: Make this work with $T['FileList']
18
-if ($T['Container'] === 'Autofill'
19
-|| $T['Archive'] === 'Autofill') {
20
-    $Err = "Extension parsing is only possible for new uploads";
21
-    error($Err);
22
-}
23
-# Line 307

+ 0
- 59
_packages/extension-parser/sections/upload/upload_handle.php View File

@@ -1,59 +0,0 @@
1
-<?php
2
-
3
-# Line 44
4
-# todo: Associate containers with categories beforehand
5
-# It may have to happen structurally in config.php, e.g.,
6
-# $Categories = [
7
-#   'GazelleName' => [$Name, $Icon, $Description, $Containers],
8
-#    ...
9
-#  ];
10
-$Properties['FileTypes'] = [
11
-    'DNA'      => $Containers,
12
-    'RNA'      => $Containers,
13
-    'Proteins' => $ContainersProt,
14
-    'Imaging'  => $ContainersGames,
15
-    'Extras'   => $ContainersExtra
16
-];
17
-$Properties['ArchiveTypes'] = [
18
-    'DNA'      => $Archives,
19
-    'RNA'      => $Archives,
20
-    'Proteins' => $Archives,
21
-    'Imaging'  => $Archives,
22
-    'Extras'   => $Archives
23
-];
24
-# Line 63
25
-
26
-# Line 427
27
-//******************************************************************************//
28
-//--------------- Autofill format and archive ----------------------------------//
29
-
30
-if ($T['Container'] === 'Autofill') {
31
-    # torrents.Container
32
-    $T['Container'] = $Validate->ParseExtensions(
33
-
34
-        # $FileList
35
-        $Tor->file_list(),
36
-
37
-        # $Category
38
-        $T['CategoryName'],
39
-
40
-        # $FileTypes
41
-        $T['FileTypes'],
42
-    );
43
-}
44
-
45
-if ($T['Archive'] === 'Autofill') {
46
-    # torrents.Archive
47
-    $T['Archive'] = $Validate->ParseExtensions(
48
-
49
-        # $FileList
50
-        $Tor->file_list(),
51
-
52
-        # $Category
53
-        $T['CategoryName'],
54
-
55
-        # $FileTypes
56
-        $T['ArchiveTypes'],
57
-    );
58
-}
59
-# Line 458

+ 0
- 83
_packages/extension-parser/static/functions/upload.js View File

@@ -1,83 +0,0 @@
1
-// Line 11
2
-function Categories() {
3
-    let def = [
4
-      'javdb', // Accession Number
5
-      'audio', // Version
6
-      'title', // Torrent Title
7
-      'title_rj', // Organism
8
-      'title_jp', // Strain/Variety
9
-      'idols', // Authors(s)
10
-      'studio', // Department/Lab
11
-      'series', // Location
12
-      'year', // Year
13
-      'codec', // License
14
-      // Platform changes below
15
-      'resolution', // Assembly Level
16
-      // Format changes below
17
-      'archive', // Archive
18
-      'tags', // Tags
19
-      'cover', // Picture
20
-      'mirrors', // Mirrors
21
-      'screenshots', // Publications
22
-      'group_desc', // Torrent Group Description
23
-      'release_desc', // Torrent Description
24
-      'censored', // Aligned/Annotated
25
-      'anon', // Upload Anonymously
26
-    ]
27
-  
28
-    let cats = [
29
-      { // DNA
30
-        'media': {}, // Platform
31
-        'container': {}, // Format
32
-      },
33
-      { // RNA
34
-        'media': {}, // Platform
35
-        'container': {}, // Format
36
-      },
37
-      { // Proteins
38
-        'media': {}, // Platform
39
-        'container_prot': {}, // Format
40
-      },
41
-      { // Imaging
42
-        'media_manga': {}, // Platform
43
-        'container_games': {}, // Format
44
-      },
45
-      { // Extras
46
-        'media': {}, // Platform
47
-        'container_extra': {}, // Format
48
-      }
49
-    ]
50
-  
51
-    let active = {}
52
-    for (let field of def) active[field] = {}
53
-    let category = 0
54
-    if ($('input[name="type"]').raw()) category = $('input[name="type"]').raw().value
55
-    if ($('#categories').raw()) category = $('#categories').raw().value
56
-    active = Object.assign(active, cats[category])
57
-  
58
-    let hide = el => {
59
-      Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = true)
60
-      $(el).ghide()
61
-    }
62
-  
63
-    let show = el => {
64
-      Array.from($(`#${el.id} input, #${el.id} select, #${el.id} textarea`)).forEach(inp => inp.disabled = false)
65
-      $(el).gshow()
66
-    }
67
-  
68
-    let trs = $('#dynamic_form tr')
69
-    for (let tr of trs) {
70
-      let field = tr.id.slice(0, -3)
71
-      if (active[field]) {
72
-        if (active[field].name) {
73
-          tr.children[0].innerHTML = active[field].name
74
-        }
75
-        let notes = $(`#${tr.id} p.notes`).raw()
76
-        if (notes) notes.innerHTML = active[field].notes || ''
77
-        show(tr)
78
-      } else {
79
-        hide(tr)
80
-      }
81
-    }
82
-  }
83
-// Line 91

+ 0
- 1
_packages/formatting-bugs

@@ -1 +0,0 @@
1
-Subproject commit 6139ce97dcb80d59e2e910345c5a72259a86e85b

+ 0
- 1
_packages/tracker-tiers

@@ -1 +0,0 @@
1
-Subproject commit 8461f7a8d59abcddfbfd7611198427423a682829

Loading…
Cancel
Save