[med-svn] [Git][med-team/plink2][upstream] New upstream version 2.00~a3-210816+dfsg

Dylan Aïssi (@daissi) gitlab at salsa.debian.org
Sat Aug 21 08:51:31 BST 2021



Dylan Aïssi pushed to branch upstream at Debian Med / plink2


Commits:
478fa15a by Dylan Aïssi at 2021-08-21T09:50:23+02:00
New upstream version 2.00~a3-210816+dfsg
- - - - -


8 changed files:

- LICENSE → COPYING
- + COPYING.LESSER
- Python/ReadMe.md
- plink2.cc
- plink2_glm.cc
- plink2_help.cc
- plink2_import.cc
- plink2_misc.cc


Changes:

=====================================
LICENSE → COPYING
=====================================


=====================================
COPYING.LESSER
=====================================
@@ -0,0 +1,165 @@
+                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.


=====================================
Python/ReadMe.md
=====================================
@@ -1,6 +1,23 @@
-This provides a basic Python API for pgenlib; see python_api.txt for details.
+This provides a basic Python API for pgenlib  (See [python_api.txt](python_api.txt) for details.)
+
+
+##### Build this with this.
 Cython and NumPy must be installed.
+```
+python3 setup.py build_ext
+[sudo] python3 setup.py install
+```
+
+
+##### Example usage:
+```
+#write a 2 sample file
+import numpy as np
+import pgenlib as pg
+
+with pg.PgenWriter("test.pgen".encode("utf-8"), 2, 3, False) as writer:
+	writer.append_alleles(np.array([0,1,1,1],dtype=np.int32))
+	writer.append_alleles(np.array([0,1,0,0],dtype=np.int32))
+	writer.append_alleles(np.array([0,0,0,0],dtype=np.int32))
 
-Build this with e.g.
-  python3 setup.py build_ext
-  [sudo] python3 setup.py install
+```


=====================================
plink2.cc
=====================================
@@ -71,10 +71,10 @@ static const char ver_str[] = "PLINK v2.00a3"
 #ifdef USE_MKL
   " Intel"
 #endif
-  " (1 Jul 2021)";
+  " (16 Aug 2021)";
 static const char ver_str2[] =
   // include leading space if day < 10, so character length stays the same
-  " "
+  ""
 #ifndef LAPACK_ILP64
   "  "
 #endif


=====================================
plink2_glm.cc
=====================================
@@ -4957,6 +4957,7 @@ BoolErr AllocAndInitReportedTestNames(const uintptr_t* parameter_subset, const c
     test_name_buf_iter = iter_next;
   }
   uint32_t pred_uidx = 2 + domdev_present;
+  // bugfix (16 Aug 2021): sex + interaction?
   for (uint32_t covar_idx = 0; covar_idx != covar_ct; ++covar_idx, ++pred_uidx) {
     if (parameter_subset && (!IsSet(parameter_subset, pred_uidx))) {
       continue;
@@ -10910,9 +10911,10 @@ static const double kSexMaleToCovarD[2] = {2.0, 1.0};
 void SexInteractionReshuffle(uint32_t first_interaction_pred_uidx, uint32_t raw_covar_ct, uint32_t domdev_present, uint32_t biallelic_raw_predictor_ctl, uintptr_t* __restrict parameters_or_tests, uintptr_t* __restrict parameter_subset_reshuffle_buf) {
   ZeroWArr(biallelic_raw_predictor_ctl, parameter_subset_reshuffle_buf);
   CopyBitarrRange(parameters_or_tests, 0, 0, first_interaction_pred_uidx - 1, parameter_subset_reshuffle_buf);
-  const uint32_t raw_interaction_ct = raw_covar_ct * (domdev_present + 1);
-  CopyBitarrRange(parameters_or_tests, first_interaction_pred_uidx - 1, first_interaction_pred_uidx, raw_interaction_ct, parameter_subset_reshuffle_buf);
-  const uint32_t first_sex_parameter_idx = first_interaction_pred_uidx - 1 + raw_interaction_ct;
+  // bugfix (16 Aug 2021): raw_covar_ct includes sex
+  const uint32_t raw_nonsex_interaction_ct = (raw_covar_ct - 1) * (domdev_present + 1);
+  CopyBitarrRange(parameters_or_tests, first_interaction_pred_uidx - 1, first_interaction_pred_uidx, raw_nonsex_interaction_ct, parameter_subset_reshuffle_buf);
+  const uint32_t first_sex_parameter_idx = first_interaction_pred_uidx - 1 + raw_nonsex_interaction_ct;
   if (IsSet(parameters_or_tests, first_sex_parameter_idx)) {
     SetBit(first_interaction_pred_uidx - 1, parameter_subset_reshuffle_buf);
   }


=====================================
plink2_help.cc
=====================================
@@ -2059,9 +2059,9 @@ PglErr DispHelp(const char* const* argvk, uint32_t param_ct) {
 "      otherwise, column 3 is assumed.  Use 'col-num=' to force a column number.\n"
 "    * Only the first character in the sex column is processed.  By default,\n"
 "      '1'/'M'/'m' is interpreted as male, '2'/'F'/'f' is interpreted as female,\n"
-"      and '0'/'N' is interpreted as unknown-sex.  To change this to '0'/'M'/'m'\n"
-"      = male, '1'/'F'/'f' = female, anything else other than '2' = unknown-sex,\n"
-"      add 'male0'.\n"
+"      and '0'/'N'/'U'/'u' is interpreted as unknown-sex.  To change this to\n"
+"      '0'/'M'/'m' = male, '1'/'F'/'f' = female, anything else other than '2' =\n"
+"      unknown-sex, add 'male0'.\n"
               );
     // don't make --real-ref-alleles apply to e.g. Oxford import, since
     // explicit 'ref-first'/'ref-last' modifiers are clearer


=====================================
plink2_import.cc
=====================================
@@ -2935,7 +2935,7 @@ PglErr VcfToPgen(const char* vcfname, const char* preexisting_psamname, const ch
     }
     if (unlikely((!sample_ct) && (!no_samples_ok))) {
       logerrputs("Error: No samples in --vcf file.  (This is only permitted when you haven't\nspecified another operation which requires genotype or sample information.)\n");
-      goto VcfToPgen_ret_INCONSISTENT_INPUT;
+      goto VcfToPgen_ret_DEGENERATE_DATA;
     }
     vic.vibc.sample_ct = sample_ct;
     // bugfix (5 Jun 2018): must initialize qual_field_ct to zero
@@ -3208,7 +3208,7 @@ PglErr VcfToPgen(const char* vcfname, const char* preexisting_psamname, const ch
       }
     } else if (unlikely(!variant_ct)) {
       logerrputs("Error: No variants in --vcf file.\n");
-      goto VcfToPgen_ret_INCONSISTENT_INPUT;
+      goto VcfToPgen_ret_DEGENERATE_DATA;
     }
 
     putc_unlocked('\r', stdout);
@@ -3875,6 +3875,9 @@ PglErr VcfToPgen(const char* vcfname, const char* preexisting_psamname, const ch
   VcfToPgen_ret_THREAD_CREATE_FAIL:
     reterr = kPglRetThreadCreateFail;
     break;
+  VcfToPgen_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  VcfToPgen_ret_1:
   CleanupSpgw(&spgw, &reterr);
@@ -7352,7 +7355,7 @@ PglErr BcfToPgen(const char* bcfname, const char* preexisting_psamname, const ch
     }
     if (unlikely((!sample_ct) && (!no_samples_ok))) {
       logerrputs("Error: No samples in BCF text header block.  (This is only permitted when you\nhaven't specified another operation which requires genotype or sample\ninformation.)\n");
-      goto BcfToPgen_ret_INCONSISTENT_INPUT;
+      goto BcfToPgen_ret_DEGENERATE_DATA;
     }
     if (unlikely(sample_ct >= (1 << 24))) {
       snprintf(g_logbuf, kLogbufSize, "Error: BCF text header block has %u sample IDs, which is larger than the BCF limit of 2^24 - 1.\n", sample_ct);
@@ -8012,7 +8015,7 @@ PglErr BcfToPgen(const char* bcfname, const char* preexisting_psamname, const ch
       }
     } else if (unlikely(!variant_ct)) {
       logerrputs("Error: No variants in --bcf file.\n");
-      goto BcfToPgen_ret_INCONSISTENT_INPUT;
+      goto BcfToPgen_ret_DEGENERATE_DATA;
     }
 
     const uintptr_t variant_skip_ct = vrec_idx - 1 - variant_ct;
@@ -8983,6 +8986,9 @@ PglErr BcfToPgen(const char* bcfname, const char* preexisting_psamname, const ch
   BcfToPgen_ret_THREAD_CREATE_FAIL:
     reterr = kPglRetThreadCreateFail;
     break;
+  BcfToPgen_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  BcfToPgen_ret_1:
   CleanupSpgw(&spgw, &reterr);
@@ -9387,7 +9393,7 @@ PglErr OxSampleToPsam(const char* samplename, const char* const_fid, const char*
     const uint32_t sample_ct = line_idx - 3;
     if (unlikely(!sample_ct)) {
       logerrputs("Error: No samples in .sample file.\n");
-      goto OxSampleToPsam_ret_INCONSISTENT_INPUT;
+      goto OxSampleToPsam_ret_DEGENERATE_DATA;
     }
     const char* all_ids_iter = all_ids_start;
     uint32_t nz_fid_present = 0;
@@ -9695,6 +9701,9 @@ PglErr OxSampleToPsam(const char* samplename, const char* const_fid, const char*
   OxSampleToPsam_ret_INCONSISTENT_INPUT:
     reterr = kPglRetInconsistentInput;
     break;
+  OxSampleToPsam_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  OxSampleToPsam_ret_1:
   CleanupTextStream2(".sample file", &sample_txs, &reterr);
@@ -9896,7 +9905,7 @@ PglErr OxGenToPgen(const char* genname, const char* samplename, const char* cons
         goto OxGenToPgen_ret_TSTREAM_FAIL;
       }
       logerrputs("Error: Empty .gen file.\n");
-      goto OxGenToPgen_ret_INCONSISTENT_INPUT;
+      goto OxGenToPgen_ret_DEGENERATE_DATA;
     }
     uint32_t is_v2 = 0;
     {
@@ -10327,6 +10336,9 @@ PglErr OxGenToPgen(const char* genname, const char* samplename, const char* cons
   OxGenToPgen_ret_INCONSISTENT_INPUT:
     reterr = kPglRetInconsistentInput;
     break;
+  OxGenToPgen_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  OxGenToPgen_ret_1:
   CleanupSpgw(&spgw, &reterr);
@@ -11820,7 +11832,7 @@ PglErr OxBgenToPgen(const char* bgenname, const char* samplename, const char* co
     const uint32_t raw_variant_ct = initial_uints[2];
     if (unlikely(!raw_variant_ct)) {
       logerrputs("Error: Empty .bgen file.\n");
-      goto OxBgenToPgen_ret_INCONSISTENT_INPUT;
+      goto OxBgenToPgen_ret_DEGENERATE_DATA;
     }
 
     if (unlikely(fseeko(bgenfile, initial_uints[1], SEEK_SET))) {
@@ -13688,6 +13700,9 @@ PglErr OxBgenToPgen(const char* bgenname, const char* samplename, const char* co
   OxBgenToPgen_ret_THREAD_CREATE_FAIL:
     reterr = kPglRetThreadCreateFail;
     break;
+  OxBgenToPgen_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   OxBgenToPgen_ret_bgen13_thread_fail:
     if (reterr == kPglRetMalformedInput) {
     OxBgenToPgen_ret_bgen11_thread_fail:
@@ -14474,7 +14489,7 @@ PglErr LoadMap(const char* mapname, MiscFlags misc_flags, ChrInfo* cip, uint32_t
       if (unlikely(!line_start)) {
         if (!TextStreamErrcode2(&map_txs, &reterr)) {
           logerrputs("Error: Empty .map file.\n");
-          goto LoadMap_ret_INCONSISTENT_INPUT;
+          goto LoadMap_ret_DEGENERATE_DATA;
         }
         goto LoadMap_ret_TSTREAM_FAIL;
       }
@@ -14687,6 +14702,9 @@ PglErr LoadMap(const char* mapname, MiscFlags misc_flags, ChrInfo* cip, uint32_t
   LoadMap_ret_INCONSISTENT_INPUT:
     reterr = kPglRetInconsistentInput;
     break;
+  LoadMap_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  LoadMap_ret_1:
   // ForgetExtraChrNames(1, cip);
@@ -15305,7 +15323,7 @@ PglErr Plink1DosageToPgen(const char* dosagename, const char* famname, const cha
     if (unlikely(!variant_ct)) {
       if (!variant_skip_ct) {
         logerrputs("Error: Empty --import-dosage file.\n");
-        goto Plink1DosageToPgen_ret_INCONSISTENT_INPUT;
+        goto Plink1DosageToPgen_ret_DEGENERATE_DATA;
       }
       logerrprintfww("Error: All %" PRIuPTR " variant%s in --import-dosage file skipped.\n", variant_skip_ct, (variant_skip_ct == 1)? "" : "s");
       goto Plink1DosageToPgen_ret_INCONSISTENT_INPUT;
@@ -15604,6 +15622,9 @@ PglErr Plink1DosageToPgen(const char* dosagename, const char* famname, const cha
   Plink1DosageToPgen_ret_INCONSISTENT_INPUT:
     reterr = kPglRetInconsistentInput;
     break;
+  Plink1DosageToPgen_ret_DEGENERATE_DATA:
+    reterr = kPglRetDegenerateData;
+    break;
   }
  Plink1DosageToPgen_ret_1:
   CleanupSpgw(&spgw, &reterr);


=====================================
plink2_misc.cc
=====================================
@@ -2307,10 +2307,12 @@ PglErr UpdateSampleSexes(const uintptr_t* sample_include, const SampleIdInfo* si
         } else if (ujj == 70) {
           // 'F'/'f'
           sexval = 2;
-        } else if (unlikely((!male0) && (sexval != 30))) {
+        } else if (unlikely((!male0) && (sexval != 30) && (ujj != 85))) {
           // allow 'N' = missing to make 1/2/NA work
+          // allow 'U'/'u' since this is actually being used by Illumina
+          // GenCall and Affymetrix APT
           // don't permit 'n' for now
-          snprintf(g_logbuf, kLogbufSize, "Error: Invalid sex value on line %" PRIuPTR " of --update-sex file. (Acceptable values: 1/M/m = male, 2/F/f = female, 0/N = missing.)\n", line_idx);
+          snprintf(g_logbuf, kLogbufSize, "Error: Invalid sex value on line %" PRIuPTR " of --update-sex file. (Acceptable values: 1/M/m = male, 2/F/f = female, 0/N/U = missing.)\n", line_idx);
           goto UpdateSampleSexes_ret_MALFORMED_INPUT_WW;
         } else {
           // with 'male0', everything else is treated as missing



View it on GitLab: https://salsa.debian.org/med-team/plink2/-/commit/478fa15a9c3f8ddd39b3c7a13256f694a14f8cbe

-- 
View it on GitLab: https://salsa.debian.org/med-team/plink2/-/commit/478fa15a9c3f8ddd39b3c7a13256f694a14f8cbe
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210821/126bf8c7/attachment-0001.htm>


More information about the debian-med-commit mailing list