[med-svn] [Git][med-team/libucsc][master] Use official htslib in libucsc

Andreas Tille gitlab at salsa.debian.org
Mon Jan 27 07:36:16 GMT 2020



Andreas Tille pushed to branch master at Debian Med / libucsc


Commits:
f6cc218e by Andreas Tille at 2020-01-27T08:35:53+01:00
Use official htslib in libucsc

- - - - -


2 changed files:

- debian/patches/series
- + debian/patches/unbundle-htslib.patch


Changes:

=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 # use_debian_packaged_htslib.patch
+unbundle-htslib.patch


=====================================
debian/patches/unbundle-htslib.patch
=====================================
@@ -0,0 +1,97 @@
+Author: John Marshall <John.W.Marshall at glasgow.ac.uk>
+Last-Update: Fri Jan 24 14:34:54 GMT 2020
+Description: Use official htslib in libucsc
+Origin: https://alioth-lists.debian.net/pipermail/debian-med-packaging/2020-January/077104.html
+
+--- a/src/lib/bamFile.c
++++ b/src/lib/bamFile.c
+@@ -7,10 +7,7 @@
+ #include "portable.h"
+ #include "bamFile.h"
+ #include "htmshell.h"
+-#include "cram/cram_samtools.h"
+-#include "cram/sam_header.h"
+-#include "cram/cram_structs.h"
+-#include "htslib/cram.h"
++#include "htslib/sam.h"
+ #include "udc.h"
+ #include "psl.h"
+ 
+@@ -179,44 +176,6 @@ if (iter == NULL)
+ int result;
+ while ((result = sam_itr_next(samfile, iter, b)) >= 0) 
+     callbackFunc(b, callbackData, header);
+-
+-// if we're reading a CRAM file and the MD5 string has been set
+-// we know there was an error finding the reference and we need
+-// to request that it be loaded.
+-if (samfile->format.format == cram) 
+-    {
+-    char *md5String =  cram_get_Md5(samfile);
+-    if (!isEmpty(md5String))
+-        {
+-        char server[4096];
+-        char pendingFile[4096];
+-        char errorFile[4096];
+-
+-        char *refPath = cram_get_ref_url(samfile);
+-        char *cacheDir = cram_get_cache_dir(samfile);
+-
+-        sprintf(server, refPath, md5String);
+-        sprintf(pendingFile, "%s/pending/",cacheDir);
+-        sprintf(errorFile, "%s/error/%s",cacheDir,md5String);
+-        makeDirsOnPath(pendingFile);
+-        sprintf(pendingFile, "%s/pending/%s",cacheDir,md5String);
+-        FILE *downFile;
+-        if ((downFile = fopen(errorFile, "r")) != NULL)
+-            {
+-            char errorBuf[4096];
+-            mustGetLine(downFile, errorBuf, sizeof errorBuf);
+-            errAbort("cannot find reference %s.  Error: %s\n", md5String,errorBuf);
+-            }
+-        else
+-            {
+-            if ((downFile = fopen(pendingFile, "w")) == NULL)
+-                errAbort("cannot find reference %s.  Cannot create file %s.",md5String, pendingFile);  
+-            fprintf(downFile,  "%s\n", server);
+-            fclose(downFile);
+-            errAbort("Cannot find reference %s.  Downloading from %s. Please refresh screen to check download status.",md5String, server);
+-            }
+-        }
+-    }
+ }
+ 
+ void bamAndIndexFetchPlus(char *fileOrUrl, char *baiFileOrUrl, char *position, bam_fetch_f callbackFunc, void *callbackData,
+@@ -231,12 +190,6 @@ void bamAndIndexFetchPlus(char *fileOrUr
+ {
+ char *bamFileName = NULL;
+ samfile_t *fh = bamOpen(fileOrUrl, &bamFileName);
+-if (fh->format.format == cram) 
+-    {
+-    if (cacheDir == NULL)
+-        errAbort("CRAM cache dir hg.conf variable (cramRef) must exist for CRAM support");
+-    cram_set_cache_url(fh, cacheDir, refUrl);  
+-    }
+ bam_hdr_t *header = sam_hdr_read(fh);
+ if (pSamFile != NULL)
+     *pSamFile = fh;
+@@ -256,16 +209,9 @@ static int bamGetTargetCount(char *fileO
+ {
+ int tCount = 0;
+ htsFile *htsF = hts_open(fileOrUrl, "r");
+-if (htsF->format.format == crai)
+-    {
+-    SAM_hdr *cramHdr = cram_fd_get_header(htsF->fp.cram);
+-    tCount = cramHdr->nref;
+-    }
+-else
+-    {
+-    bam_hdr_t *bamHdr = bam_hdr_read(htsF->fp.bgzf);
+-    tCount = bamHdr->n_targets;
+-    }
++bam_hdr_t *bamHdr = sam_hdr_read(htsF);
++tCount = bamHdr->n_targets;
++bam_hdr_destroy(bamHdr);
+ hts_close(htsF);
+ return tCount;
+ }



View it on GitLab: https://salsa.debian.org/med-team/libucsc/commit/f6cc218e9af7e655959bea16a2c80067f806267e

-- 
View it on GitLab: https://salsa.debian.org/med-team/libucsc/commit/f6cc218e9af7e655959bea16a2c80067f806267e
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/20200127/b7410616/attachment-0001.html>


More information about the debian-med-commit mailing list