Advertisement
jhangyu

seqtk name problem

Apr 12th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. static void update_read_name_for_Trinity(char* name, int comment_length, const char* comment) {
  2.  
  3.  
  4.     // see if already in the old format:
  5.     int name_len = strlen(name);
  6.     if (name[name_len -2 ] == '/'
  7.         &&
  8.         (name[name_len - 1] == '1' || name[name_len - 1] == '2') ) {
  9.  
  10.         // already as expected.
  11.         return;
  12.     }
  13.     // see if in the new format
  14.     else if (comment_length > 1
  15.              &&
  16.              comment[1] == ':'
  17.              &&
  18.              (comment[0] == '1' || comment[0] == '2') ) {
  19.        
  20.         // recognized as new format.  Convert to old format that trinity likes.
  21.         name[name_len] = '/';
  22.         name[name_len+1] = comment[0];
  23.         name[name_len + 2] = '\0';
  24.     }
  25.  
  26.     else {
  27.         fprintf(stderr, "Error, not recognizing read name formatting: [%s]\n\nIf your data come from SRA, be sure to dump the fastq file like so:\n\n\tSRA_TOOLKIT/fastq-dump --defline-seq '@$sn[_$rn]/$ri' --split-files file.sra \n\n", name);
  28.         exit(2);
  29.     }
  30.  
  31.    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement