~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to desktop/seqpanel.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2011-02-13 15:07:22 UTC
  • mfrom: (5.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110213150722-0ua6hh0mua84jxr5
Tags: 6.1.20100808-2
Reupload to unstable following the release of Debian 6.0 (squeeze).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: seqpanel.c,v 6.225 2008/07/07 18:52:31 bollin Exp $
 
1
/* $Id: seqpanel.c,v 6.228 2010/08/02 17:43:05 bollin Exp $
2
2
* ===========================================================================
3
3
*
4
4
*                            PUBLIC DOMAIN NOTICE
178
178
                                             * when the alignment panel is removed using
179
179
                                             * UnlockFarComponents.
180
180
                                             */  
 
181
  Nlm_ChangeNotifyProc on_close_func;       /* This is called when the window is being closed. */
 
182
  Pointer              on_close_data;       /* Argument for on_close_func */
 
183
 
181
184
} SeqEdFormData, PNTR SeqEdFormPtr;
182
185
 
183
186
typedef struct seqpanpara 
4305
4308
            if (ctr > 0) 
4306
4309
            {
4307
4310
              /* set end to NULL if at end of sequence */
4308
 
              if (ctr < bvp->CharsAtLine) MemSet(buf+ctr, '\0', 1);
4309
 
              /* convert to lowercase */
4310
 
              for (i = SEQ_ED_PRINT_SEQ_OFFSET; i < ctr + SEQ_ED_PRINT_SEQ_OFFSET; i++)
 
4311
              if (ctr < bvp->CharsAtLine) 
4311
4312
              {
4312
 
                buf[i] = TO_LOWER (buf[i]);
4313
 
              } 
 
4313
                MemSet(file_line + SEQ_ED_PRINT_SEQ_OFFSET + ctr, '\0', 1);
 
4314
              }
4314
4315
              
4315
4316
              SeqEdPrintTextLineToFile ((CharPtr)file_line, from, to, seq_pos, fp);
4316
4317
 
4351
4352
            PrintTranslatedFrame((CharPtr)file_line, splp->bioSeqLine, 6, bvp);
4352
4353
            SeqEdPrintTextLineToFile ((CharPtr)file_line, from, to, seq_pos, fp);
4353
4354
            break;
 
4355
          case eTypeSequenceComplement:
 
4356
            MemSet (file_line, ' ', bvp->CharsAtLine + SEQ_ED_PRINT_SEQ_OFFSET);
 
4357
            seq_pos = (c_n * SEQ_PAN_CHAPTER_SIZE + p_n) * bvp->CharsAtLine;
 
4358
            sprintf (label, "complement");
 
4359
            StringNCpy ((CharPtr)file_line, label, StringLen (label));
 
4360
 
 
4361
            ctr = 0;
 
4362
            SeqPortSeek (spp, seq_pos, SEEK_SET);
 
4363
            /* clear last message, might have read to end with last sequence line */
 
4364
            spp->lastmsg = 0;
 
4365
            ctr = SeqPortRead (spp, file_line + SEQ_ED_PRINT_SEQ_OFFSET, bvp->CharsAtLine);
 
4366
            if (ctr > 0) 
 
4367
            {
 
4368
              /* set end to NULL if at end of sequence */
 
4369
              if (ctr < bvp->CharsAtLine) MemSet(file_line + SEQ_ED_PRINT_SEQ_OFFSET + ctr, '\0', 1);
 
4370
 
 
4371
              /* complement */
 
4372
              complement_string (file_line + SEQ_ED_PRINT_SEQ_OFFSET);
 
4373
              
 
4374
              SeqEdPrintTextLineToFile ((CharPtr)file_line, from, to, seq_pos, fp);
 
4375
            }  
 
4376
            break;
4354
4377
        }
4355
4378
      }
4356
4379
      fprintf (fp, "\n");      
6785
6808
    }
6786
6809
    BioseqUnlock (sefp->bfp->bvd.bsp);
6787
6810
    
6788
 
    sefp->locked_aln_bioseqs = UnlockFarComponents (sefp->locked_aln_bioseqs);    
 
6811
    sefp->locked_aln_bioseqs = UnlockFarComponents (sefp->locked_aln_bioseqs);
 
6812
    if (sefp->on_close_func != NULL) {
 
6813
      (sefp->on_close_func)(sefp->on_close_data);
 
6814
    }
6789
6815
  }
6790
6816
 
6791
6817
  StdCleanupFormProc (g, data);
6792
6818
}
6793
6819
 
 
6820
 
 
6821
NLM_EXTERN void RemoveSeqEdCloseFunc (WindoW w)
 
6822
{
 
6823
  SeqEdFormPtr  sefp;
 
6824
 
 
6825
  sefp = (SeqEdFormPtr) GetObjectExtra (w);
 
6826
  if (sefp != NULL) {
 
6827
    sefp->on_close_func = NULL;
 
6828
    sefp->on_close_data = NULL;
 
6829
  }
 
6830
}
 
6831
 
 
6832
 
6794
6833
static void onCloseSeqEdPanel (PaneL p)
6795
6834
{
6796
6835
  BioseqViewPtr bvp;
8297
8336
  return display_line;
8298
8337
}
8299
8338
 
8300
 
static void SeqAlnScrollToAlnPos (SeqEdFormPtr sefp, Int4 pos)
 
8339
static void SeqAlnScrollToAlnPosEx (SeqEdFormPtr sefp, Int4 pos, Int4 seq_num)
8301
8340
{
8302
8341
  BaR          sb;
8303
8342
  Int4         scroll_pos, bmax;
8326
8365
  bmax = GetBarMax (sb);
8327
8366
 
8328
8367
  scroll_pos = GetScrollPosForAlnPos (pos, &(sefp->bfp->bvd));
 
8368
  if (seq_num > -1) {
 
8369
    /* need to skip two in order to move past header rows for block */
 
8370
    scroll_pos += seq_num + 2;
 
8371
  }
8329
8372
  if (scroll_pos > bmax)
8330
8373
  {
8331
8374
    scroll_pos = bmax;
8339
8382
  RestorePort (temport);
8340
8383
}
8341
8384
 
 
8385
 
 
8386
static void SeqAlnScrollToAlnPos (SeqEdFormPtr sefp, Int4 pos)
 
8387
{
 
8388
  SeqAlnScrollToAlnPosEx (sefp, pos, -1);
 
8389
}
 
8390
 
 
8391
 
 
8392
NLM_EXTERN void SeqAlnWindowScrollToAlnPos (WindoW w, Int4 aln_pos, Int4 seq_num)
 
8393
{
 
8394
  SeqEdFormPtr sefp;
 
8395
 
 
8396
  sefp = (SeqEdFormPtr) GetObjectExtra (w);
 
8397
  if (sefp != NULL) {
 
8398
    SeqAlnScrollToAlnPosEx (sefp, aln_pos, seq_num);
 
8399
  }
 
8400
}
 
8401
    
 
8402
 
8342
8403
static void SeqAlnGoToAlnPosBtn (ButtoN b)
8343
8404
{
8344
8405
  SeqEdFormPtr sefp;
8353
8414
  {
8354
8415
        return;
8355
8416
  }
 
8417
  aln_pos -= 1;
8356
8418
  
8357
8419
  SeqAlnScrollToAlnPos (sefp, aln_pos);
8358
8420
}
9413
9475
  
9414
9476
}
9415
9477
 
9416
 
extern ForM CreateAlnEditorWindow (Int2 left, Int2 top, CharPtr windowname, SeqAlignPtr salp, Uint2 entityID)
 
9478
extern ForM CreateAlnEditorWindowEx 
 
9479
(Int2 left, Int2 top, CharPtr windowname, SeqAlignPtr salp, Uint2 entityID,
 
9480
 Nlm_ChangeNotifyProc on_close_func, Pointer on_close_data)
9417
9481
{
9418
9482
  SeqEdFormPtr       sefp;
9419
9483
  WindoW             w;
9436
9500
  {
9437
9501
    return NULL;
9438
9502
  }
 
9503
 
 
9504
  sefp->on_close_func = on_close_func;
 
9505
  sefp->on_close_data = on_close_data;
9439
9506
  
9440
9507
  sefp->annot = GetSeqAnnotForAlignment (salp);
9441
9508
  
9558
9625
}
9559
9626
 
9560
9627
 
 
9628
extern ForM CreateAlnEditorWindow (Int2 left, Int2 top, CharPtr windowname, SeqAlignPtr salp, Uint2 entityID)
 
9629
{
 
9630
  return CreateAlnEditorWindowEx (left, top, windowname, salp, entityID, NULL, NULL);
 
9631
}
 
9632
 
 
9633
 
9561
9634
BioseqPageData seqpnlPageData = {
9562
9635
  "Sequence", TRUE, TRUE, TRUE, FALSE, -1,
9563
9636
  PopulateSeqView, ShowSeqView, SelectSeqView,