[med-svn] [Git][med-team/segemehl][upstream] New upstream version 0.3.4
Andreas Tille
gitlab at salsa.debian.org
Fri Jan 11 21:54:17 GMT 2019
Andreas Tille pushed to branch upstream at Debian Med / segemehl
Commits:
ea4ce368 by Andreas Tille at 2019-01-11T21:52:48Z
New upstream version 0.3.4
- - - - -
9 changed files:
- include/fileio.h
- include/segemehl.h
- include/version.h
- include/version.h.bak
- libs/alignment.c
- libs/fileio.c
- libs/manout.c
- libs/samio.c
- libs/segemehl.c
Changes:
=====================================
include/fileio.h
=====================================
@@ -45,7 +45,7 @@
#include "stringutils.h"
char * bl_getTempFile(char *path, char *tmp);
int bl_UnixSort(void *space, char *filename, const char *fieldstring, const char delim);
-char* readfile(void *, char *, Uint*);
+char* readfile(void *, char *, size_t*);
stringset_t **readcsv(void *, char *, char*, Uint *);
void writeY(char *, double *, Uint, Uint, Uint);
void writeXYUint(char *filename, Uint *X, Uint *Y, Uint len);
=====================================
include/segemehl.h
=====================================
@@ -230,7 +230,7 @@ typedef struct segemehl_s {
*/
merge_t *merge;
char orientation;
-
+ char fullname;
} segemehl_t;
typedef struct checkthread_s {
@@ -387,6 +387,7 @@ se_setdefault(segemehl_t *info) {
info->bamhdr = NULL;
info->head = NULL;
info->orientation = 1;
+ info->fullname = 0;
}
inline static void
=====================================
include/version.h
=====================================
@@ -24,11 +24,11 @@
-#define VERSION "0.3.2"
+#define VERSION "0.3.4"
-#define REVISION "g664b3dd"
+#define REVISION "ge5dee47"
-#define TIME "2018-11-11 17:18:49 +0100"
+#define TIME "2018-12-25 20:39:07 +0100"
=====================================
include/version.h.bak
=====================================
@@ -12,6 +12,6 @@
#define VERSION "v0.3.0"
-#define REVISION "g664b3dd"
-#define TIME "2018-11-11 17:18:49 +0100"
+#define REVISION "ge5dee47"
+#define TIME "2018-12-25 20:39:07 +0100"
=====================================
libs/alignment.c
=====================================
@@ -1252,7 +1252,7 @@ bl_mdGetDiffString(char *MD) {
char*
cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned char rev, char brief) {
- Uint i, j, k, q=0, p=0, cur=0, strsize, steps, msteps;
+ Uint i, j, k, q=0, p=0, cur=0, strsize, steps=0, msteps;
char *cigarstr;
char eopc=0;
@@ -1266,10 +1266,9 @@ cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned
cur+=strsize;
}
- for(k=0; k < al->numofmeops; k++) {
+ for(steps=0, k=0; k < al->numofmeops; k++) {
i = (rev) ? al->numofmeops - k - 1 : k;
- //if Replacement occured
- steps=0;
+ //if Replacement occured
if (al->meops[i].eop == Replacement) {
//iter over all steps
msteps=0;
@@ -1299,7 +1298,7 @@ cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned
msteps++;
}
- steps = msteps;
+ steps += msteps;
//set string ptrs
p+=j;
q+=j;
@@ -1311,7 +1310,8 @@ cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned
else
eopc = '=';
//set ptrs
- steps = al->meops[i].steps;
+ //steps = al->meops[i].steps;
+ steps += al->meops[i].steps;
p+=steps;
q+=steps;
}
@@ -1322,11 +1322,22 @@ cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned
else
eopc = 'X';
//set ptrs
- steps = al->meops[i].steps;
+ //steps = al->meops[i].steps;
+ steps += al->meops[i].steps;
p+=steps;
q+=steps;
}
+ //dump previous matches and mismatches if in brief mode
+ //if a different operation is coming
+ if(brief && steps && eopc == 'M' &&
+ al->meops[i].eop != Match && al->meops[i].eop != Mismatch) {
+
+ strsize = snprintf(NULL, 0, "%d", steps)+1;
+ sprintf(&cigarstr[cur], "%d%c", steps, eopc);
+ cur+=strsize;
+ steps = 0;
+ }
//if deletion occured
if (al->meops[i].eop == Deletion) {
@@ -1355,11 +1366,15 @@ cigarstring(Alignment *al, Uint leftclip, Uint rightclip, char clipch, unsigned
// p+=steps; no moves!
}
-
- //strsize = floor(log(steps)/log(10))+2;
- strsize = snprintf(NULL, 0, "%d", steps)+1;
- sprintf(&cigarstr[cur], "%d%c", steps, eopc);
- cur+=strsize;
+ //dump everything except "M"s in the brief mode
+ //unless we are at the end
+ if(eopc != 'M' || k+1 == al->numofmeops) {
+ //strsize = floor(log(steps)/log(10))+2;
+ strsize = snprintf(NULL, 0, "%d", steps)+1;
+ sprintf(&cigarstr[cur], "%d%c", steps, eopc);
+ cur+=strsize;
+ steps = 0;
+ }
}
if(rightclip || (leftclip && rev)) {
=====================================
libs/fileio.c
=====================================
@@ -524,14 +524,14 @@ bl_freplacestr(char *filename, char *str, Uint len, char stop){
int
bl_fgets(void *space, FILE *fp, char **str) {
char ch, *buffer;
- Uint buffersize = 100;
- Uint len = 0;
+ size_t buffersize = MAXBUFFERSIZE;
+ size_t len = 0;
buffer = ALLOCMEMORY(space, NULL, char, buffersize);
while((ch=getc(fp)) != EOF && ch != '\n') {
if(len == buffersize - 1) {
- buffersize = 2 * buffersize + 1;
+ buffersize += MAXBUFFERSIZE + 1;
buffer = ALLOCMEMORY(space, buffer, char, buffersize);
}
buffer[len++] = (char) ch;
@@ -547,13 +547,13 @@ bl_fgets(void *space, FILE *fp, char **str) {
char*
-readfile(void* space, char* filename, Uint* strlen) {
+readfile(void* space, char* filename, size_t* strlen) {
char ch;
char *buffer;
FILE *fp;
- Uint buffersize = MAXBUFFERSIZE;
- Uint len=0;
+ size_t buffersize = MAXBUFFERSIZE;
+ size_t len=0;
fp = fopen(filename, "r");
if (fp == NULL){
@@ -565,7 +565,7 @@ readfile(void* space, char* filename, Uint* strlen) {
while((ch=getc(fp)) != EOF) {
if(len == buffersize-1) {
- buffersize = 2*buffersize+1;
+ buffersize += MAXBUFFERSIZE+1;
buffer = ALLOCMEMORY(space, buffer, char, buffersize);
}
len++;
@@ -586,7 +586,7 @@ readcsv(void *space,
char *delim,
Uint *linecount) {
- Uint i, contentlen;
+ size_t i, contentlen;
char *content;
stringset_t *lines, **csv;
=====================================
libs/manout.c
=====================================
@@ -347,8 +347,8 @@ se_output(mappingset_t *s, fasta_t * reads, unsigned int k,
char *nextrname = samlist->recs[0].rname;
//should always be > 0, because the alignment exists uniqly
uint64_t nextrpos = samlist->recs[0].pos;
- char nextrc = 0;
- char unmappedmate = 1;
+ char nextrc = samlist->recs[0].flag & 0x10;
+ char unmappedmate = !bl_hasMateMapping(s);
/*
* output to device
*
@@ -370,8 +370,8 @@ se_output(mappingset_t *s, fasta_t * reads, unsigned int k,
char *nextrname = samlist->recs[0].rname;
//should always be > 0, because the alignment exists uniqly
uint64_t nextrpos = samlist->recs[0].pos;
- char nextrc = 0;
- char unmappedmate = 1;
+ char nextrc = samlist->recs[0].flag & 0x10;
+ char unmappedmate = !bl_hasQueryMapping(s);
/*
* output to device
*
@@ -399,11 +399,12 @@ se_output(mappingset_t *s, fasta_t * reads, unsigned int k,
char *nextrname = NULL;
int64_t nextrpos = 0;
char nextrc = 0;
+ char unmappedmate = !bl_hasMateMapping(s);
/*
* output to device
*
*/
- bl_samprintEmptyAlign (desc, seq, qual, hasPaired, 1, 1, nextrname,
+ bl_samprintEmptyAlign (desc, seq, qual, hasPaired, 1, unmappedmate, nextrname,
nextrpos, nextrc, 0, 0, seed, nfo);
}
@@ -421,11 +422,12 @@ se_output(mappingset_t *s, fasta_t * reads, unsigned int k,
char *nextrname = NULL;
int64_t nextrpos = 0;
char nextrc = 0;
+ char unmappedmate = !bl_hasQueryMapping(s);
/*
* output to device
*
*/
- bl_samprintEmptyAlign (desc, seq, qual, hasPaired, 0, 1, nextrname,
+ bl_samprintEmptyAlign (desc, seq, qual, hasPaired, 0, unmappedmate, nextrname,
nextrpos, nextrc, 0, 0, mateseed, nfo);
}
}
=====================================
libs/samio.c
=====================================
@@ -57,7 +57,10 @@
*
*/
-samrec_t* bl_samInitRec(samrec_t *samrec, char *qname) {
+samrec_t* bl_samInitRec(samrec_t *samrec, char *qname, char fullname) {
+
+ char *tmp;
+ Uint len=0;
samrec->qname = NULL;
samrec->flag = 0;
@@ -73,7 +76,15 @@ samrec_t* bl_samInitRec(samrec_t *samrec, char *qname) {
samrec->nooftags = 0;
samrec->tags = NULL;
- samrec->qname = bl_strdup(qname);
+ if(fullname) {
+ tmp = bl_strdup(qname);
+ } else {
+ len = strlen(qname);
+ tmp = strclip(NULL, qname, &len);
+ }
+
+ samrec->qname = tmp;
+
return samrec;
}
@@ -1339,7 +1350,7 @@ bl_samprintEmptyAlign (char *desc, char* seq, char* qual, char hasPaired,
}
- bl_samInitRec(&samlist->recs[0], desc);
+ bl_samInitRec(&samlist->recs[0], desc, nfo->fullname);
if(!hasPaired) {
nomatemapped = 0;
@@ -1426,7 +1437,7 @@ bl_samline2rec(char *line, Uint len, samheader_t *head) {
switch(i+1) {
case 1:
qname = cur;
- rec = bl_samInitRec(rec, qname);
+ rec = bl_samInitRec(rec, qname, 1);
break;
case 2:
flag = atoi(cur);
@@ -1640,7 +1651,7 @@ samlist_t *bl_samgetSamList (fasta_t *reads, Uint id, mapping_t *l,
bl_reconvertBisulfite(seq, strlen(seq), nfo->bisulfite);
}
- bl_samInitRec(&samlist->recs[i], bl_getMapFragQryDesc(&l->f[i]));
+ bl_samInitRec(&samlist->recs[i], bl_getMapFragQryDesc(&l->f[i]), nfo->fullname);
//predict strand
if(nfo->split) {
=====================================
libs/segemehl.c
=====================================
@@ -595,6 +595,10 @@ int main(int argc, char** argv) {
"show alignments", NULL, NULL, &info.align);
manopt(&optset, FLAG, 0, 0, "nohead",
"do not output header", NULL, NULL, &info.nohead);
+
+ manopt(&optset, FLAG, 0, 'f', "fullname",
+ "write full query name (no trunctation at whitespace)", NULL, NULL, &info.fullname);
+
//manopt(&optset, FLAG, 0, 'z', "nosuflinks",
// "dont use suflinks (does not affect index construction, for short reads only, increases runtime!)", NULL, NULL, &info.nosuflinks);
/*
View it on GitLab: https://salsa.debian.org/med-team/segemehl/commit/ea4ce368e9655a4067b35bb94e98dcfa3e3321c0
--
View it on GitLab: https://salsa.debian.org/med-team/segemehl/commit/ea4ce368e9655a4067b35bb94e98dcfa3e3321c0
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/20190111/11d7340d/attachment-0001.html>
More information about the debian-med-commit
mailing list