OSCR

Dynamic effects of microglial NLRP3 on transcriptional alterations post-traumatic brain injury

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

C · 666 lines · 25 KB · MIT

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #include <limits.h>
  6. #include <stdbool.h>
  7. #include <unistd.h>
  8. #include <math.h>
  9. #include <time.h>
  10. #include "utils.h"
  11. #include "stdaln.h"
  12. #define DEF_OL2MERGE_ADAPTER (10)
  13. #define DEF_OL2MERGE_READS (15)
  14. #define DEF_QCUT (13)
  15. #define DEF_MIN_MATCH_ADAPTER (0.87)
  16. #define DEF_MIN_MATCH_READS (0.9)
  17. #define DEF_MIN_READ_LEN (30)
  18. #define DEF_MAX_MISMATCH_ADAPTER (0.02)
  19. #define DEF_MAX_MISMATCH_READS (0.02)
  20. #define DEF_MAX_PRETTY_PRINT (10000)
  21. #define DEF_ADAPTER_SCORE_THRES (26)
  22. #define DEF_READ_SCORE_THRES (-500)
  23. #define DEF_READ_GAP_FRAC_CUTOFF (0.125)
  24. //two revolutions of 4 positions = 5000 reads
  25. #define SPIN_INTERVAL (1250)
  26. //following primer sequences are from:
  27. //http://intron.ccam.uchc.edu/groups/tgcore/wiki/013c0/Solexa_Library_Primer_Sequences.html
  28. //and I validated both with grep, the first gets hits to the forward file only and the second
  29. //gets hits to the reverse file only.
  30. //#define DEF_FORWARD_PRIMER ("AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCG")
  31. //#define DEF_REVERSE_PRIMER ("AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT")
  32. #define DEF_FORWARD_PRIMER ("AGATCGGAAGAGCACACGTC")
  33. #define DEF_REVERSE_PRIMER ("AGATCGGAAGAGCGTCGTGT")
  34. char maximum_quality = MAX_QUAL;
  35. void help ( char *prog_name ) {
  36. fprintf(stderr, "\n\nUsage:\n%s [Required Args] [Options]\n",prog_name );
  37. fprintf(stderr, "NOTE 1: The output is always gziped compressed.\n");
  38. fprintf(stderr, "NOTE 2: If the quality strings in the output contain characters less than ascii 33 on an ascii table (they look like lines from a binary file), try running again with or without the -6 option.\n");
  39. fprintf(stderr, "Required Arguments:\n" );
  40. fprintf(stderr, "\t-f <first read input fastq filename>\n" );
  41. fprintf(stderr, "\t-r <second read input fastq filename>\n" );
  42. fprintf(stderr, "\t-1 <first read output fastq filename>\n" );
  43. fprintf(stderr, "\t-2 <second read output fastq filename>\n" );
  44. fprintf(stderr, "General Arguments (Optional):\n" );
  45. fprintf(stderr, "\t-S Display the spinner?\n" );
  46. fprintf(stderr, "\t-3 <first read discarded fastq filename>\n" );
  47. fprintf(stderr, "\t-4 <second read discarded fastq filename>\n" );
  48. fprintf(stderr, "\t-h Display this help message and exit (also works with no args) \n" );
  49. fprintf(stderr, "\t-6 Input sequence is in phred+64 rather than phred+33 format, the output will still be phred+33 \n" );
  50. fprintf(stderr, "\t-q <Quality score cutoff for mismatches to be counted in overlap; default = %d>\n", DEF_QCUT );
  51. fprintf(stderr, "\t-L <Minimum length of a trimmed or merged read to print it; default = %d>\n", DEF_MIN_READ_LEN );
  52. fprintf(stderr, "Arguments for Adapter/Primer Trimming (Optional):\n" );
  53. fprintf(stderr, "\t-A <forward read primer/adapter sequence to trim as it would appear at the end of a read (recommend about 20bp of this)\n\t\t (should validate by grepping a file); default (genomic non-multiplexed adapter1) = %s>\n", DEF_FORWARD_PRIMER );
  54. fprintf(stderr, "\t-B <reverse read primer/adapter sequence to trim as it would appear at the end of a read (recommend about 20bp of this)\n\t\t (should validate by grepping a file); default (genomic non-multiplexed adapter2) = %s>\n", DEF_REVERSE_PRIMER );
  55. fprintf(stderr, "\t-O <minimum overall base pair overlap with adapter sequence to trim; default = %d>\n", DEF_OL2MERGE_ADAPTER );
  56. fprintf(stderr, "\t-M <maximum fraction of good quality mismatching bases for primer/adapter overlap; default = %f>\n", DEF_MAX_MISMATCH_ADAPTER );
  57. fprintf(stderr, "\t-N <minimum fraction of matching bases for primer/adapter overlap; default = %f>\n", DEF_MIN_MATCH_ADAPTER );
  58. fprintf(stderr, "\t-b <adapter alignment band-width; default = %d>\n", aln_param_nt2nt.band_width );
  59. fprintf(stderr, "\t-Q <adapter alignment gap-open; default = %d>\n", aln_param_nt2nt.gap_open );
  60. fprintf(stderr, "\t-t <adapter alignment gap-extension; default = %d>\n", aln_param_nt2nt.gap_ext );
  61. fprintf(stderr, "\t-e <adapter alignment gap-end; default = %d>\n", aln_param_nt2nt.gap_end );
  62. fprintf(stderr, "\t-Z <adapter alignment minimum local alignment score cutoff [roughly (2*num_hits) - (num_gaps*gap_open) - (num_gaps*gap_close) - (gap_len*gap_extend) - (2*num_mismatches)]; default = %d>\n", DEF_ADAPTER_SCORE_THRES );
  63. fprintf(stderr, "\t-w <read alignment band-width; default = %d>\n", aln_param_rd2rd.band_width );
  64. fprintf(stderr, "\t-W <read alignment gap-open; default = %d>\n", aln_param_rd2rd.gap_open );
  65. fprintf(stderr, "\t-p <read alignment gap-extension; default = %d>\n", aln_param_rd2rd.gap_ext );
  66. fprintf(stderr, "\t-P <read alignment gap-end; default = %d>\n", aln_param_rd2rd.gap_end );
  67. fprintf(stderr, "\t-X <read alignment maximum fraction gap cutoff; default = %f>\n", DEF_READ_GAP_FRAC_CUTOFF );
  68. fprintf(stderr, "\t-z <use mask; N will replace adapters>\n");
  69. fprintf(stderr, "Optional Arguments for Merging:\n" );
  70. fprintf(stderr, "\t-y <maximum quality score in output ((phred 33) default = '%c' )>\n", maximum_quality );
  71. fprintf(stderr, "\t-g <print overhang when adapters are present and stripped (use this if reads are different length)>\n");
  72. fprintf(stderr, "\t-s <perform merging and output the merged reads to this file>\n" );
  73. fprintf(stderr, "\t-E <write pretty alignments to this file for visual Examination>\n" );
  74. fprintf(stderr, "\t-x <max number of pretty alignments to write (if -E provided); default = %d>\n", DEF_MAX_PRETTY_PRINT );
  75. fprintf(stderr, "\t-o <minimum overall base pair overlap to merge two reads; default = %d>\n", DEF_OL2MERGE_READS );
  76. fprintf(stderr, "\t-m <maximum fraction of good quality mismatching bases to overlap reads; default = %f>\n", DEF_MAX_MISMATCH_READS );
  77. fprintf(stderr, "\t-n <minimum fraction of matching bases to overlap reads; default = %f>\n", DEF_MIN_MATCH_READS );
  78. fprintf(stderr, "\n");
  79. exit( 1 );
  80. }
  81. /**
  82. * Have a nice spinner to give you a false sense of hope
  83. */
  84. static void update_spinner(unsigned long long num_reads){
  85. static unsigned short spcount = 0;
  86. if(num_reads == 0){
  87. fprintf(stderr,"Processing reads... |");
  88. fflush(stderr);
  89. }else if (num_reads % SPIN_INTERVAL == 0){
  90. putc('\b',stderr);
  91. putc("/-\\|"[spcount % 4],stderr);
  92. fflush(stderr);
  93. spcount++;
  94. }
  95. }
  96. int main( int argc, char* argv[] ) {
  97. unsigned long long num_pairs;
  98. unsigned long long num_merged;
  99. unsigned long long num_adapter;
  100. unsigned long long num_discarded;
  101. unsigned long long num_too_ambiguous_to_merge;
  102. unsigned long long max_pretty_print = DEF_MAX_PRETTY_PRINT;
  103. unsigned long long num_pretty_print = 0;
  104. int adapter_thresh = DEF_ADAPTER_SCORE_THRES;
  105. int read_thresh = DEF_READ_SCORE_THRES;
  106. clock_t start, end;
  107. //init to 0
  108. num_pairs = num_merged = num_adapter = num_discarded = num_too_ambiguous_to_merge = 0;
  109. extern char* optarg;
  110. bool p64 = false;
  111. char forward_fn[MAX_FN_LEN];
  112. char reverse_fn[MAX_FN_LEN];
  113. char forward_out_fn[MAX_FN_LEN];
  114. char reverse_out_fn[MAX_FN_LEN];
  115. char forward_discard_fn[MAX_FN_LEN];
  116. char reverse_discard_fn[MAX_FN_LEN];
  117. char merged_out_fn[MAX_FN_LEN];
  118. bool do_read_merging = false;
  119. bool print_overhang = false;
  120. bool write_discard=false;
  121. bool use_mask=false;
  122. char forward_primer[MAX_SEQ_LEN+1];
  123. strcpy(forward_primer, DEF_FORWARD_PRIMER); //set default
  124. char forward_primer_dummy_qual[MAX_SEQ_LEN+1];
  125. char reverse_primer[MAX_SEQ_LEN+1];
  126. strcpy(reverse_primer, DEF_REVERSE_PRIMER); //set default
  127. char reverse_primer_dummy_qual[MAX_SEQ_LEN+1];
  128. int i;
  129. for(i=0;i<MAX_SEQ_LEN+1;i++){
  130. forward_primer_dummy_qual[i] = 'N';//phred score of 45
  131. reverse_primer_dummy_qual[i] = 'N';
  132. }
  133. int ich;
  134. int min_ol_adapter = DEF_OL2MERGE_ADAPTER;
  135. int min_ol_reads = DEF_OL2MERGE_READS;
  136. unsigned short int min_read_len =DEF_MIN_READ_LEN;
  137. float min_match_adapter_frac = DEF_MIN_MATCH_ADAPTER;
  138. float min_match_reads_frac = DEF_MIN_MATCH_READS;
  139. float max_mismatch_adapter_frac = DEF_MAX_MISMATCH_ADAPTER;
  140. float max_mismatch_reads_frac = DEF_MAX_MISMATCH_READS;
  141. float read_frac_thresh = DEF_READ_GAP_FRAC_CUTOFF;
  142. unsigned short max_mismatch_adapter[MAX_SEQ_LEN+1];
  143. unsigned short max_mismatch_reads[MAX_SEQ_LEN+1];
  144. unsigned short min_match_adapter[MAX_SEQ_LEN+1];
  145. unsigned short min_match_reads[MAX_SEQ_LEN+1];
  146. char qcut = (char)DEF_QCUT+33;
  147. bool pretty_print = false;
  148. bool display_spinner = false;
  149. char pretty_print_fn[MAX_FN_LEN+1];
  150. SQP sqp = SQP_init();
  151. char untrim_fseq[MAX_SEQ_LEN+1];
  152. char untrim_fqual[MAX_SEQ_LEN+1];
  153. char untrim_rseq[MAX_SEQ_LEN+1];
  154. char untrim_rqual[MAX_SEQ_LEN+1];
  155. /* No args - help! */
  156. if ( argc == 1 ) {
  157. help(argv[0]);
  158. }
  159. int req_args = 0;
  160. while( (ich=getopt( argc, argv, "f:r:1:2:3:4:q:A:s:y:B:O:E:x:M:N:L:o:m:b:w:W:p:P:X:Q:t:e:Z:n:S6ghz" )) != -1 ) {
  161. switch( ich ) {
  162. //REQUIRED ARGUMENTS
  163. case 'f' :
  164. req_args ++;
  165. strcpy( forward_fn, optarg );
  166. break;
  167. case 'r' :
  168. req_args ++;
  169. strcpy( reverse_fn, optarg );
  170. break;
  171. case '1' :
  172. req_args ++;
  173. strcpy(forward_out_fn, optarg);
  174. break;
  175. case '2' :
  176. req_args ++;
  177. strcpy(reverse_out_fn, optarg);
  178. break;
  179. //OPTIONAL GENERAL ARGUMENTS
  180. case 'S':
  181. display_spinner = true;
  182. break;
  183. case '3' :
  184. write_discard=true;
  185. strcpy(forward_discard_fn, optarg);
  186. break;
  187. case '4' :
  188. write_discard=true;
  189. strcpy(reverse_discard_fn, optarg);
  190. break;
  191. case 'h' :
  192. help(argv[0]);
  193. break;
  194. case '6' :
  195. p64 = true;
  196. break;
  197. case 'q' :
  198. qcut = atoi(optarg)+33;
  199. break;
  200. case 'L' :
  201. min_read_len = atoi(optarg);
  202. break;
  203. //OPTIONAL ADAPTER/PRIMER TRIMMING ARGUMENTS
  204. case 'A':
  205. strcpy(forward_primer, optarg);
  206. break;
  207. case 'B':
  208. strcpy(reverse_primer, optarg);
  209. break;
  210. case 'O':
  211. min_ol_adapter = atoi(optarg);
  212. break;
  213. case 'M':
  214. max_mismatch_adapter_frac = atof(optarg);
  215. break;
  216. case 'N':
  217. min_match_adapter_frac = atof(optarg);
  218. break;
  219. case 'b':
  220. aln_param_nt2nt.band_width = atoi(optarg);
  221. break;
  222. case 'Q':
  223. aln_param_nt2nt.gap_open = atoi(optarg);
  224. break;
  225. case 't':
  226. aln_param_nt2nt.gap_ext = atoi(optarg);
  227. break;
  228. case 'e':
  229. aln_param_nt2nt.gap_end = atoi(optarg);
  230. break;
  231. case 'Z':
  232. adapter_thresh = atoi(optarg);
  233. break;
  234. case 'w':
  235. aln_param_rd2rd.band_width = atoi(optarg);
  236. break;
  237. case 'W':
  238. aln_param_rd2rd.gap_open = atoi(optarg);
  239. break;
  240. case 'p':
  241. aln_param_rd2rd.gap_ext = atoi(optarg);
  242. break;
  243. case 'P':
  244. aln_param_rd2rd.gap_end = atoi(optarg);
  245. break;
  246. case 'X':
  247. read_frac_thresh = atof(optarg);
  248. break;
  249. case 'z':
  250. use_mask = true;
  251. break;
  252. //OPTIONAL MERGING ARGUMENTS
  253. case 'y' :
  254. maximum_quality = optarg[0];
  255. break;
  256. case 'g' :
  257. print_overhang = true;
  258. break;
  259. case 's' :
  260. do_read_merging = true;
  261. strcpy( merged_out_fn, optarg );
  262. break;
  263. case 'o':
  264. min_ol_reads = atoi(optarg);
  265. break;
  266. case 'm':
  267. max_mismatch_reads_frac = atof(optarg);
  268. break;
  269. case 'n':
  270. min_match_reads_frac = atof(optarg);
  271. break;
  272. case 'E':
  273. pretty_print = true;
  274. strcpy(pretty_print_fn,optarg);
  275. break;
  276. case 'x':
  277. max_pretty_print = atol(optarg);
  278. break;
  279. default :
  280. help(argv[0]);
  281. }
  282. }
  283. if(req_args < 4){
  284. fprintf(stderr, "Missing a required argument!\n");
  285. help(argv[0]);
  286. }
  287. start = clock();
  288. //allocate alignment memory
  289. // int min_match = 8;
  290. // int ngaps = 1;
  291. // int maxglen = 3;
  292. // AlnParam aln_param_adapter = { 5, 13, 19, aln_sm_read, 16, 75 };
  293. //
  294. //Calculate table matching overlap length to min matches and max mismatches
  295. for(i=0;i<MAX_SEQ_LEN+1;i++){
  296. max_mismatch_reads[i] = floor(((float)i)*max_mismatch_reads_frac);
  297. max_mismatch_adapter[i] = floor(((float)i)*max_mismatch_adapter_frac);
  298. min_match_reads[i] = ceil(((float)i)*min_match_reads_frac);
  299. min_match_adapter[i] = ceil(((float)i)*min_match_adapter_frac);
  300. }
  301. //get length of forward and reverse primers
  302. int forward_primer_len = strlen(forward_primer);
  303. int reverse_primer_len = strlen(reverse_primer);
  304. gzFile ffq = fileOpen(forward_fn, "r");
  305. gzFile ffqw = fileOpen(forward_out_fn,"w");
  306. gzFile rfq = fileOpen(reverse_fn, "r");
  307. gzFile rfqw = fileOpen(reverse_out_fn,"w");
  308. gzFile mfqw = NULL;
  309. gzFile ppaw = NULL;
  310. gzFile dffqw = NULL;
  311. gzFile drfqw = NULL;
  312. if(do_read_merging)
  313. mfqw = fileOpen(merged_out_fn,"w");
  314. if(pretty_print)
  315. ppaw = fileOpen(pretty_print_fn,"w");
  316. if(write_discard){
  317. dffqw = fileOpen(forward_discard_fn,"w");
  318. drfqw = fileOpen(reverse_discard_fn,"w");
  319. }
  320. /**
  321. * Loop over all of the reads
  322. */
  323. while(next_fastqs( ffq, rfq, sqp, p64 )){ //returns false when done
  324. if(display_spinner)
  325. update_spinner(num_pairs++);
  326. AlnAln *faaln, *raaln, *fraln;
  327. //save a copy of the original sequences/qualities first
  328. strcpy(untrim_fseq,sqp->fseq);
  329. strcpy(untrim_fqual,sqp->fqual);
  330. strcpy(untrim_rseq,sqp->rseq);
  331. strcpy(untrim_rqual,sqp->rqual);
  332. //save original length
  333. int untrim_flen=sqp->flen;
  334. int untrim_rlen=sqp->rlen;
  335. faaln = aln_stdaln_aux(sqp->fseq, forward_primer, &aln_param_nt2nt,
  336. ALN_TYPE_LOCAL, adapter_thresh , sqp->flen, forward_primer_len);
  337. raaln = aln_stdaln_aux(sqp->rseq, reverse_primer, &aln_param_nt2nt,
  338. ALN_TYPE_LOCAL, adapter_thresh, sqp->rlen, reverse_primer_len);
  339. //check for direct adapter match.
  340. if(adapter_trim(sqp, min_ol_adapter,
  341. forward_primer, forward_primer_dummy_qual,
  342. forward_primer_len,
  343. reverse_primer, reverse_primer_dummy_qual,
  344. reverse_primer_len,
  345. min_match_adapter,
  346. max_mismatch_adapter,
  347. min_match_reads,
  348. max_mismatch_reads,
  349. qcut, use_mask) ||
  350. faaln->score >= adapter_thresh ||
  351. raaln->score >= adapter_thresh){
  352. num_adapter++; //adapter present
  353. //print it if user wants
  354. if(pretty_print && num_pretty_print < max_pretty_print){
  355. //void pretty_print_alignment_stdaln(gzFile out, SQP sqp, AlnAln *aln, bool first_adapter, bool second_adapter)
  356. if(faaln->score >= adapter_thresh){
  357. num_pretty_print++;
  358. pretty_print_alignment_stdaln(ppaw,sqp,faaln,true,false,false);
  359. }
  360. if(raaln->score >= adapter_thresh){
  361. num_pretty_print++;
  362. pretty_print_alignment_stdaln(ppaw,sqp,raaln,false,true,false);
  363. }
  364. }
  365. //do stuff to it
  366. //assume full length adapter and squish it down to the read with no gaps
  367. int rpos,fpos;
  368. rpos = fpos = (- MAX_SEQ_LEN);
  369. if(faaln->score >= adapter_thresh){
  370. fpos = max(faaln->start1 - faaln->start2,0);
  371. }
  372. if(raaln->score >= adapter_thresh){
  373. rpos = max(raaln->start1 - raaln->start2,0);
  374. }
  375. //make rlen the minimum of the two adapter search methods
  376. if(rpos >= 0){
  377. sqp->rlen = min(sqp->rlen,rpos);
  378. }
  379. //make flen the minimum of the two adapter search methods
  380. if(fpos >= 0){
  381. sqp->flen = min(sqp->flen,fpos);
  382. }
  383. if(sqp->flen < min_read_len || sqp->rlen < min_read_len){
  384. num_discarded++;
  385. if(write_discard){
  386. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  387. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  388. }
  389. goto CLEAN_ADAPTERS;
  390. }else{ //trim the adapters
  391. if(use_mask){ // Use base mask - do not trim
  392. int mask_iter;
  393. int sz_sqp = sizeof(sqp->fseq);
  394. if (sqp->flen < untrim_flen){
  395. for(mask_iter = sqp->flen ; mask_iter < sz_sqp && (sqp->fseq[mask_iter] != '\0'); mask_iter++){
  396. sqp->fseq[mask_iter]='N';
  397. }
  398. sqp->flen=mask_iter;
  399. }
  400. if (sqp->rlen < untrim_rlen){
  401. sz_sqp = sizeof(sqp->rseq);
  402. for(mask_iter = sqp->rlen ; mask_iter < sz_sqp && (sqp->rseq[mask_iter] != '\0'); mask_iter++){
  403. sqp->rseq[mask_iter]='N';
  404. }
  405. sqp->rlen=mask_iter;
  406. }
  407. }
  408. else{
  409. sqp->fseq[sqp->flen] = '\0';
  410. sqp->fqual[sqp->flen] = '\0';
  411. sqp->rseq[sqp->rlen] = '\0';
  412. sqp->rqual[sqp->rlen] = '\0';
  413. }
  414. strncpy(sqp->rc_rseq,sqp->rseq,sqp->rlen+1); //move regular reads now trimmed into RC read's place
  415. strncpy(sqp->rc_rqual,sqp->rqual,sqp->rlen+1);
  416. rev_qual(sqp->rc_rqual, sqp->rlen); //amd re-reverse the RC reads
  417. revcom_seq(sqp->rc_rseq, sqp->rlen);
  418. }
  419. //do a nice global alignment between two reads, and print consensus
  420. if(use_mask){
  421. // remove N's for alignment
  422. int tmp_flen=sizeof(sqp->fseq);
  423. int tmp_rclen=sizeof(sqp->rc_rseq);
  424. int tmp_len=max(tmp_flen, tmp_rclen);
  425. char fseq[tmp_flen];
  426. char rcseq[tmp_rclen];
  427. int fNct=0;
  428. int rcNct=0;
  429. int k=0;
  430. int j=0;
  431. int i;
  432. for(i=0;i<tmp_len;i++){
  433. if(i<tmp_flen && (sqp->fseq[i] != 'N')){
  434. fseq[k++]=sqp->fseq[i];
  435. }
  436. else{
  437. fNct++;
  438. }
  439. if(i<tmp_rclen && (sqp->rc_rseq[i] != 'N')){
  440. rcseq[j++]=sqp->rc_rseq[i];
  441. }
  442. else{
  443. rcNct++;
  444. }
  445. }
  446. fraln = aln_stdaln_aux(fseq, rcseq, &aln_param_rd2rd,
  447. ALN_TYPE_GLOBAL, 1, tmp_flen-fNct, tmp_rclen - rcNct );
  448. }else{
  449. fraln = aln_stdaln_aux(sqp->fseq, sqp->rc_rseq, &aln_param_rd2rd,
  450. ALN_TYPE_GLOBAL, 1, sqp->flen, sqp->rlen);
  451. }
  452. //calculate the minimum score we are willing to accept to merge the reads
  453. //basically this is saying that 7/8 of the read must overlap perfectly
  454. read_thresh = (((int)sqp->flen) + ((int)sqp->rlen)) -
  455. (((int)sqp->flen) * read_frac_thresh * aln_param_rd2rd.gap_ext) -
  456. (((int)sqp->rlen) * read_frac_thresh * aln_param_rd2rd.gap_ext) -
  457. (aln_param_rd2rd.gap_open*2) - (aln_param_rd2rd.gap_end*2);
  458. //now lets put something useful in the alignment suboptimal score thing since right now it
  459. //is just left blank:
  460. //fprintf(stderr, "rt:%d\tfl:%d\trl:%d\trft:%f\tgx:%d\tgo:%d\tge%d\n", read_thresh,((int)sqp->flen),((int)sqp->rlen),read_frac_thresh,aln_param_rd2rd.gap_ext,aln_param_rd2rd.gap_open,aln_param_rd2rd.gap_end);
  461. fraln->subo = read_thresh;
  462. if(do_read_merging && fraln->score > read_thresh){
  463. //if we want read merging,
  464. //and the alignment score is better than the threshold just calculated...
  465. //write the merged sequence
  466. fill_merged_sequence(sqp, fraln, true);
  467. if(pretty_print && num_pretty_print < max_pretty_print){
  468. num_pretty_print++;
  469. pretty_print_alignment_stdaln(ppaw,sqp,fraln,false,false,true);
  470. }
  471. if(strlen(sqp->merged_seq) >= min_read_len && strlen(sqp->merged_qual) >= min_read_len){
  472. num_merged++;
  473. write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
  474. }
  475. else{
  476. num_discarded++;
  477. if(write_discard){
  478. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  479. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  480. }
  481. }
  482. }else if(fraln->score > read_thresh){
  483. // we know that the adapters are present, trimmed, and the resulting
  484. // read lengths are both long enough to print.
  485. // We also know that we aren't doing merging.
  486. // Now we just need to print.
  487. if(pretty_print && num_pretty_print < max_pretty_print){
  488. num_pretty_print++;
  489. pretty_print_alignment_stdaln(ppaw,sqp,fraln,false,false,true);
  490. }
  491. //do end polishing to take care of examples like the following:
  492. // Read Alignment Score:59, Suboptimal Score:-85
  493. // ID:HWI-ST593:1:1101:14566:7002#ACA/1
  494. // READ1: ------------ATACAACTCGCTGACTTTGTCCTGGCATTTGACATATGCCTCGTAGTCTGCAAAGACTTTAAACCGGTCATGGTGGAACAGCATGTTGA
  495. // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  496. // READ2: CTCTTCCGATCTATACAACTCGCTGACTTTGTCCTGGCATTTGACATATGCCTCGTAGTCTGCAAAGACTTTAAACCGGTCATGGTGGAACAGCATGTTG-
  497. if(!use_mask)
  498. make_blunt_ends(sqp,fraln);
  499. if(strlen(sqp->fseq) >= min_read_len &&
  500. strlen(sqp->fqual) >= min_read_len &&
  501. strlen(sqp->rseq) >= min_read_len &&
  502. strlen(sqp->rqual) >= min_read_len){
  503. write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
  504. write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
  505. }else{
  506. num_discarded++;
  507. if(write_discard){
  508. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  509. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  510. }
  511. }
  512. }else{ //there was a bad looking read-read alignment, so lets not risk it and junk it
  513. num_discarded++;
  514. if(write_discard){
  515. //write_fastq(dffqw, sqp->fid, sqp->fseq, sqp->fqual);
  516. //write_fastq(drfqw, sqp->rid, sqp->rseq, sqp->rqual);
  517. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  518. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  519. }
  520. }
  521. }else{
  522. //no adapters present
  523. //check for strong read overlap to assist trimming ends of adapters from end of read
  524. if(do_read_merging){
  525. if(read_merge(sqp, min_ol_reads, min_match_reads, max_mismatch_reads, qcut)){
  526. //print merged output
  527. if(strlen(sqp->merged_seq) >= min_read_len &&
  528. strlen(sqp->merged_qual) >= min_read_len){
  529. num_merged++;
  530. write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
  531. if(pretty_print && num_pretty_print < max_pretty_print){
  532. num_pretty_print++;
  533. pretty_print_alignment(ppaw,sqp,qcut,false); //false b/c merged input in fixed order
  534. }
  535. }else{
  536. num_discarded++;
  537. if(write_discard){
  538. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  539. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  540. }
  541. }
  542. }else{
  543. //no significant overlap so just write them
  544. if(strlen(sqp->fseq) >= min_read_len &&
  545. strlen(sqp->fqual) >= min_read_len &&
  546. strlen(sqp->rseq) >= min_read_len &&
  547. strlen(sqp->rqual) >= min_read_len){
  548. write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
  549. write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
  550. }else{
  551. num_discarded++;
  552. if(write_discard){
  553. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  554. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  555. }
  556. }
  557. }
  558. //done
  559. goto CLEAN_ADAPTERS;
  560. }else{ //just write reads to output fastqs
  561. if(strlen(sqp->fseq) >= min_read_len &&
  562. strlen(sqp->fqual) >= min_read_len &&
  563. strlen(sqp->rseq) >= min_read_len &&
  564. strlen(sqp->rqual) >= min_read_len){
  565. write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
  566. write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
  567. }else{
  568. num_discarded++;
  569. if(write_discard){
  570. write_fastq(dffqw, sqp->fid, untrim_fseq, untrim_fqual);
  571. write_fastq(drfqw, sqp->rid, untrim_rseq, untrim_rqual);
  572. }
  573. }
  574. goto CLEAN_ADAPTERS;
  575. }
  576. }
  577. /**
  578. * Section for heirarchial cleanup
  579. *
  580. * In every case we will at least have to free up the alignment between the adapter and two reads.
  581. * however in some cases there will be an additional alignment between the two reads. We can do
  582. * good cleanup in this case with gotos
  583. */
  584. aln_free_AlnAln(fraln);
  585. CLEAN_ADAPTERS:
  586. aln_free_AlnAln(faaln);
  587. aln_free_AlnAln(raaln);
  588. //End the loop over reads
  589. }
  590. end = clock();
  591. double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
  592. fprintf(stderr,"\nPairs Processed:\t%lld\n",num_pairs);
  593. fprintf(stderr,"Pairs Merged:\t%lld\n",num_merged);
  594. fprintf(stderr,"Pairs With Adapters:\t%lld\n",num_adapter);
  595. fprintf(stderr,"Pairs Discarded:\t%lld\n",num_discarded);
  596. fprintf(stderr,"CPU Time Used (Minutes):\t%lf\n",cpu_time_used/60.0);
  597. SQP_destroy(sqp);
  598. gzclose(ffq);
  599. gzclose(ffqw);
  600. gzclose(rfq);
  601. gzclose(rfqw);
  602. if(mfqw != NULL)
  603. gzclose(mfqw);
  604. if(ppaw != NULL)
  605. gzclose(ppaw);
  606. if(dffqw != NULL)
  607. gzclose(dffqw);
  608. if(drfqw != NULL)
  609. gzclose(drfqw);
  610. return 0;
  611. }

SeqPrep.c at commit 575507b, under MIT · at the source

Overview

Authors: Ruo-Bing Gao1,2, Chang-Hong Li2,3, Nan Yang2, Xing Chen2, Bo Wang2, Dan Xu4, Gan Luo1, Zi-Jian Yan2, Ya-Lei Ning2, Hao Du2,5, Yong-Gang Liu1
  1. Laboratory of Stem Cell and Tissue Engineering, Chongqing Medical University, Chongqing, China
  2. The Molecular Biology Center, State Key Laboratory of Trauma and Chemical Poisoning, Department of Army Occupational Disease, Da-ping Hospital, Army Medical University (Third Military Medical University), Chongqing, China
  3. Department of Anatomy, Anhui Medical University, Hefei, Anhui, China
  4. Department of Neurosurgery, The First Affiliated Hospital of Chongqing Medical University, Chongqing, China
  5. Department of Urology, General Hospital of Xizang Military Command, Lhasa, China
Journal: Frontiers in neuroscience, volume 20, article 1951885
Dates: received 29 July 2026; accepted 10 September 2026; published online 23 September 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI · PMCID PMC13642320
Status: code verified (how the code is found and verified)
Categories: genetics / omics (modality), traumatic brain injury (population), cellular / molecular (subfield)
Methods: Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing
Keywords: CNS, microglia, NLRP3, transcriptome, traumatic brain injury
Citations: not cited yet (Europe PMC); 50 references in the paper

Abstract

Introduction: The nucleotide-binding oligomerization domain, leucine-rich repeat, and pyrin domain-containing protein 3 (NLRP3) inflammasome is predominantly expressed in microglia within the central nervous system (CNS) and plays critical roles in neuroinflammatory diseases, including traumatic brain injury (TBI). The function of the microglial NLRP3 inflammasome may vary as the disease progresses. A comprehensive understanding of these dynamic alterations is essential for opti-mizing the therapeutic time window. Post-TBI, microglial NLRP3 levels exhib-ited significant elevation, and microglial-specific NLRP3 conditional knockout (NLRP3-CKO) reduced neurological and neuropathological impairments.

Methods: Transcriptome sequencing was performed at baseline and on days 1, 3, and 7 post-TBI using injured cortical tissue from NLRP3-CKO mice and their litter-mate controls.

Results: Notable transcriptional changes occurred on day 3 post-TBI, while fewer differentially expressed genes (DEGs) were identified at other time points. NLRP3-CKO influenced macrophage polarization on day 1 and neuronal cell survival on day 3 post-injury. In addition, NLRP3-CKO significantly reduced the upregulation of pyroptosis-related genes and the dysregulation of genes associ-ated with neuroinflammation and neuropathology after TBI. Gene set enrichment analysis (GSEA) indicated diverse potential regulatory pathways at various time points. The temporal profiles of gene expression were also analyzed, revealing distinct expression trends in several gene clusters, particularly on day 7 post-TBI. Pathway enrichment analysis of overlapping genes in these clusters identified several relevant pathways, which were further validated through quantitative real-time polymerase chain reaction (qPCR).

Discussion: Overall, these findings elucidate the dynamic effects of microglial NLRP3 on transcriptomic alterations during the acute phase of TBI and highlight potential regulatory pathways, offering insights into NLRP3 inflammasome-related pathological mechanisms and enhancing the optimization of therapeutic time windows for TBI.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above.

jstjohn/SeqPrep

License: MIT
State: the link answers, verified on 8 October 2026
Evidence: files inventoried
Commit: 575507b0b9c94701bdf67bb592da8ba91ba9639c, 4 October 2016
Languages: C (3), Shell (3), Python (3), C/C++ (2)
Size: 23 files, 11 scripts
Software Heritage: not archived
Found in: the text
Holds: README, license file, tests
Not found: CITATION.cff, environment file, continuous integration, documentation
Availability: 1 check, the latest on 8 October 2026: the link answers
  • 8 October 2026: the link answers
13 files

najoshi/sickle

License: MIT
State: the link answers, verified on 10 November 2026
Evidence: files inventoried
Commit: f3d6ae3460e94ed8162d314b74fb470c27624432, 14 March 2015
Languages: C (5), C/C++ (3)
Size: 16 files, 8 scripts
Software Heritage: archived
Found in: the text
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 2 checks, the latest on 10 November 2026: the link answers
  • 10 November 2026: the link answers
  • 8 October 2026: the link answers
10 files

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 19 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data availability statement

The datasets presented in this study can be found in online repositories. The names of the repository/repositories and accession number(s) can be found in the article/Supplementary material.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 8 October 2026: the first record

Recorded: type, language, journal, volume, pages, dates, 11 authors, 5 keywords, 50 references.

Cite

This paper

Gao, R.-B., Li, C.-H., Yang, N., Chen, X., Wang, B., Xu, D., Luo, G., Yan, Z.-J., Ning, Y.-L., Du, H., & Liu, Y.-G. (2026). Dynamic effects of microglial NLRP3 on transcriptional alterations post-traumatic brain injury. Frontiers in neuroscience, 20, 1951885.

BibTeX

@article{gao2026dynamic,
author = {Gao, Ruo-Bing and Li, Chang-Hong and Yang, Nan and Chen, Xing and Wang, Bo and Xu, Dan and Luo, Gan and Yan, Zi-Jian and Ning, Ya-Lei and Du, Hao and Liu, Yong-Gang},
title = {{Dynamic effects of microglial NLRP3 on transcriptional alterations post-traumatic brain injury}},
journal = {Frontiers in neuroscience},
year = {2026},
month = oct,
volume = {20},
pages = {1951885},
publisher = {Frontiers Media SA},
issn = {1662-4548},
pmcid = {PMC13642320}
}

RIS

TY - JOUR
AU - Gao, Ruo-Bing
AU - Li, Chang-Hong
AU - Yang, Nan
AU - Chen, Xing
AU - Wang, Bo
AU - Xu, Dan
AU - Luo, Gan
AU - Yan, Zi-Jian
AU - Ning, Ya-Lei
AU - Du, Hao
AU - Liu, Yong-Gang
TI - Dynamic effects of microglial NLRP3 on transcriptional alterations post-traumatic brain injury
T2 - Frontiers in neuroscience
J2 - Front Neurosci
PY - 2026
DA - 2026/10/08
VL - 20
SP - 1951885
SN - 1662-4548
PB - Frontiers Media SA
LA - en
ER -

CSL-JSON

{
"id": "pmcid:PMC13642320",
"type": "article-journal",
"title": "Dynamic effects of microglial NLRP3 on transcriptional alterations post-traumatic brain injury",
"container-title": "Frontiers in neuroscience",
"author": [
{
"family": "Gao",
"given": "Ruo-Bing"
},
{
"family": "Li",
"given": "Chang-Hong"
},
{
"family": "Yang",
"given": "Nan"
},
{
"family": "Chen",
"given": "Xing"
},
{
"family": "Wang",
"given": "Bo"
},
{
"family": "Xu",
"given": "Dan"
},
{
"family": "Luo",
"given": "Gan"
},
{
"family": "Yan",
"given": "Zi-Jian"
},
{
"family": "Ning",
"given": "Ya-Lei"
},
{
"family": "Du",
"given": "Hao"
},
{
"family": "Liu",
"given": "Yong-Gang"
}
],
"container-title-short": "Front Neurosci",
"volume": "20",
"page": "1951885",
"PMCID": "PMC13642320",
"ISSN": "1662-4548",
"publisher": "Frontiers Media SA",
"language": "en",
"issued": {
"date-parts": [
[
2026,
10,
8
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1038/s41598-024-71132-9
TYROBP serve as potential immune-related signature genes in the acute phase of intracerebral hemorrhage.
Journal: Scientific reports
In common: genetics / omics, cellular / molecular, 3 references
[2] doi:10.3389/fnagi.2025.1531317
Bioinformatics-driven exploration of key genes and mechanisms underlying oxidative stress in traumatic brain injury.
Journal: Frontiers in aging neuroscience
In common: traumatic brain injury, cellular / molecular, 3 references
[3] doi:10.1038/s41467-022-30963-8 [code]
Exploring the cellular landscape of circular RNAs using full-length single-cell RNA sequencing.
Journal: Nature communications
In common: genetics / omics, cellular / molecular, 4 references
[4] doi:10.1172/jci199818 [code]
Inflammasome adaptor ASC promotes sustained neuroinflammation and mild cognitive impairment in a closed-head injury model.
Journal: The Journal of clinical investigation
In common: traumatic brain injury, genetics / omics, cellular / molecular, 2 references
[5] doi:10.3389/fnins.2023.1210175
Traumatic brain injury induces an adaptive immune response in the meningeal transcriptome that is amplified by aging.
Journal: Frontiers in neuroscience
In common: traumatic brain injury, genetics / omics, cellular / molecular, 3 references
[6] doi:10.1016/j.xcrm.2026.102867
Psilocybin restores behavior and 5-HT&lt;sub&gt;2A&lt;/sub&gt; signaling while reducing microglial density after chronic traumatic brain injury in rats.
Journal: Cell reports. Medicine
In common: traumatic brain injury, cellular / molecular, 2 references
[7] doi:10.3892/mmr.2026.13967
Sedanolide alleviates LPS‑induced depressive‑like behaviors by modulating the C3a/C3aR signaling axis and microglial glycolysis.
Journal: Molecular medicine reports
In common: genetics / omics, cellular / molecular, 4 references
[8] doi:10.3389/fgene.2024.1504114
Based on bioinformatics, SESN2 negatively regulates ferroptosis induced by ischemia reperfusion via the System Xc-/GPX4 pathway.
Journal: Frontiers in genetics
In common: genetics / omics, cellular / molecular, 4 references
[9] doi:10.1186/s12866-023-03089-0
Gut dysbacteriosis induces expression differences in the adult head transcriptome of Spodoptera frugiperda in a sex-specific manner.
Journal: BMC microbiology
In common: genetics / omics, cellular / molecular, 4 references
[10] doi:10.1371/journal.pone.0291943 [code]
The microRNA-mediated gene regulatory network in the hippocampus and hypothalamus of the aging mouse.
Journal: PloS one
In common: genetics / omics, cellular / molecular, 4 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/repo/github.com/jstjohn/seqprep.svg)](https://openscicode.org/badge/repo/github.com/jstjohn/seqprep)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/repo/github.com/jstjohn/seqprep.svg
   :target: https://openscicode.org/badge/repo/github.com/jstjohn/seqprep
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/repo/github.com/jstjohn/seqprep"><img src="https://openscicode.org/badge/repo/github.com/jstjohn/seqprep.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.